<?php include 'connect.php'; //Get Post ID $post_id = $_GET['id']; //Get the JSON if (isset($_GET['albumsonly'])) { $json_object = cff_fetchUrl('https://graph.facebook.com/' . $post_id . '/photos?fields=source,name,width,height&access_token=' . $access_token . '&limit=100'); } else { $json_object = cff_fetchUrl("https://graph.facebook.com/v2.2/" . $post_id . "?fields=attachments&access_token=" . $access_token); } //echo the JSON data as a string to the browser to then be converted to a JSON object in the JS file echo $json_object;
function display_cff($atts) { //Style options $options = get_option('cff_style_settings'); //Create the types string to set as shortcode default if ($options['cff_show_links_type']) { $type_string .= 'links,'; } if ($options['cff_show_event_type']) { $type_string .= 'events,'; } if ($options['cff_show_video_type']) { $type_string .= 'videos,'; } if ($options['cff_show_photos_type']) { $type_string .= 'photos,'; } if ($options['cff_show_status_type']) { $type_string .= 'statuses,'; } //Create the types string to set as shortcode default if ($options['cff_show_text']) { $include_string .= 'text,'; } if ($options['cff_show_desc']) { $include_string .= 'desc,'; } if ($options['cff_show_shared_links']) { $include_string .= 'sharedlinks,'; } if ($options['cff_show_date']) { $include_string .= 'date,'; } if ($options['cff_show_media']) { $include_string .= 'media,'; } if ($options['cff_show_event_title']) { $include_string .= 'eventtitle,'; } if ($options['cff_show_event_details']) { $include_string .= 'eventdetails,'; } if ($options['cff_show_meta']) { $include_string .= 'social,'; } if ($options['cff_show_link']) { $include_string .= 'link,'; } if ($options['cff_show_like_box']) { $include_string .= 'likebox,'; } //Pass in shortcode attrbutes $atts = shortcode_atts(array('id' => get_option('cff_page_id'), 'num' => get_option('cff_num_show'), 'limit' => get_option('cff_post_limit'), 'others' => get_option('cff_show_others'), 'cachetime' => get_option('cff_cache_time'), 'cacheunit' => get_option('cff_cache_time_unit'), 'locale' => get_option('cff_locale'), 'width' => $options['cff_feed_width'], 'height' => $options['cff_feed_height'], 'padding' => $options['cff_feed_padding'], 'bgcolor' => $options['cff_bg_color'], 'showauthor' => $options['cff_show_author'], 'class' => $options['cff_class'], 'layout' => $options['cff_preset_layout'], 'type' => $type_string, 'include' => $include_string, 'seemoretext' => $options['cff_see_more_text'], 'seelesstext' => $options['cff_see_less_text'], 'textformat' => $options['cff_title_format'], 'textsize' => $options['cff_title_size'], 'textweight' => $options['cff_title_weight'], 'textcolor' => $options['cff_title_color'], 'textlink' => $options['cff_title_link'], 'descsize' => $options['cff_body_size'], 'descweight' => $options['cff_body_weight'], 'desccolor' => $options['cff_body_color'], 'eventtitleformat' => $options['cff_event_title_format'], 'eventtitlesize' => $options['cff_event_title_size'], 'eventtitleweight' => $options['cff_event_title_weight'], 'eventtitlecolor' => $options['cff_event_title_color'], 'eventtitlelink' => $options['cff_event_title_link'], 'eventdatesize' => $options['cff_event_date_size'], 'eventdateweight' => $options['cff_event_date_weight'], 'eventdatecolor' => $options['cff_event_date_color'], 'eventdatepos' => $options['cff_event_date_position'], 'eventdateformat' => $options['cff_event_date_formatting'], 'eventdatecustom' => $options['cff_event_date_custom'], 'eventdetailssize' => $options['cff_event_details_size'], 'eventdetailsweight' => $options['cff_event_details_weight'], 'eventdetailscolor' => $options['cff_event_details_color'], 'datepos' => $options['cff_date_position'], 'datesize' => $options['cff_date_size'], 'dateweight' => $options['cff_date_weight'], 'datecolor' => $options['cff_date_color'], 'dateformat' => $options['cff_date_formatting'], 'datecustom' => $options['cff_date_custom'], 'linksize' => $options['cff_link_size'], 'linkweight' => $options['cff_link_weight'], 'linkcolor' => $options['cff_link_color'], 'facebooklinktext' => $options['cff_facebook_link_text'], 'viewlinktext' => $options['cff_view_link_text'], 'linktotimeline' => $options['cff_link_to_timeline'], 'iconstyle' => $options['cff_icon_style'], 'socialtextcolor' => $options['cff_meta_text_color'], 'socialbgcolor' => $options['cff_meta_bg_color'], 'textlength' => get_option('cff_title_length'), 'desclength' => get_option('cff_body_length'), 'likeboxpos' => $options['cff_like_box_position'], 'likeboxoutside' => $options['cff_like_box_outside'], 'likeboxcolor' => $options['cff_likebox_bg_color'], 'likeboxwidth' => $options['cff_likebox_width'], 'likeboxfaces' => $options['cff_like_box_faces'], 'videoheight' => $options['cff_video_height'], 'videoaction' => $options['cff_video_action'], 'sepcolor' => $options['cff_sep_color'], 'sepsize' => $options['cff_sep_size']), $atts); /********** GENERAL **********/ $cff_feed_width = $atts['width']; $cff_feed_height = $atts['height']; $cff_feed_padding = $atts['padding']; $cff_bg_color = $atts['bgcolor']; $cff_show_author = $atts['showauthor']; $cff_cache_time = $atts['cachetime']; $cff_locale = $atts['locale']; if (empty($cff_locale) || !isset($cff_locale) || $cff_locale == '') { $cff_locale = 'en_US'; } if (!isset($cff_cache_time)) { $cff_cache_time = 0; } $cff_cache_time_unit = $atts['cacheunit']; $cff_class = $atts['class']; //Compile feed styles $cff_feed_styles = 'style="'; if (!empty($cff_feed_width)) { $cff_feed_styles .= 'width:' . $cff_feed_width . '; '; } if (!empty($cff_feed_height)) { $cff_feed_styles .= 'height:' . $cff_feed_height . '; '; } if (!empty($cff_feed_padding)) { $cff_feed_styles .= 'padding:' . $cff_feed_padding . '; '; } if (!empty($cff_bg_color)) { $cff_feed_styles .= 'background-color:#' . $cff_bg_color . '; '; } $cff_feed_styles .= '"'; //Like box $cff_like_box_position = $atts['likeboxpos']; $cff_like_box_outside = $atts['likeboxoutside']; //Open links in new window? $cff_open_links = $options['cff_open_links']; $target = 'target="_blank"'; if ($cff_open_links) { $target = 'target="_blank"'; } /********** POST TYPES **********/ $cff_types = $atts['type']; //Look for non-plural version of string in the types string in case user specifies singular in shortcode $cff_show_links_type = true; $cff_show_event_type = true; $cff_show_video_type = true; $cff_show_photos_type = true; $cff_show_status_type = true; $cff_events_only = false; //Are we showing ONLY events? 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; } /********** LAYOUT **********/ $cff_includes = $atts['include']; //Look for non-plural version of string in the types string in case user specifies singular in shortcode if (stripos($cff_includes, 'text') !== false) { $cff_show_text = true; } if (stripos($cff_includes, 'desc') !== false) { $cff_show_desc = true; } if (stripos($cff_includes, 'sharedlink') !== false) { $cff_show_shared_links = true; } if (stripos($cff_includes, 'date') !== false) { $cff_show_date = true; } if (stripos($cff_includes, 'media') !== false) { $cff_show_media = true; } if (stripos($cff_includes, 'eventtitle') !== false) { $cff_show_event_title = true; } if (stripos($cff_includes, 'eventdetail') !== false) { $cff_show_event_details = true; } if (stripos($cff_includes, 'social') !== false) { $cff_show_meta = true; } if (stripos($cff_includes, ',link') !== false) { $cff_show_link = true; } //comma used to separate it from 'sharedlinks' - which also contains 'link' string if (stripos($cff_includes, 'like') !== false) { $cff_show_like_box = true; } $cff_preset_layout = 'thumb'; /********** META **********/ $cff_icon_style = $atts['iconstyle']; $cff_meta_text_color = $atts['socialtextcolor']; $cff_meta_bg_color = $atts['socialbgcolor']; $cff_meta_styles = 'style="'; if (!empty($cff_meta_text_color)) { $cff_meta_styles .= 'color:#' . $cff_meta_text_color . ';'; } if (!empty($cff_meta_bg_color)) { $cff_meta_styles .= 'background-color:#' . $cff_meta_bg_color . ';'; } $cff_meta_styles .= '"'; $cff_nocomments_text = $options['cff_nocomments_text']; $cff_hide_comments = $options['cff_hide_comments']; if (!isset($cff_nocomments_text) || empty($cff_nocomments_text)) { $cff_hide_comments = true; } /********** TYPOGRAPHY **********/ //See More text $cff_see_more_text = $atts['seemoretext']; $cff_see_less_text = $atts['seelesstext']; //See Less text //Title $cff_title_format = $atts['textformat']; if (empty($cff_title_format)) { $cff_title_format = 'p'; } $cff_title_size = $atts['textsize']; $cff_title_weight = $atts['textweight']; $cff_title_color = $atts['textcolor']; $cff_title_styles = 'style="'; if (!empty($cff_title_size) && $cff_title_size != 'inherit') { $cff_title_styles .= 'font-size:' . $cff_title_size . 'px; '; } if (!empty($cff_title_weight) && $cff_title_weight != 'inherit') { $cff_title_styles .= 'font-weight:' . $cff_title_weight . '; '; } if (!empty($cff_title_color)) { $cff_title_styles .= 'color:#' . $cff_title_color . ';'; } $cff_title_styles .= '"'; $cff_title_link = $atts['textlink']; //Description $cff_body_size = $atts['descsize']; $cff_body_weight = $atts['descweight']; $cff_body_color = $atts['desccolor']; $cff_body_styles = 'style="'; if (!empty($cff_body_size) && $cff_body_size != 'inherit') { $cff_body_styles .= 'font-size:' . $cff_body_size . 'px; '; } if (!empty($cff_body_weight) && $cff_body_weight != 'inherit') { $cff_body_styles .= 'font-weight:' . $cff_body_weight . '; '; } if (!empty($cff_body_color)) { $cff_body_styles .= 'color:#' . $cff_body_color . ';'; } $cff_body_styles .= '"'; //Event Title $cff_event_title_format = $atts['eventtitleformat']; if (empty($cff_event_title_format)) { $cff_event_title_format = 'p'; } $cff_event_title_size = $atts['eventtitlesize']; $cff_event_title_weight = $atts['eventtitleweight']; $cff_event_title_color = $atts['eventtitlecolor']; $cff_event_title_styles = 'style="'; if (!empty($cff_event_title_size) && $cff_event_title_size != 'inherit') { $cff_event_title_styles .= 'font-size:' . $cff_event_title_size . 'px; '; } if (!empty($cff_event_title_weight) && $cff_event_title_weight != 'inherit') { $cff_event_title_styles .= 'font-weight:' . $cff_event_title_weight . '; '; } if (!empty($cff_event_title_color)) { $cff_event_title_styles .= 'color:#' . $cff_event_title_color . ';'; } $cff_event_title_styles .= '"'; $cff_event_title_link = $atts['eventtitlelink']; //Event Date $cff_event_date_size = $atts['eventdatesize']; $cff_event_date_weight = $atts['eventdateweight']; $cff_event_date_color = $atts['eventdatecolor']; $cff_event_date_position = $atts['eventdatepos']; $cff_event_date_formatting = $atts['eventdateformat']; $cff_event_date_custom = $atts['eventdatecustom']; $cff_event_date_styles = 'style="'; if (!empty($cff_event_date_size) && $cff_event_date_size != 'inherit') { $cff_event_date_styles .= 'font-size:' . $cff_event_date_size . 'px; '; } if (!empty($cff_event_date_weight) && $cff_event_date_weight != 'inherit') { $cff_event_date_styles .= 'font-weight:' . $cff_event_date_weight . '; '; } if (!empty($cff_event_date_color)) { $cff_event_date_styles .= 'color:#' . $cff_event_date_color . ';'; } $cff_event_date_styles .= '"'; //Event Details $cff_event_details_size = $atts['eventdetailssize']; $cff_event_details_weight = $atts['eventdetailsweight']; $cff_event_details_color = $atts['eventdetailscolor']; $cff_event_details_styles = 'style="'; if (!empty($cff_event_details_size) && $cff_event_details_size != 'inherit') { $cff_event_details_styles .= 'font-size:' . $cff_event_details_size . 'px; '; } if (!empty($cff_event_details_weight) && $cff_event_details_weight != 'inherit') { $cff_event_details_styles .= 'font-weight:' . $cff_event_details_weight . '; '; } if (!empty($cff_event_details_color)) { $cff_event_details_styles .= 'color:#' . $cff_event_details_color . ';'; } $cff_event_details_styles .= '"'; //Date $cff_date_position = $atts['datepos']; if (!isset($cff_date_position)) { $cff_date_position = 'above'; } $cff_date_size = $atts['datesize']; $cff_date_weight = $atts['dateweight']; $cff_date_color = $atts['datecolor']; $cff_date_styles = 'style="'; if (!empty($cff_date_size) && $cff_date_size != 'inherit') { $cff_date_styles .= 'font-size:' . $cff_date_size . 'px; '; } if (!empty($cff_date_weight) && $cff_date_weight != 'inherit') { $cff_date_styles .= 'font-weight:' . $cff_date_weight . '; '; } if (!empty($cff_date_color)) { $cff_date_styles .= 'color:#' . $cff_date_color . ';'; } $cff_date_styles .= '"'; $cff_date_before = $options['cff_date_before']; $cff_date_after = $options['cff_date_after']; //Link to Facebook $cff_link_size = $atts['linksize']; $cff_link_weight = $atts['linkweight']; $cff_link_color = $atts['linkcolor']; $cff_link_styles = 'style="'; if (!empty($cff_link_size) && $cff_link_size != 'inherit') { $cff_link_styles .= 'font-size:' . $cff_link_size . 'px; '; } if (!empty($cff_link_weight) && $cff_link_weight != 'inherit') { $cff_link_styles .= 'font-weight:' . $cff_link_weight . '; '; } if (!empty($cff_link_color)) { $cff_link_styles .= 'color:#' . $cff_link_color . ';'; } $cff_link_styles .= '"'; $cff_facebook_link_text = $atts['facebooklinktext']; $cff_view_link_text = $atts['viewlinktext']; $cff_link_to_timeline = $atts['linktotimeline']; /********** MISC **********/ //Like Box styles $cff_likebox_bg_color = $atts['likeboxcolor']; $cff_likebox_styles = 'style="'; if (!empty($cff_likebox_bg_color)) { $cff_likebox_styles .= 'background-color:#' . $cff_likebox_bg_color . '; margin-left: 0; '; } $cff_likebox_styles .= '"'; //Video //Dimensions $cff_video_width = 640; $cff_video_height = $atts['videoheight']; if ($cff_thumb_layout) { if (empty($cff_video_height)) { $cff_video_height = 100; } } else { if ($cff_half_layout) { if (empty($cff_video_height)) { $cff_video_height = 180; } } else { if (empty($cff_video_height)) { $cff_video_height = 360; } } } //Action $cff_video_action = $atts['videoaction']; //Separating Line $cff_sep_color = $atts['sepcolor']; if (empty($cff_sep_color)) { $cff_sep_color = 'ddd'; } $cff_sep_size = $atts['sepsize']; if (empty($cff_sep_size)) { $cff_sep_size = 0; } //CFF item styles $cff_item_styles = 'style="'; $cff_item_styles .= 'border-bottom: ' . $cff_sep_size . 'px solid #' . $cff_sep_color . '; '; $cff_item_styles .= '"'; //Text limits $title_limit = $atts['textlength']; if (!isset($title_limit)) { $title_limit = 9999; } $body_limit = $atts['desclength']; //Assign the Access Token and Page ID variables $access_token = get_option('cff_access_token'); $page_id = $atts['id']; //Get show posts attribute. If not set then default to 25 $show_posts = $atts['num']; if (empty($show_posts)) { $show_posts = 25; } if ($show_posts == 0 || $show_posts == undefined) { $show_posts = 25; } //Check whether the Access Token is present and valid if ($access_token == '') { echo 'Please enter a valid Access Token. You can do this in the Custom Facebook Feed plugin settings.<br /><br />'; return false; } //Check whether a Page ID has been defined if ($page_id == '') { 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 />"; return false; } //Use posts? or feed? $show_others = $atts['others']; $graph_query = 'posts'; if ($show_others == 'on' || $show_others == 'true' || $show_others == true) { $graph_query = 'feed'; } $cff_post_limit = $atts['limit']; //Calculate the cache time in seconds if ($cff_cache_time_unit == 'minutes') { $cff_cache_time_unit = 60; } if ($cff_cache_time_unit == 'hours') { $cff_cache_time_unit = 60 * 60; } if ($cff_cache_time_unit == 'days') { $cff_cache_time_unit = 60 * 60 * 24; } $cache_seconds = $cff_cache_time * $cff_cache_time_unit; //Get like box vars $cff_likebox_width = $atts['likeboxwidth']; if (!isset($cff_likebox_width) || empty($cff_likebox_width) || $cff_likebox_width == '') { $cff_likebox_width = 300; } $cff_like_box_faces = $atts['likeboxfaces']; if (!isset($cff_like_box_faces) || empty($cff_like_box_faces)) { $cff_like_box_faces = 'false'; } //Set like box variable $like_box = '<div class="cff-likebox'; if ($cff_like_box_outside) { $like_box .= ' cff-outside'; } $like_box .= $cff_like_box_position == 'top' ? ' cff-top' : ' cff-bottom'; $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>'; //***START FEED*** $content = ''; //Add like box to the outside of the top of feed if ($cff_like_box_position == 'top' && $cff_show_like_box && $cff_like_box_outside) { $content .= $like_box; } //Create CFF container HTML $content .= '<div id="cff" rel="' . $title_limit . '" class="'; if (!empty($cff_class)) { $content .= $cff_class . ' '; } if (!empty($cff_feed_height)) { $content .= 'cff-fixed-height '; } if ($cff_thumb_layout) { $content .= 'cff-thumb-layout '; } // if ( $cff_media_medium ) $content .= 'medium-image '; if ($cff_half_layout) { $content .= 'cff-half-layout '; } $content .= '" ' . $cff_feed_styles . '>'; //Add like box to the inside of the top of feed if ($cff_like_box_position == 'top' && $cff_show_like_box && !$cff_like_box_outside) { $content .= $like_box; } //Limit var $i = 0; //ALL POSTS if (!$cff_events_only) { $cff_posts_json_url = 'https://graph.facebook.com/' . $page_id . '/' . $graph_query . '?access_token=' . $access_token . '&limit=' . $cff_post_limit . '&locale=' . $cff_locale; //Don't use caching if the cache time is set to zero if ($cff_cache_time != 0) { // Get any existing copy of our transient data $transient_name = 'cff_' . $graph_query . '_json_' . $page_id; if (false === ($posts_json = get_transient($transient_name)) || $posts_json === null) { //Get the contents of the Facebook page $posts_json = cff_fetchUrl($cff_posts_json_url); //Cache the JSON set_transient($transient_name, $posts_json, $cache_seconds); } else { $posts_json = get_transient($transient_name); } } else { $posts_json = cff_fetchUrl($cff_posts_json_url); } //Interpret data with JSON $FBdata = json_decode($posts_json); //***STARTS POSTS LOOP*** foreach ($FBdata->data as $news) { //Explode News and Page ID's into 2 values $PostID = explode("_", $news->id); //Check the post type $cff_post_type = $news->type; if ($cff_post_type == 'link') { $story = $news->story; //Check whether it's an event $created_event = 'created an event.'; $shared_event = 'shared an event.'; $created_event = stripos($story, $created_event); $shared_event = stripos($story, $shared_event); if ($created_event || $shared_event) { $cff_post_type = 'event'; } } //Should we show this post or not? $cff_show_post = false; switch ($cff_post_type) { case 'link': if ($cff_show_links_type) { $cff_show_post = true; } break; case 'event': if ($cff_show_event_type) { $cff_show_post = true; } break; case 'video': if ($cff_show_video_type) { $cff_show_post = true; } break; case 'swf': if ($cff_show_video_type) { $cff_show_post = true; } break; case 'photo': if ($cff_show_photos_type) { $cff_show_post = true; } break; case 'offer': $cff_show_post = true; break; case 'status': //Check whether it's a status (author comment or like) if ($cff_show_status_type && !empty($news->message)) { $cff_show_post = true; } break; } //Is it a duplicate post? if ($prev_post_message == $news->message && $prev_post_link == $news->link && $prev_post_description == $news->description) { $cff_show_post = false; } //Check post type and display post if selected if ($cff_show_post) { //If it isn't then create the post //Only create posts for the amount of posts specified if ($i == $show_posts) { break; } $i++; //********************************// //***COMPILE SECTION VARIABLES***// //********************************// //Set the post link //$link = $news->link; $link = ''; //Is it a shared album? $shared_album_string = 'shared an album:'; $shared_album = stripos($news->story, $shared_album_string); if ($shared_album) { $link = str_replace('photo.php?', 'media/set/?', $link); } //If there's no link provided then link to either the Facebook page or the individual status if (empty($link)) { if ($cff_link_to_timeline == true) { //Link to page $link = 'http://facebook.com/' . $page_id; } else { //Link to status $link = "https://www.facebook.com/" . $page_id . "/posts/" . $PostID[1]; } } //POST AUTHOR $cff_author = '<a class="cff-author" href="http://facebook.com/' . $news->from->id . '" ' . $target . ' title="' . $news->from->name . ' on Facebook">'; $cff_author .= '<img src="http://graph.facebook.com/' . $news->from->id . '/picture">'; $cff_author .= '<p>' . $news->from->name . '</p>'; $cff_author .= '</a>'; //POST TEXT $cff_post_text = '<' . $cff_title_format . ' class="cff-post-text" ' . $cff_title_styles . '>'; $cff_post_text .= '<span class="cff-text">'; //if ($cff_title_link) $cff_post_text .= '<a class="cff-post-text-link" href="'.$link.'" '.$target.'>'; if (!empty($news->story)) { $post_text = $news->story; } if (!empty($news->message)) { $post_text = $news->message; } //Use the name if neither the story or message are available, or if the post type is an offer if (!empty($news->name) && empty($news->story) && empty($news->message) || $cff_post_type == 'offer') { $post_text = $news->name; } //If the text is wrapped in a link then don't hyperlink any text within $post_text = cff_trim_post($post_text); if ($cff_title_link) { //Wrap links in a span so we can break the text if it's too long $cff_post_text .= cff_wrap_span($post_text) . ' '; } else { $cff_post_text .= cff_make_clickable($post_text) . ' '; } //if ($cff_title_link) $cff_post_text .= '</a>'; $cff_post_text .= '</span>'; //'See More' link $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>'; $cff_post_text .= '</' . $cff_title_format . '>'; //DESCRIPTION $cff_description = ''; //Use the description if it's available and the post type isn't set to offer (offer description isn't useful) if (!empty($news->description) && $cff_post_type != 'offer') { $description_text = $news->description; if (!empty($body_limit)) { if (strlen($description_text) > $body_limit) { $description_text = substr($description_text, 0, $body_limit) . '...'; } } $cff_description .= '<p class="cff-post-desc" ' . $cff_body_styles . '><span>' . cff_make_clickable($description_text) . '</span></p>'; } //LINK $cff_shared_link = ''; //Display shared link if ($news->type == 'link') { //Display link name and description if (!empty($news->description)) { $cff_shared_link .= '<p class="cff-text-link '; $cff_shared_link .= 'cff-no-image'; $cff_shared_link .= '"><a href="' . $link . '" ' . $target . '>' . '<b>' . $news->name . '</b></a></p>'; } } //DATE $cff_date_formatting = $atts['dateformat']; $cff_date_custom = $atts['datecustom']; $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>'; //EVENT $cff_event = ''; if ($cff_show_event_title || $cff_show_event_details) { //Check for media if ($cff_post_type == 'event') { //Get the event object $eventID = $PostID[1]; if ($shared_event) { //Get the event id from the event URL. eg: http://www.facebook.com/events/123451234512345/ $event_url = parse_url($link); $url_parts = explode('/', $event_url['path']); //Get the id from the parts $eventID = $url_parts[count($url_parts) - 2]; } //Get the contents of the event using the WP HTTP API $event_json = cff_fetchUrl('https://graph.facebook.com/' . $eventID . '?access_token=' . $access_token); //Interpret data with JSON $event_object = json_decode($event_json); //Event date $event_time = $event_object->start_time; //If timezone migration is enabled then remove last 5 characters if (strlen($event_time) == 24) { $event_time = substr($event_time, 0, -5); } 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>'; } //EVENT //Display the event details $cff_event .= '<div class="cff-details">'; //show event date above title if ($cff_event_date_position == 'above') { $cff_event .= $cff_event_date; } //Show event title if ($cff_show_event_title && !empty($event_object->name)) { if ($cff_event_title_link) { $cff_event .= '<a href="' . $link . '">'; } $cff_event .= '<' . $cff_event_title_format . ' ' . $cff_event_title_styles . '>' . $event_object->name . '</' . $cff_event_title_format . '>'; if ($cff_event_title_link) { $cff_event .= '</a>'; } } //show event date below title if ($cff_event_date_position !== 'above') { $cff_event .= $cff_event_date; } //Show event details if ($cff_show_event_details) { //Location if (!empty($event_object->location)) { $cff_event .= '<p class="cff-where" ' . $cff_event_details_styles . '>' . $event_object->location . '</p>'; } //Description if (!empty($event_object->description)) { $description = $event_object->description; if (!empty($body_limit)) { if (strlen($description) > $body_limit) { $description = substr($description, 0, $body_limit) . '...'; } } $cff_event .= '<p class="cff-info" ' . $cff_event_details_styles . '>' . cff_make_clickable($description) . '</p>'; } } $cff_event .= '</div>'; } } //Display the link to the Facebook post or external link $cff_link = ''; //Default link $cff_viewpost_class = 'cff-viewpost-facebook'; if ($cff_facebook_link_text == '') { $cff_facebook_link_text = 'View on Facebook'; } $link_text = $cff_facebook_link_text; if (!empty($news->link)) { //Check whether it links to facebook or somewhere else $facebook_str = 'facebook.com'; if (stripos($link, $facebook_str) == false) { if ($cff_view_link_text == '') { $cff_view_link_text = 'View Link'; } $link_text = $cff_view_link_text; } $cff_viewpost_class = 'cff-viewpost-link'; } if ($cff_post_type == 'offer') { $link_text = 'View Offer'; } $cff_link = '<a class="' . $cff_viewpost_class . ' overlay" href="' . $link . '" title="' . $link_text . '" ' . $target . ' ' . $cff_link_styles . '><div class="bug">' . $link_text . '</div></a>'; //Compile the meta and link if included if ($cff_show_meta) { $cff_meta_total .= $cff_meta; } if ($cff_show_link) { $cff_meta_total .= $cff_link; } $cff_meta_total .= '</div>'; $cff_comments = ''; //Compile comments if meta is included if ($cff_show_meta) { $cff_meta_total .= $cff_comments; } //**************************// //***CREATE THE POST HTML***// //**************************// //Start the container $content .= '<div class="cff-item '; if ($cff_post_type == 'link') { $content .= 'cff-link-item'; } if ($cff_post_type == 'event') { $content .= 'cff-timeline-event'; } if ($cff_post_type == 'photo') { $content .= 'cff-photo-post'; } if ($cff_post_type == 'video') { $content .= 'cff-video-post'; } if ($cff_post_type == 'swf') { $content .= 'cff-swf-post'; } if ($cff_post_type == 'status') { $content .= 'cff-status-post'; } if ($cff_post_type == 'offer') { $content .= 'cff-offer-post'; } $content .= '" id="' . $news->id . '" ' . $cff_item_styles . '>'; //add our icon $content .= '<div class="social-bug"><div class="hex">⬢<i class="fa fa-facebook"></i></div></div>'; //add a wrapper $content .= '<div class="cff-wrap">'; //DATE ABOVE if ($cff_show_date && $cff_date_position == 'above') { $content .= $cff_date; } //POST AUTHOR if ($cff_show_author) { $content .= $cff_author; } //POST TEXT if ($cff_show_text) { $content .= $cff_post_text; } //DESCRIPTION if ($cff_show_desc) { $content .= $cff_description; } //LINK if ($cff_show_shared_links) { $content .= $cff_shared_link; } //DATE BELOW if ($cff_show_date && $cff_date_position == 'below') { $content .= $cff_date; } //EVENT if ($cff_show_event_title || $cff_show_event_details) { $content .= $cff_event; } //close the wrapper $content .= '</div>'; //add the overlay //VIEW ON FACEBOOK LINK if ($cff_show_link) { $content .= $cff_link; } //End the post item // $content .= '</div><div class="cff-clear"></div>'; $content .= '</div>'; } // End post type check $prev_post_message = $news->message; $prev_post_link = $news->link; $prev_post_description = $news->description; } // End the loop } // End ALL POSTS //Load more posts // $content .= '<button class="loadmore">Load More Posts</button>'; //Add the Like Box inside if ($cff_like_box_position == 'bottom' && $cff_show_like_box && !$cff_like_box_outside) { $content .= $like_box; } //End the feed //$content .= '</div><div class="cff-clear"></div>'; $content .= '</div>'; //Add the Like Box outside if ($cff_like_box_position == 'bottom' && $cff_show_like_box && $cff_like_box_outside) { $content .= $like_box; } //Return our feed HTML to display return $content; }
function display_cff($atts, $content = null) { //Which extensions are active? include_once ABSPATH . 'wp-admin/includes/plugin.php'; $cff_ext_options = get_option('cff_extensions_status'); //Set extensions in extensions plugin all to false by default $cff_ext_multifeed_active_check = false; $cff_ext_date_range_active_check = false; $cff_ext_featured_post_active_check = false; $cff_ext_album_active_check = false; if (WPW_SL_ITEM_NAME == 'Custom Facebook Feed WordPress Plugin Smash') { //Set page variables if (isset($cff_ext_options['cff_extensions_multifeed_active'])) { $cff_ext_multifeed_active_check = $cff_ext_options['cff_extensions_multifeed_active']; } if (isset($cff_ext_options['cff_extensions_date_range_active'])) { $cff_ext_date_range_active_check = $cff_ext_options['cff_extensions_date_range_active']; } if (isset($cff_ext_options['cff_extensions_featured_post_active'])) { $cff_ext_featured_post_active_check = $cff_ext_options['cff_extensions_featured_post_active']; } if (isset($cff_ext_options['cff_extensions_album_active'])) { $cff_ext_album_active_check = $cff_ext_options['cff_extensions_album_active']; } } is_plugin_active('cff-multifeed/cff-multifeed.php') || $cff_ext_multifeed_active_check ? $cff_ext_multifeed_active = true : ($cff_ext_multifeed_active = false); is_plugin_active('cff-date-range/cff-date-range.php') || $cff_ext_date_range_active_check ? $cff_ext_date_active = true : ($cff_ext_date_active = false); is_plugin_active('cff-featured-post/cff-featured-post.php') || $cff_ext_featured_post_active_check ? $cff_featured_post_active = true : ($cff_featured_post_active = false); is_plugin_active('cff-album/cff-album.php') || $cff_ext_album_active_check ? $cff_album_active = true : ($cff_album_active = false); //Style options $options = get_option('cff_style_settings'); //Create the types string to set as shortcode default $type_string = ''; if ($options['cff_show_links_type']) { $type_string .= 'links,'; } if ($options['cff_show_event_type']) { $type_string .= 'events,'; } if ($options['cff_show_video_type']) { $type_string .= 'videos,'; } if ($options['cff_show_photos_type']) { $type_string .= 'photos,'; } if ($options['cff_show_albums_type']) { $type_string .= 'albums,'; } //If the album option hasn't been set yet in the $options array (ie. plugin has been updated but the option hasn't been saved) then set albums to display by default if (!array_key_exists('cff_show_albums_type', $options)) { $type_string .= 'albums,'; } if ($options['cff_show_status_type']) { $type_string .= 'statuses,'; } //Create the includes string to set as shortcode default $include_string = ''; if ($options['cff_show_author']) { $include_string .= 'author,'; } if ($options['cff_show_text']) { $include_string .= 'text,'; } if ($options['cff_show_desc']) { $include_string .= 'desc,'; } if ($options['cff_show_shared_links']) { $include_string .= 'sharedlinks,'; } if ($options['cff_show_date']) { $include_string .= 'date,'; } if ($options['cff_show_media']) { $include_string .= 'media,'; } if ($options['cff_show_event_title']) { $include_string .= 'eventtitle,'; } if ($options['cff_show_event_details']) { $include_string .= 'eventdetails,'; } if ($options['cff_show_meta']) { $include_string .= 'social,'; } if ($options['cff_show_link']) { $include_string .= 'link,'; } if ($options['cff_show_like_box']) { $include_string .= 'likebox,'; } //Pass in shortcode attrbutes $atts = shortcode_atts(array('accesstoken' => get_option('cff_access_token'), 'id' => get_option('cff_page_id'), 'pagetype' => get_option('cff_page_type'), 'num' => get_option('cff_num_show'), 'limit' => get_option('cff_post_limit'), 'others' => '', 'showpostsby' => get_option('cff_show_others'), 'cachetime' => get_option('cff_cache_time'), 'cacheunit' => get_option('cff_cache_time_unit'), 'locale' => get_option('cff_locale'), 'ajax' => get_option('cff_ajax'), 'offset' => '', 'width' => isset($options['cff_feed_width']) ? $options['cff_feed_width'] : '', 'height' => isset($options['cff_feed_height']) ? $options['cff_feed_height'] : '', 'padding' => isset($options['cff_feed_padding']) ? $options['cff_feed_padding'] : '', 'bgcolor' => isset($options['cff_bg_color']) ? $options['cff_bg_color'] : '', 'showauthor' => '', 'showauthornew' => isset($options['cff_show_author']) ? $options['cff_show_author'] : '', 'class' => isset($options['cff_class']) ? $options['cff_class'] : '', 'type' => $type_string, 'eventsource' => isset($options['cff_events_source']) ? $options['cff_events_source'] : '', 'eventoffset' => isset($options['cff_event_offset']) ? $options['cff_event_offset'] : '', 'eventimage' => isset($options['cff_event_image_size']) ? $options['cff_event_image_size'] : '', 'pastevents' => 'false', 'albumsource' => isset($options['cff_albums_source']) ? $options['cff_albums_source'] : '', 'showalbumtitle' => isset($options['cff_show_album_title']) ? $options['cff_show_album_title'] : '', 'showalbumnum' => isset($options['cff_show_album_number']) ? $options['cff_show_album_number'] : '', 'albumcols' => isset($options['cff_album_cols']) ? $options['cff_album_cols'] : '', 'photosource' => isset($options['cff_photos_source']) ? $options['cff_photos_source'] : '', 'photocols' => isset($options['cff_photos_cols']) ? $options['cff_photos_cols'] : '', 'videosource' => isset($options['cff_videos_source']) ? $options['cff_videos_source'] : '', 'showvideoname' => isset($options['cff_show_video_name']) ? $options['cff_show_video_name'] : '', 'showvideodesc' => isset($options['cff_show_video_desc']) ? $options['cff_show_video_desc'] : '', 'videocols' => isset($options['cff_video_cols']) ? $options['cff_video_cols'] : '', 'filter' => isset($options['cff_filter_string']) ? $options['cff_filter_string'] : '', 'exfilter' => isset($options['cff_exclude_string']) ? $options['cff_exclude_string'] : '', 'layout' => isset($options['cff_preset_layout']) ? $options['cff_preset_layout'] : '', 'enablenarrow' => isset($options['cff_enable_narrow']) ? $options['cff_enable_narrow'] : '', 'mediaposition' => isset($options['cff_media_position']) ? $options['cff_media_position'] : '', 'disablelightbox' => isset($options['cff_disable_lightbox']) ? $options['cff_disable_lightbox'] : '', 'include' => $include_string, 'exclude' => '', 'postbgcolor' => isset($options['cff_post_bg_color']) ? $options['cff_post_bg_color'] : '', 'postcorners' => isset($options['cff_post_rounded']) ? $options['cff_post_rounded'] : '', 'textformat' => isset($options['cff_title_format']) ? $options['cff_title_format'] : '', 'textsize' => isset($options['cff_title_size']) ? $options['cff_title_size'] : '', 'textweight' => isset($options['cff_title_weight']) ? $options['cff_title_weight'] : '', 'textcolor' => isset($options['cff_title_color']) ? $options['cff_title_color'] : '', 'textlinkcolor' => isset($options['cff_posttext_link_color']) ? $options['cff_posttext_link_color'] : '', 'textlink' => isset($options['cff_title_link']) ? $options['cff_title_link'] : '', 'posttags' => isset($options['cff_post_tags']) ? $options['cff_post_tags'] : '', 'linkhashtags' => isset($options['cff_link_hashtags']) ? $options['cff_link_hashtags'] : '', 'authorsize' => isset($options['cff_author_size']) ? $options['cff_author_size'] : '', 'authorcolor' => isset($options['cff_author_color']) ? $options['cff_author_color'] : '', 'descsize' => isset($options['cff_body_size']) ? $options['cff_body_size'] : '', 'descweight' => isset($options['cff_body_weight']) ? $options['cff_body_weight'] : '', 'desccolor' => isset($options['cff_body_color']) ? $options['cff_body_color'] : '', 'linktitleformat' => isset($options['cff_link_title_format']) ? $options['cff_link_title_format'] : '', 'fulllinkimages' => isset($options['cff_full_link_images']) ? $options['cff_full_link_images'] : '', 'linktitlesize' => isset($options['cff_link_title_size']) ? $options['cff_link_title_size'] : '', 'linktitlecolor' => isset($options['cff_link_title_color']) ? $options['cff_link_title_color'] : '', 'linkurlcolor' => isset($options['cff_link_url_color']) ? $options['cff_link_url_color'] : '', 'linkbgcolor' => isset($options['cff_link_bg_color']) ? $options['cff_link_bg_color'] : '', 'linkbordercolor' => isset($options['cff_link_border_color']) ? $options['cff_link_border_color'] : '', 'disablelinkbox' => isset($options['cff_disable_link_box']) ? $options['cff_disable_link_box'] : '', 'eventtitleformat' => isset($options['cff_event_title_format']) ? $options['cff_event_title_format'] : '', 'eventtitlesize' => isset($options['cff_event_title_size']) ? $options['cff_event_title_size'] : '', 'eventtitleweight' => isset($options['cff_event_title_weight']) ? $options['cff_event_title_weight'] : '', 'eventtitlecolor' => isset($options['cff_event_title_color']) ? $options['cff_event_title_color'] : '', 'eventtitlelink' => isset($options['cff_event_title_link']) ? $options['cff_event_title_link'] : '', 'eventdatesize' => isset($options['cff_event_date_size']) ? $options['cff_event_date_size'] : '', 'eventdateweight' => isset($options['cff_event_date_weight']) ? $options['cff_event_date_weight'] : '', 'eventdatecolor' => isset($options['cff_event_date_color']) ? $options['cff_event_date_color'] : '', 'eventdatepos' => isset($options['cff_event_date_position']) ? $options['cff_event_date_position'] : '', 'eventdateformat' => isset($options['cff_event_date_formatting']) ? $options['cff_event_date_formatting'] : '', 'eventdatecustom' => isset($options['cff_event_date_custom']) ? $options['cff_event_date_custom'] : '', 'eventdetailssize' => isset($options['cff_event_details_size']) ? $options['cff_event_details_size'] : '', 'eventdetailsweight' => isset($options['cff_event_details_weight']) ? $options['cff_event_details_weight'] : '', 'eventdetailscolor' => isset($options['cff_event_details_color']) ? $options['cff_event_details_color'] : '', 'eventlinkcolor' => isset($options['cff_event_link_color']) ? $options['cff_event_link_color'] : '', 'datepos' => isset($options['cff_date_position']) ? $options['cff_date_position'] : '', 'datesize' => isset($options['cff_date_size']) ? $options['cff_date_size'] : '', 'dateweight' => isset($options['cff_date_weight']) ? $options['cff_date_weight'] : '', 'datecolor' => isset($options['cff_date_color']) ? $options['cff_date_color'] : '', 'dateformat' => isset($options['cff_date_formatting']) ? $options['cff_date_formatting'] : '', 'datecustom' => isset($options['cff_date_custom']) ? $options['cff_date_custom'] : '', 'timezone' => isset($options['cff_timezone']) ? $options['cff_timezone'] : 'America/Chicago', 'linksize' => isset($options['cff_link_size']) ? $options['cff_link_size'] : '', 'linkweight' => isset($options['cff_link_weight']) ? $options['cff_link_weight'] : '', 'linkcolor' => isset($options['cff_link_color']) ? $options['cff_link_color'] : '', 'viewlinktext' => isset($options['cff_view_link_text']) ? $options['cff_view_link_text'] : '', 'linktotimeline' => isset($options['cff_link_to_timeline']) ? $options['cff_link_to_timeline'] : '', 'iconstyle' => isset($options['cff_icon_style']) ? $options['cff_icon_style'] : '', 'socialtextcolor' => isset($options['cff_meta_text_color']) ? $options['cff_meta_text_color'] : '', 'socialbgcolor' => isset($options['cff_meta_bg_color']) ? $options['cff_meta_bg_color'] : '', 'sociallinkcolor' => isset($options['cff_meta_link_color']) ? $options['cff_meta_link_color'] : '', 'expandcomments' => isset($options['cff_expand_comments']) ? $options['cff_expand_comments'] : '', 'commentsnum' => isset($options['cff_comments_num']) ? $options['cff_comments_num'] : '', 'hidecommentimages' => isset($options['cff_hide_comment_avatars']) ? $options['cff_hide_comment_avatars'] : '', 'textlength' => get_option('cff_title_length'), 'desclength' => get_option('cff_body_length'), 'likeboxpos' => isset($options['cff_like_box_position']) ? $options['cff_like_box_position'] : '', 'likeboxoutside' => isset($options['cff_like_box_outside']) ? $options['cff_like_box_outside'] : '', 'likeboxcolor' => isset($options['cff_likebox_bg_color']) ? $options['cff_likebox_bg_color'] : '', 'likeboxtextcolor' => isset($options['cff_like_box_text_color']) ? $options['cff_like_box_text_color'] : '', 'likeboxwidth' => isset($options['cff_likebox_width']) ? $options['cff_likebox_width'] : '', 'likeboxheight' => isset($options['cff_likebox_height']) ? $options['cff_likebox_height'] : '', 'likeboxfaces' => isset($options['cff_like_box_faces']) ? $options['cff_like_box_faces'] : '', 'likeboxborder' => isset($options['cff_like_box_border']) ? $options['cff_like_box_border'] : '', 'likeboxcover' => isset($options['cff_like_box_cover']) ? $options['cff_like_box_cover'] : '', 'likeboxsmallheader' => isset($options['cff_like_box_small_header']) ? $options['cff_like_box_small_header'] : '', 'likeboxhidebtn' => isset($options['cff_like_box_hide_cta']) ? $options['cff_like_box_hide_cta'] : '', 'credit' => isset($options['cff_show_credit']) ? $options['cff_show_credit'] : '', 'nofollow' => 'true', 'showheader' => isset($options['cff_show_header']) ? $options['cff_show_header'] : '', 'headeroutside' => isset($options['cff_header_outside']) ? $options['cff_header_outside'] : '', 'headertext' => isset($options['cff_header_text']) ? $options['cff_header_text'] : '', 'headerbg' => isset($options['cff_header_bg_color']) ? $options['cff_header_bg_color'] : '', 'headerpadding' => isset($options['cff_header_padding']) ? $options['cff_header_padding'] : '', 'headertextsize' => isset($options['cff_header_text_size']) ? $options['cff_header_text_size'] : '', 'headertextweight' => isset($options['cff_header_text_weight']) ? $options['cff_header_text_weight'] : '', 'headertextcolor' => isset($options['cff_header_text_color']) ? $options['cff_header_text_color'] : '', 'headericon' => isset($options['cff_header_icon']) ? $options['cff_header_icon'] : '', 'headericoncolor' => isset($options['cff_header_icon_color']) ? $options['cff_header_icon_color'] : '', 'headericonsize' => isset($options['cff_header_icon_size']) ? $options['cff_header_icon_size'] : '', 'videoheight' => isset($options['cff_video_height']) ? $options['cff_video_height'] : '', 'videoaction' => isset($options['cff_video_action']) ? $options['cff_video_action'] : '', 'sepcolor' => isset($options['cff_sep_color']) ? $options['cff_sep_color'] : '', 'sepsize' => isset($options['cff_sep_size']) ? $options['cff_sep_size'] : '', 'seemoretext' => isset($options['cff_see_more_text']) ? stripslashes(esc_attr($options['cff_see_more_text'])) : '', 'seelesstext' => isset($options['cff_see_less_text']) ? stripslashes(esc_attr($options['cff_see_less_text'])) : '', 'photostext' => isset($options['cff_translate_photos_text']) ? stripslashes(esc_attr($options['cff_translate_photos_text'])) : '', 'facebooklinktext' => isset($options['cff_facebook_link_text']) ? stripslashes(esc_attr($options['cff_facebook_link_text'])) : '', 'sharelinktext' => isset($options['cff_facebook_share_text']) ? stripslashes(esc_attr($options['cff_facebook_share_text'])) : '', 'showfacebooklink' => isset($options['cff_show_facebook_link']) ? $options['cff_show_facebook_link'] : '', 'showsharelink' => isset($options['cff_show_facebook_share']) ? $options['cff_show_facebook_share'] : '', 'maptext' => isset($options['cff_map_text']) ? stripslashes(esc_attr($options['cff_map_text'])) : '', 'previouscommentstext' => isset($options['cff_translate_view_previous_comments_text']) ? stripslashes(esc_attr($options['cff_translate_view_previous_comments_text'])) : '', 'commentonfacebooktext' => isset($options['cff_translate_comment_on_facebook_text']) ? stripslashes(esc_attr($options['cff_translate_comment_on_facebook_text'])) : '', 'likesthistext' => isset($options['cff_translate_likes_this_text']) ? stripslashes(esc_attr($options['cff_translate_likes_this_text'])) : '', 'likethistext' => isset($options['cff_translate_like_this_text']) ? stripslashes(esc_attr($options['cff_translate_like_this_text'])) : '', 'andtext' => isset($options['cff_translate_and_text']) ? stripslashes(esc_attr($options['cff_translate_and_text'])) : '', 'othertext' => isset($options['cff_translate_other_text']) ? stripslashes(esc_attr($options['cff_translate_other_text'])) : '', 'otherstext' => isset($options['cff_translate_others_text']) ? stripslashes(esc_attr($options['cff_translate_others_text'])) : '', 'noeventstext' => isset($options['cff_no_events_text']) ? stripslashes(esc_attr($options['cff_no_events_text'])) : '', 'from' => get_option('cff_date_from'), 'until' => get_option('cff_date_until'), 'featuredpost' => get_option('cff_featured_post_id'), 'album' => '', 'lightbox' => get_option('cff_lightbox')), $atts); /********** GENERAL **********/ $cff_page_type = $atts['pagetype']; $cff_is_group = false; if ($cff_page_type == 'group') { $cff_is_group = true; } $cff_feed_width = $atts['width']; if (is_numeric(substr($cff_feed_width, -1, 1))) { $cff_feed_width = $cff_feed_width . 'px'; } $cff_feed_height = $atts['height']; if (is_numeric(substr($cff_feed_height, -1, 1))) { $cff_feed_height = $cff_feed_height . 'px'; } $cff_feed_padding = $atts['padding']; if (is_numeric(substr($cff_feed_padding, -1, 1))) { $cff_feed_padding = $cff_feed_padding . 'px'; } $cff_bg_color = $atts['bgcolor']; $cff_show_author = $atts['showauthornew']; $cff_cache_time = $atts['cachetime']; $cff_locale = $atts['locale']; if (empty($cff_locale) || !isset($cff_locale) || $cff_locale == '') { $cff_locale = 'en_US'; } $cff_cache_time_unit = $atts['cacheunit']; //Don't allow cache time to be zero - set to 1 minute instead to minimize API requests if (!isset($cff_cache_time) || $cff_cache_time == '0') { $cff_cache_time = 1; $cff_cache_time_unit = 'minutes'; } if ($cff_cache_time == 'none') { $cff_cache_time = 0; } $cff_class = $atts['class']; //Compile feed styles $cff_feed_styles = ''; if (!empty($cff_feed_width) || !empty($cff_feed_height) || !empty($cff_feed_padding) || !empty($cff_bg_color) && $cff_bg_color != '#') { $cff_feed_styles .= 'style="'; } if (!empty($cff_feed_width)) { $cff_feed_styles .= 'width:' . $cff_feed_width . '; '; } if (!empty($cff_feed_height)) { $cff_feed_styles .= 'height:' . $cff_feed_height . '; '; } if (!empty($cff_feed_padding)) { $cff_feed_styles .= 'padding:' . $cff_feed_padding . '; '; } if (!empty($cff_bg_color) && $cff_bg_color != '#') { $cff_feed_styles .= 'background-color:#' . str_replace('#', '', $cff_bg_color) . '; '; } if (!empty($cff_feed_width) || !empty($cff_feed_height) || !empty($cff_feed_padding) || !empty($cff_bg_color) && $cff_bg_color != '#') { $cff_feed_styles .= '"'; } //Like box $cff_like_box_position = $atts['likeboxpos']; $cff_like_box_outside = $atts['likeboxoutside']; //Open links in new window? $target = 'target="_blank"'; /********** POST TYPES **********/ $cff_types = $atts['type']; //Look for non-plural version of string in the types string in case user specifies singular in shortcode $cff_show_links_type = false; $cff_show_event_type = false; $cff_show_video_type = false; $cff_show_photos_type = false; $cff_show_status_type = false; $cff_show_albums_type = false; if (stripos($cff_types, 'link') !== false) { $cff_show_links_type = true; } if (stripos($cff_types, 'event') !== false) { $cff_show_event_type = true; } if (stripos($cff_types, 'video') !== false) { $cff_show_video_type = true; } if (stripos($cff_types, 'photo') !== false) { $cff_show_photos_type = true; } if (stripos($cff_types, 'album') !== false) { $cff_show_albums_type = true; } if (stripos($cff_types, 'status') !== false) { $cff_show_status_type = true; } //Only events $cff_events_source = $atts['eventsource']; if (empty($cff_events_source) || !isset($cff_events_source)) { $cff_events_source = 'eventspage'; } $cff_event_offset = $atts['eventoffset']; if (empty($cff_event_offset) || !isset($cff_event_offset)) { $cff_event_offset = '6'; } $cff_events_only = false; if ($cff_show_event_type && !$cff_show_links_type && !$cff_show_video_type && !$cff_show_photos_type && !$cff_show_status_type && !$cff_show_albums_type) { $cff_events_only = true; } //ALBUMS ONLY $cff_albums_source = $atts['albumsource']; $cff_show_album_title = $atts['showalbumtitle']; $cff_show_album_title == 'on' || $cff_show_album_title == 'true' || $cff_show_album_title == true ? $cff_show_album_title = true : ($cff_show_album_title = false); if ($atts['showalbumtitle'] == 'false') { $cff_show_album_title = false; } $cff_show_album_number = $atts['showalbumnum']; $cff_show_album_number == 'on' || $cff_show_album_number == 'true' || $cff_show_album_number == true ? $cff_show_album_number = true : ($cff_show_album_number = false); if ($atts['showalbumnum'] == 'false') { $cff_show_album_number = false; } $cff_album_cols = $atts['albumcols']; $cff_albums_only = false; if ($cff_show_albums_type && !$cff_show_links_type && !$cff_show_video_type && !$cff_show_photos_type && !$cff_show_status_type && !$cff_show_event_type) { $cff_albums_only = true; } //PHOTOS ONLY $cff_photos_source = $atts['photosource']; isset($atts['photocols']) ? $cff_photos_cols = $atts['photocols'] : ($cff_photos_cols = '1'); $cff_photos_only = false; if ($cff_show_photos_type && $cff_photos_source == 'photospage' && !$cff_show_links_type && !$cff_show_video_type && !$cff_show_event_type && !$cff_show_status_type && !$cff_show_albums_type) { $cff_photos_only = true; } if ($cff_featured_post_active && !empty($atts['featuredpost'])) { $cff_photos_only = false; } //VIDEOS ONLY $cff_videos_source = $atts['videosource']; $cff_show_video_name = $atts['showvideoname']; $cff_show_video_name == 'on' || $cff_show_video_name == 'true' || $cff_show_video_name == true ? $cff_show_video_name = true : ($cff_show_video_name = false); if ($atts['showvideoname'] == 'false') { $cff_show_video_name = false; } $cff_show_video_desc = $atts['showvideodesc']; $cff_show_video_desc == 'on' || $cff_show_video_desc == 'true' || $cff_show_video_desc == true ? $cff_show_video_desc = true : ($cff_show_video_desc = false); if ($atts['showvideodesc'] == 'false') { $cff_show_video_desc = false; } $cff_video_cols = $atts['videocols']; $cff_videos_only = false; if ($cff_show_video_type && $cff_videos_source == 'videospage' && !$cff_show_albums_type && !$cff_show_links_type && !$cff_show_photos_type && !$cff_show_status_type && !$cff_show_event_type) { $cff_videos_only = true; } if ($cff_featured_post_active && !empty($atts['featuredpost'])) { $cff_videos_only = false; } /********** LAYOUT **********/ //Include string $cff_includes = $atts['include']; //Look for non-plural version of string in the types string in case user specifies singular in shortcode $cff_show_author = false; $cff_show_text = false; $cff_show_desc = false; $cff_show_shared_links = false; $cff_show_date = false; $cff_show_media = false; $cff_show_event_title = false; $cff_show_event_details = false; $cff_show_meta = false; $cff_show_link = false; $cff_show_like_box = false; if (stripos($cff_includes, 'author') !== false) { $cff_show_author = true; } if (stripos($cff_includes, 'text') !== false) { $cff_show_text = true; } if (stripos($cff_includes, 'desc') !== false) { $cff_show_desc = true; } if (stripos($cff_includes, 'sharedlink') !== false) { $cff_show_shared_links = true; } if (stripos($cff_includes, 'date') !== false) { $cff_show_date = true; } if (stripos($cff_includes, 'media') !== false) { $cff_show_media = true; } if (stripos($cff_includes, 'eventtitle') !== false) { $cff_show_event_title = true; } if (stripos($cff_includes, 'eventdetail') !== false) { $cff_show_event_details = true; } if (stripos($cff_includes, 'social') !== false) { $cff_show_meta = true; } if (stripos($cff_includes, ',link') !== false) { $cff_show_link = true; } //comma used to separate it from 'sharedlinks' - which also contains 'link' string if (stripos($cff_includes, 'like') !== false) { $cff_show_like_box = true; } //Exclude string $cff_excludes = $atts['exclude']; //Look for non-plural version of string in the types string in case user specifies singular in shortcode if (stripos($cff_excludes, 'author') !== false) { $cff_show_author = false; } if (stripos($cff_excludes, 'text') !== false) { $cff_show_text = false; } if (stripos($cff_excludes, 'desc') !== false) { $cff_show_desc = false; } if (stripos($cff_excludes, 'sharedlink') !== false) { $cff_show_shared_links = false; } if (stripos($cff_excludes, 'date') !== false) { $cff_show_date = false; } if (stripos($cff_excludes, 'media') !== false) { $cff_show_media = false; } if (stripos($cff_excludes, 'eventtitle') !== false) { $cff_show_event_title = false; } if (stripos($cff_excludes, 'eventdetail') !== false) { $cff_show_event_details = false; } if (stripos($cff_excludes, 'social') !== false) { $cff_show_meta = false; } if (stripos($cff_excludes, ',link') !== false) { $cff_show_link = false; } //comma used to separate it from 'sharedlinks' - which also contains 'link' string if (stripos($cff_excludes, 'like') !== false) { $cff_show_like_box = false; } $cff_preset_layout = $atts['layout']; //Default is thumbnail layout $cff_thumb_layout = false; $cff_half_layout = false; $cff_full_layout = true; if (($cff_preset_layout == 'thumb' || empty($cff_preset_layout)) && $cff_show_media) { $cff_thumb_layout = true; } else { if ($cff_preset_layout == 'half' && $cff_show_media) { $cff_half_layout = true; } else { $cff_full_layout = true; } } //Get the media position $cff_media_position = $atts['mediaposition']; if ($cff_thumb_layout || $cff_half_layout) { $cff_media_position = 'below'; } //If the old shortcode option 'showauthor' is being used then apply it $cff_show_author_old = $atts['showauthor']; if ($cff_show_author_old == 'false') { $cff_show_author = false; } if ($cff_show_author_old == 'true') { $cff_show_author = true; } //LIGHTBOX $cff_disable_lightbox = $atts['disablelightbox']; $cff_disable_lightbox == 'on' || $cff_disable_lightbox == 'true' || $cff_disable_lightbox == true ? $cff_disable_lightbox = true : ($cff_disable_lightbox = false); if ($atts['disablelightbox'] == 'false') { $cff_disable_lightbox = false; } /********** META **********/ $cff_icon_style = 'cff-' . $atts['iconstyle']; $cff_meta_text_color = $atts['socialtextcolor']; $cff_meta_bg_color = $atts['socialbgcolor']; $cff_expand_comments = $atts['expandcomments']; if ($cff_expand_comments == 'false') { $cff_expand_comments = false; } !isset($atts['commentsnum']) ? $cff_comments_num = '4' : ($cff_comments_num = $atts['commentsnum']); $cff_hide_comment_avatars = $atts['hidecommentimages']; if ($cff_hide_comment_avatars == 'false') { $cff_hide_comment_avatars = false; } $cff_meta_styles = ''; if (!empty($cff_meta_text_color) || !empty($cff_meta_bg_color) && $cff_meta_bg_color !== '#') { $cff_meta_styles = 'style="'; } if (!empty($cff_meta_text_color)) { $cff_meta_styles .= 'color:#' . str_replace('#', '', $cff_meta_text_color) . ';'; } if (!empty($cff_meta_bg_color) && $cff_meta_bg_color !== '#') { $cff_meta_styles .= 'background-color:#' . str_replace('#', '', $cff_meta_bg_color) . ';'; } if (!empty($cff_meta_text_color) || !empty($cff_meta_bg_color) && $cff_meta_bg_color !== '#') { $cff_meta_styles .= '"'; } $cff_meta_link_color = 'style="color:#' . str_replace('#', '', $atts['sociallinkcolor']) . ';"'; // $cff_nocomments_text = $options[ 'cff_nocomments_text' ]; // $cff_hide_comments = $options[ 'cff_hide_comments' ]; // if (!isset($cff_nocomments_text) || empty($cff_nocomments_text)) $cff_hide_comments = true; /********** TYPOGRAPHY **********/ //See More text $cff_see_more_text = $atts['seemoretext']; $cff_see_less_text = $atts['seelesstext']; //See Less text //Title $cff_title_format = $atts['textformat']; if (empty($cff_title_format)) { $cff_title_format = 'p'; } $cff_title_size = $atts['textsize']; $cff_title_weight = $atts['textweight']; $cff_title_color = $atts['textcolor']; $cff_title_styles = ''; if (!empty($cff_title_size) && $cff_title_size != 'inherit' || !empty($cff_title_weight) && $cff_title_weight != 'inherit' || !empty($cff_title_color) && $cff_title_color !== '#') { $cff_title_styles = 'style="'; } if (!empty($cff_title_size) && $cff_title_size != 'inherit') { $cff_title_styles .= 'font-size:' . $cff_title_size . 'px; '; } if (!empty($cff_title_weight) && $cff_title_weight != 'inherit') { $cff_title_styles .= 'font-weight:' . $cff_title_weight . '; '; } if (!empty($cff_title_color) && $cff_title_color !== '#') { $cff_title_styles .= 'color:#' . str_replace('#', '', $cff_title_color) . ';'; } if (!empty($cff_title_size) && $cff_title_size != 'inherit' || !empty($cff_title_weight) && $cff_title_weight != 'inherit' || !empty($cff_title_color) && $cff_title_color !== '#') { $cff_title_styles .= '"'; } $cff_title_link = $atts['textlink']; //Text link color $cff_posttext_link_color = str_replace('#', '', $atts['textlinkcolor']); $cff_title_link == 'on' || $cff_title_link == 'true' || $cff_title_link == true ? $cff_title_link = true : ($cff_title_link = false); if ($atts['textlink'] == 'false') { $cff_title_link = false; } //Author $cff_author_size = $atts['authorsize']; $cff_author_color = $atts['authorcolor']; $cff_author_styles = ''; if (!empty($cff_author_size) && $cff_author_size != 'inherit' || !empty($cff_author_color) && $cff_author_color !== '#') { $cff_author_styles = 'style="'; } if (!empty($cff_author_size) && $cff_author_size != 'inherit') { $cff_author_styles .= 'font-size:' . $cff_author_size . 'px; '; } if (!empty($cff_author_color) && $cff_author_color !== '#') { $cff_author_styles .= 'color:#' . str_replace('#', '', $cff_author_color) . ';'; } if (!empty($cff_author_size) && $cff_author_size != 'inherit' || !empty($cff_author_color) && $cff_author_color !== '#') { $cff_author_styles .= '"'; } //Description $cff_body_size = $atts['descsize']; $cff_body_weight = $atts['descweight']; $cff_body_color = $atts['desccolor']; $cff_body_styles = ''; if (!empty($cff_body_size) && $cff_body_size != 'inherit' || !empty($cff_body_weight) && $cff_body_weight != 'inherit' || !empty($cff_body_color) && $cff_body_color !== '#') { $cff_body_styles = 'style="'; } if (!empty($cff_body_size) && $cff_body_size != 'inherit') { $cff_body_styles .= 'font-size:' . $cff_body_size . 'px; '; } if (!empty($cff_body_weight) && $cff_body_weight != 'inherit') { $cff_body_styles .= 'font-weight:' . $cff_body_weight . '; '; } if (!empty($cff_body_color) && $cff_body_color !== '#') { $cff_body_styles .= 'color:#' . str_replace('#', '', $cff_body_color) . ';'; } if (!empty($cff_body_size) && $cff_body_size != 'inherit' || !empty($cff_body_weight) && $cff_body_weight != 'inherit' || !empty($cff_body_color) && $cff_body_color !== '#') { $cff_body_styles .= '"'; } //Shared link title $cff_link_title_format = $atts['linktitleformat']; if (empty($cff_link_title_format)) { $cff_link_title_format = 'p'; } $cff_link_title_size = $atts['linktitlesize']; $cff_link_title_color = str_replace('#', '', $atts['linktitlecolor']); $cff_link_url_color = $atts['linkurlcolor']; $cff_link_title_styles = ''; if (!empty($cff_link_title_size) && $cff_link_title_size != 'inherit') { $cff_link_title_styles = 'style="font-size:' . $cff_link_title_size . 'px;"'; } //Shared link box $cff_link_bg_color = $atts['linkbgcolor']; $cff_link_border_color = $atts['linkbordercolor']; $cff_disable_link_box = $atts['disablelinkbox']; $cff_disable_link_box == 'true' || $cff_disable_link_box == 'on' ? $cff_disable_link_box = true : ($cff_disable_link_box = false); $cff_full_link_images = $atts['fulllinkimages']; $cff_full_link_images == 'true' || $cff_full_link_images == 'on' ? $cff_full_link_images = true : ($cff_full_link_images = false); $cff_link_box_styles = ''; if (!empty($cff_link_border_color) || !empty($cff_link_bg_color) && $cff_link_bg_color !== '#') { $cff_link_box_styles = 'style="'; } if (!empty($cff_link_border_color)) { $cff_link_box_styles .= 'border: 1px solid #' . str_replace('#', '', $cff_link_border_color) . '; '; } if (!empty($cff_link_bg_color) && $cff_link_bg_color !== '#') { $cff_link_box_styles .= 'background-color: #' . str_replace('#', '', $cff_link_bg_color) . ';'; } if (!empty($cff_link_border_color) || !empty($cff_link_bg_color) && $cff_link_bg_color !== '#') { $cff_link_box_styles .= '"'; } //Event Title $cff_event_title_format = $atts['eventtitleformat']; if (empty($cff_event_title_format)) { $cff_event_title_format = 'p'; } $cff_event_title_size = $atts['eventtitlesize']; $cff_event_title_weight = $atts['eventtitleweight']; $cff_event_title_color = $atts['eventtitlecolor']; $cff_event_title_styles = ''; if (!empty($cff_event_title_size) && $cff_event_title_size != 'inherit' || !empty($cff_event_title_weight) && $cff_event_title_weight != 'inherit' || !empty($cff_event_title_color) && $cff_event_title_color !== '#') { $cff_event_title_styles = 'style="'; } if (!empty($cff_event_title_size) && $cff_event_title_size != 'inherit') { $cff_event_title_styles .= 'font-size:' . $cff_event_title_size . 'px; '; } if (!empty($cff_event_title_weight) && $cff_event_title_weight != 'inherit') { $cff_event_title_styles .= 'font-weight:' . $cff_event_title_weight . '; '; } if (!empty($cff_event_title_color) && $cff_event_title_color !== '#') { $cff_event_title_styles .= 'color:#' . str_replace('#', '', $cff_event_title_color) . ';'; } if (!empty($cff_event_title_size) && $cff_event_title_size != 'inherit' || !empty($cff_event_title_weight) && $cff_event_title_weight != 'inherit' || !empty($cff_event_title_color) && $cff_event_title_color !== '#') { $cff_event_title_styles .= '"'; } $cff_event_title_link = $atts['eventtitlelink']; $cff_event_title_link == 'on' || $cff_event_title_link == 'true' || $cff_event_title_link == true ? $cff_event_title_link = true : ($cff_event_title_link = false); if ($atts['eventtitlelink'] == 'false') { $cff_event_title_link = false; } //Event Date $cff_event_date_size = $atts['eventdatesize']; $cff_event_date_weight = $atts['eventdateweight']; $cff_event_date_color = $atts['eventdatecolor']; $cff_event_date_position = $atts['eventdatepos']; $cff_event_date_formatting = $atts['eventdateformat']; $cff_event_date_custom = $atts['eventdatecustom']; $cff_event_date_styles = ''; if (!empty($cff_event_date_size) && $cff_event_date_size != 'inherit' || !empty($cff_event_date_weight) && $cff_event_date_weight != 'inherit' || !empty($cff_event_date_color) && $cff_event_date_color !== '#') { $cff_event_date_styles = 'style="'; } if (!empty($cff_event_date_size) && $cff_event_date_size != 'inherit') { $cff_event_date_styles .= 'font-size:' . $cff_event_date_size . 'px; '; } if (!empty($cff_event_date_weight) && $cff_event_date_weight != 'inherit') { $cff_event_date_styles .= 'font-weight:' . $cff_event_date_weight . '; '; } if (!empty($cff_event_date_color) && $cff_event_date_color !== '#') { $cff_event_date_styles .= 'color:#' . str_replace('#', '', $cff_event_date_color) . ';'; } if (!empty($cff_event_date_size) && $cff_event_date_size != 'inherit' || !empty($cff_event_date_weight) && $cff_event_date_weight != 'inherit' || !empty($cff_event_date_color) && $cff_event_date_color !== '#') { $cff_event_date_styles .= '"'; } //Event Details $cff_event_details_size = $atts['eventdetailssize']; $cff_event_details_weight = $atts['eventdetailsweight']; $cff_event_details_color = $atts['eventdetailscolor']; $cff_event_link_color = str_replace('#', '', $atts['eventlinkcolor']); $cff_event_details_styles = ''; if (!empty($cff_event_details_size) && $cff_event_details_size != 'inherit' || !empty($cff_event_details_weight) && $cff_event_details_weight != 'inherit' || !empty($cff_event_details_color) && $cff_event_details_color !== '#') { $cff_event_details_styles = 'style="'; } if (!empty($cff_event_details_size) && $cff_event_details_size != 'inherit') { $cff_event_details_styles .= 'font-size:' . $cff_event_details_size . 'px; '; } if (!empty($cff_event_details_weight) && $cff_event_details_weight != 'inherit') { $cff_event_details_styles .= 'font-weight:' . $cff_event_details_weight . '; '; } if (!empty($cff_event_details_color) && $cff_event_details_color !== '#') { $cff_event_details_styles .= 'color:#' . str_replace('#', '', $cff_event_details_color) . ';'; } if (!empty($cff_event_details_size) && $cff_event_details_size != 'inherit' || !empty($cff_event_details_weight) && $cff_event_details_weight != 'inherit' || !empty($cff_event_details_color) && $cff_event_details_color !== '#') { $cff_event_details_styles .= '"'; } //No Upcoming Events text $cff_no_events_text = $atts['noeventstext']; if (!isset($cff_no_events_text) || empty($cff_no_events_text)) { $cff_no_events_text = 'No upcoming events'; } //Date $cff_date_position = $atts['datepos']; if (!isset($cff_date_position)) { $cff_date_position = 'below'; } $cff_date_size = $atts['datesize']; $cff_date_weight = $atts['dateweight']; $cff_date_color = $atts['datecolor']; $cff_date_styles = ''; if (!empty($cff_date_size) && $cff_date_size != 'inherit' || !empty($cff_date_weight) && $cff_date_weight != 'inherit' || !empty($cff_date_color) && $cff_date_color !== '#') { $cff_date_styles = 'style="'; } if (!empty($cff_date_size) && $cff_date_size != 'inherit') { $cff_date_styles .= 'font-size:' . $cff_date_size . 'px; '; } if (!empty($cff_date_weight) && $cff_date_weight != 'inherit') { $cff_date_styles .= 'font-weight:' . $cff_date_weight . '; '; } if (!empty($cff_date_color) && $cff_date_color !== '#') { $cff_date_styles .= 'color:#' . str_replace('#', '', $cff_date_color) . ';'; } if (!empty($cff_date_size) && $cff_date_size != 'inherit' || !empty($cff_date_weight) && $cff_date_weight != 'inherit' || !empty($cff_date_color) && $cff_date_color !== '#') { $cff_date_styles .= '"'; } $cff_date_before = isset($options['cff_date_before']) ? stripslashes(esc_attr($options['cff_date_before'])) : ''; $cff_date_after = isset($options['cff_date_after']) ? stripslashes(esc_attr($options['cff_date_after'])) : ''; //Set user's timezone based on setting $cff_timezone = $atts['timezone']; $cff_orig_timezone = date_default_timezone_get(); date_default_timezone_set($cff_timezone); //Link to Facebook $cff_link_size = $atts['linksize']; $cff_link_weight = $atts['linkweight']; $cff_link_color = $atts['linkcolor']; $cff_link_styles = ''; if (!empty($cff_link_size) && $cff_link_size != 'inherit' || !empty($cff_link_weight) && $cff_link_weight != 'inherit' || !empty($cff_link_color) && $cff_link_color !== '#') { $cff_link_styles = 'style="'; } if (!empty($cff_link_size) && $cff_link_size != 'inherit') { $cff_link_styles .= 'font-size:' . $cff_link_size . 'px; '; } if (!empty($cff_link_weight) && $cff_link_weight != 'inherit') { $cff_link_styles .= 'font-weight:' . $cff_link_weight . '; '; } if (!empty($cff_link_color) && $cff_link_color !== '#') { $cff_link_styles .= 'color:#' . str_replace('#', '', $cff_link_color) . ';'; } if (!empty($cff_link_size) && $cff_link_size != 'inherit' || !empty($cff_link_weight) && $cff_link_weight != 'inherit' || !empty($cff_link_color) && $cff_link_color !== '#') { $cff_link_styles .= '"'; } $cff_facebook_link_text = $atts['facebooklinktext']; $cff_facebook_share_text = $atts['sharelinktext']; if ($cff_facebook_share_text == '') { $cff_facebook_share_text = 'Share'; } //Show Facebook link $cff_show_facebook_link = $atts['showfacebooklink']; $cff_show_facebook_link == 'on' || $cff_show_facebook_link == 'true' || $cff_show_facebook_link == true ? $cff_show_facebook_link = true : ($cff_show_facebook_link = false); if ($atts['showfacebooklink'] === 'false') { $cff_show_facebook_link = false; } //Show Share link $cff_show_facebook_share = $atts['showsharelink']; $cff_show_facebook_share == 'on' || $cff_show_facebook_share == 'true' || $cff_show_facebook_share == true ? $cff_show_facebook_share = true : ($cff_show_facebook_share = false); if ($atts['showsharelink'] === 'false') { $cff_show_facebook_share = false; } $cff_view_link_text = $atts['viewlinktext']; $cff_link_to_timeline = $atts['linktotimeline']; /********** MISC **********/ //Like Box styles $cff_likebox_bg_color = $atts['likeboxcolor']; $cff_like_box_text_color = $atts['likeboxtextcolor']; $cff_like_box_colorscheme = 'light'; if ($cff_like_box_text_color == 'white') { $cff_like_box_colorscheme = 'dark'; } $cff_likebox_width = $atts['likeboxwidth']; if (is_numeric(substr($cff_likebox_width, -1, 1))) { $cff_likebox_width = $cff_likebox_width . 'px'; } $cff_likebox_height = $atts['likeboxheight']; $cff_likebox_height = preg_replace('/px$/', '', $cff_likebox_height); if (!isset($cff_likebox_width) || empty($cff_likebox_width) || $cff_likebox_width == '') { $cff_likebox_width = '100%'; } $cff_like_box_faces = $atts['likeboxfaces']; if (!isset($cff_like_box_faces) || empty($cff_like_box_faces)) { $cff_like_box_faces = 'false'; } $cff_like_box_border = $atts['likeboxborder']; if ($cff_like_box_border) { $cff_like_box_border = 'true'; } else { $cff_like_box_border = 'false'; } $cff_like_box_cover = $atts['likeboxcover']; if ($cff_like_box_cover) { $cff_like_box_cover = 'false'; } else { $cff_like_box_cover = 'true'; } $cff_like_box_small_header = $atts['likeboxsmallheader']; if ($cff_like_box_small_header) { $cff_like_box_small_header = 'true'; } else { $cff_like_box_small_header = 'false'; } $cff_like_box_hide_cta = $atts['likeboxhidebtn']; if ($cff_like_box_hide_cta) { $cff_like_box_hide_cta = 'true'; } else { $cff_like_box_hide_cta = 'false'; } //Compile Like box styles $cff_likebox_styles = 'style="width: ' . $cff_likebox_width . ';'; if (!empty($cff_likebox_bg_color)) { $cff_likebox_styles .= ' background-color:#' . str_replace('#', '', $cff_likebox_bg_color) . ';'; } //Set the left margin on the like box based on how it's being displayed if (!empty($cff_likebox_bg_color) && $cff_likebox_bg_color != '#' || ($cff_like_box_faces == 'true' || $cff_like_box_faces == 'on')) { $cff_likebox_styles .= ' margin-left: 0px;'; } $cff_likebox_styles .= '"'; //Get feed header settings $cff_header_bg_color = $atts['headerbg']; $cff_header_padding = $atts['headerpadding']; if (is_numeric(substr($cff_header_padding, -1, 1))) { $cff_header_padding = $cff_header_padding . 'px'; } $cff_header_text_size = $atts['headertextsize']; $cff_header_text_weight = $atts['headertextweight']; $cff_header_text_color = $atts['headertextcolor']; //Compile feed header styles $cff_header_styles = ''; if (!empty($cff_header_bg_color) && $cff_header_bg_color !== '#' || !empty($cff_header_padding) || !empty($cff_header_text_size) && $cff_header_text_size != 'inherit' || !empty($cff_header_text_weight) && $cff_header_text_weight != 'inherit' || !empty($cff_header_text_color) && $cff_header_text_color !== '#') { $cff_header_styles = 'style="'; } if (!empty($cff_header_bg_color) && $cff_header_bg_color !== '#') { $cff_header_styles .= 'background-color: #' . str_replace('#', '', $cff_header_bg_color) . '; '; } if (!empty($cff_header_padding)) { $cff_header_styles .= 'padding: ' . $cff_header_padding . '; '; } if (!empty($cff_header_text_size) && $cff_header_text_size != 'inherit') { $cff_header_styles .= 'font-size: ' . $cff_header_text_size . 'px; '; } if (!empty($cff_header_text_weight) && $cff_header_text_weight != 'inherit') { $cff_header_styles .= 'font-weight: ' . $cff_header_text_weight . '; '; } if (!empty($cff_header_text_color) && $cff_header_text_color !== '#') { $cff_header_styles .= 'color: #' . str_replace('#', '', $cff_header_text_color) . '; '; } if (!empty($cff_header_bg_color) && $cff_header_bg_color !== '#' || !empty($cff_header_padding) || !empty($cff_header_text_size) && $cff_header_text_size != 'inherit' || !empty($cff_header_text_weight) && $cff_header_text_weight != 'inherit' || !empty($cff_header_text_color) && $cff_header_text_color !== '#') { $cff_header_styles .= '"'; } //Photos translate text $cff_translate_photos_text = $atts['photostext']; if (!isset($cff_translate_photos_text) || empty($cff_translate_photos_text)) { $cff_translate_photos_text = 'photos'; } //Video //Dimensions $cff_video_height = $atts['videoheight']; //Action $cff_video_action = $atts['videoaction']; //Separating Line $cff_sep_color = $atts['sepcolor']; if (empty($cff_sep_color)) { $cff_sep_color = 'ddd'; } $cff_sep_size = $atts['sepsize']; //If empty then set a 0px border if (empty($cff_sep_size) || $cff_sep_size == '') { $cff_sep_size = 0; //Need to set a color otherwise the CSS is invalid $cff_sep_color = 'fff'; } $cff_post_bg_color = str_replace('#', '', $atts['postbgcolor']); $cff_post_rounded = $atts['postcorners']; $cff_post_bg_color !== '#' && $cff_post_bg_color !== '' ? $cff_post_bg_color_check = true : ($cff_post_bg_color_check = false); $cff_sep_color !== '#' && $cff_sep_color !== '' ? $cff_sep_color_check = true : ($cff_sep_color_check = false); //CFF item styles $cff_item_styles = ''; if ($cff_sep_color_check || $cff_post_bg_color_check) { $cff_item_styles = 'style="'; if ($cff_sep_color_check && !$cff_post_bg_color_check) { $cff_item_styles .= 'border-bottom: ' . $cff_sep_size . 'px solid #' . str_replace('#', '', $cff_sep_color) . '; '; } if ($cff_post_bg_color_check) { $cff_item_styles .= 'background-color: #' . $cff_post_bg_color . '; '; } if (isset($cff_post_rounded) && $cff_post_rounded !== '0') { $cff_item_styles .= '-webkit-border-radius: ' . $cff_post_rounded . 'px; -moz-border-radius: ' . $cff_post_rounded . 'px; border-radius: ' . $cff_post_rounded . 'px; '; } $cff_item_styles .= '"'; } //Text limits $title_limit = $atts['textlength']; if (!isset($title_limit)) { $title_limit = 9999; } $body_limit = $atts['desclength']; //Assign the Access Token and Page ID variables $access_token = trim($atts['accesstoken']); $page_id = trim($atts['id']); //If user pastes their full URL into the Page ID field then strip it out $cff_facebook_string = 'facebook.com'; stripos($page_id, $cff_facebook_string) !== false ? $cff_page_id_url_check = true : ($cff_page_id_url_check = false); if ($cff_page_id_url_check === true) { //Remove trailing slash if exists $page_id = preg_replace('{/$}', '', $page_id); //Get last part of url $page_id = substr($page_id, strrpos($page_id, '/') + 1); } //If the Page ID contains a query string at the end then remove it if (stripos($page_id, '?') !== false) { $page_id = substr($page_id, 0, strrpos($page_id, '?')); } //Get show posts attribute. If not set then default to 25 $show_posts = $atts['num']; if (empty($show_posts)) { $show_posts = 25; } if ($show_posts == 0 || $show_posts == 'undefined') { $show_posts = 25; } //If the 'Enter my own Access Token' box is unchecked then don't use the user's access token, even if there's one in the field get_option('cff_show_access_token') ? $cff_show_access_token = true : ($cff_show_access_token = false); //Regular tokens $access_token_array = array('416662301842014|Iy7oi0_vW3k6zQBj4x7jKfaBw8w', '351136301748729|qMn9Wtl3Kq5Fphtcxv3F_XiTF2U', '896835057039463|T79vzdXFpPLHYAayPhMU-1_i1JI', '388805814640108|gcuuC0CxitPh8n-jdSZzMUjDEDA', '840211402734532|cg7gK3DbncTd4asqkWRZlWpME8g'); //FQL tokens $access_token_array_fql = array('300694180076642|-cozSG1L4topnAqQOwaIEpy4Ufk', '439271626171835|-V79s0TIUVsjj_5lgc6ydVvaFZ8', '188877464498533|gObD45qMCG-uE9WGVt3-djx-6Sw', '636437039752698|Tt-zXlDy-Nu4CCkNteGfcUe65ow', '1448491852049169|eUTjw_pIVoPzC1R1pxVQhmtFqQ0'); //If Access Token is blank or 'Use own Access Token' setting is unchecked then default to a regular token if ($access_token == '' || !$cff_show_access_token) { $access_token = $access_token_array[rand(0, 4)]; } //If displaying events only, photos only or featured post then use an FQL token if ($cff_events_only && !$cff_is_group || $cff_photos_only || $cff_featured_post_active && !empty($atts['featuredpost'])) { $access_token = $access_token_array_fql[rand(0, 4)]; } //Check whether a Page ID has been defined if ($page_id == '') { 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=YOUR_PAGE_ID_HERE].<br /><br />"; return false; } //Is it SSL? $cff_ssl = ''; if (is_ssl()) { $cff_ssl = '&return_ssl_resources=true'; } //Use posts? or feed? $show_others = $atts['others']; $show_posts_by = $atts['showpostsby']; $graph_query = 'posts'; $cff_show_only_others = false; //If 'others' shortcode option is used then it overrides any other option if ($show_others) { //Show posts by everyone if ($show_others == 'on' || $show_others == 'true' || $show_others == true || $cff_is_group) { $graph_query = 'feed'; } //Only show posts by me if ($show_others == 'false') { $graph_query = 'posts'; } } else { //Else use the settings page option or the 'showpostsby' shortcode option //Only show posts by me if ($show_posts_by == 'me') { $graph_query = 'posts'; } //Show posts by everyone if ($show_posts_by == 'others' || $cff_is_group) { $graph_query = 'feed'; } //Show posts ONLY by others if ($show_posts_by == 'onlyothers' && !$cff_is_group) { $graph_query = 'feed'; $cff_show_only_others = true; } } //If the limit isn't set then set it to be 5 more than the number of posts defined if (isset($atts['limit']) && $atts['limit'] !== '') { $cff_post_limit = $atts['limit']; } else { $cff_post_limit = intval(intval($show_posts) + 7); } //Calculate the cache time in seconds if ($cff_cache_time_unit == 'minutes') { $cff_cache_time_unit = 60; } if ($cff_cache_time_unit == 'hours') { $cff_cache_time_unit = 60 * 60; } if ($cff_cache_time_unit == 'days') { $cff_cache_time_unit = 60 * 60 * 24; } $cache_seconds = $cff_cache_time * $cff_cache_time_unit; //Set like box variable //If there are more than one page id then use the first one isset($options['cff_app_id']) ? $cff_app_id = $options['cff_app_id'] : ($cff_app_id = ''); isset($cff_app_id) && !empty($cff_app_id) ? $cff_like_box_params = '&appId=' . $cff_app_id : ($cff_like_box_params = ''); $like_box_page_id = explode(",", str_replace(' ', '', $page_id)); $like_box = '<div class="cff-likebox'; if ($cff_like_box_outside) { $like_box .= ' cff-outside'; } $like_box .= $cff_like_box_position == 'top' ? ' cff-top' : ' cff-bottom'; // $like_box .= '" ' . $cff_likebox_styles . '><script src="https://connect.facebook.net/' . $cff_locale . '/all.js#xfbml=1'.$cff_like_box_params.'"></script><fb:like-box href="http://www.facebook.com/' . $like_box_page_id[0] . '" show_faces="'.$cff_like_box_faces.'" stream="false" header="false" colorscheme="'. $cff_like_box_colorscheme .'" show_border="'. $cff_like_box_border .'" data-height="'.$cff_likebox_height.'"></fb:like-box><div id="fb-root"></div></div>'; $like_box .= '" ><script src="https://connect.facebook.net/' . $cff_locale . '/all.js#xfbml=1' . $cff_like_box_params . '"></script><div class="fb-page" data-href="https://www.facebook.com/' . $like_box_page_id[0] . '" data-width="' . $cff_likebox_width . '" data-hide-cover="' . $cff_like_box_cover . '" data-show-facepile="' . $cff_like_box_faces . '" data-small-header="' . $cff_like_box_small_header . '" data-hide-cta="' . $cff_like_box_hide_cta . '" data-show-posts="false" data-adapt-container-width="true"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/' . $like_box_page_id[0] . '"><a href="https://www.facebook.com/' . $like_box_page_id[0] . '">' . $cff_facebook_link_text . '</a></blockquote></div></div><div id="fb-root"></div></div>'; //Don't show like box if it's a group if ($cff_is_group) { $like_box = ''; } //Feed header $cff_show_header = $atts['showheader']; $cff_show_header == 'true' || $cff_show_header == 'on' ? $cff_show_header = true : ($cff_show_header = false); $cff_header_outside = $atts['headeroutside']; $cff_header_outside == 'true' || $cff_header_outside == 'on' ? $cff_header_outside = true : ($cff_header_outside = false); $cff_header_text = $atts['headertext']; $cff_header_icon = $atts['headericon']; $cff_header_icon_color = $atts['headericoncolor']; $cff_header_icon_size = $atts['headericonsize']; $cff_header = '<h3 class="cff-header'; if ($cff_header_outside) { $cff_header .= ' cff-outside'; } $cff_header .= '" ' . $cff_header_styles . '>'; $cff_header .= '<i class="fa fa-' . $cff_header_icon . '"'; if (!empty($cff_header_icon_color) || !empty($cff_header_icon_size)) { $cff_header .= ' style="'; } if (!empty($cff_header_icon_color)) { $cff_header .= 'color: #' . str_replace('#', '', $cff_header_icon_color) . ';'; } if (!empty($cff_header_icon_size)) { $cff_header .= ' font-size: ' . $cff_header_icon_size . 'px;'; } if (!empty($cff_header_icon_color) || !empty($cff_header_icon_size)) { $cff_header .= '"'; } $cff_header .= '></i>'; $cff_header .= '<span class="cff-header-text" style="height: ' . $cff_header_icon_size . 'px;">' . $cff_header_text . '</span>'; $cff_header .= '</h3>'; //Misc Settings $cff_nofollow = $atts['nofollow']; $cff_nofollow == 'on' || $cff_nofollow == 'true' || $cff_nofollow == true ? $cff_nofollow = true : ($cff_nofollow = false); if ($atts['nofollow'] == 'false') { $cff_nofollow = false; } $cff_nofollow ? $cff_nofollow = ' rel="nofollow"' : ($cff_nofollow = ''); //Narrow styles $cff_enable_narrow = $atts['enablenarrow']; $cff_enable_narrow == 'true' || $cff_enable_narrow == 'on' ? $cff_enable_narrow = true : ($cff_enable_narrow = false); //If the number of posts is set to zero then don't show any and set limit to one if (($atts['num'] == '0' || $atts['num'] == 0) && $atts['num'] !== '') { $show_posts = 0; $cff_post_limit = 1; } //***START FEED*** $cff_content = ''; //Add the page header to the outside of the top of feed if ($cff_show_header && $cff_header_outside) { $cff_content .= $cff_header; } //Add like box to the outside of the top of feed if ($cff_like_box_position == 'top' && $cff_show_like_box && $cff_like_box_outside) { $cff_content .= $like_box; } //Create CFF container HTML $cff_content .= '<div class="cff-wrapper">'; $cff_content .= '<div id="cff" '; if (!empty($title_limit)) { $cff_content .= 'data-char="' . $title_limit . '" '; } $cff_content .= 'class="'; if (!empty($cff_class)) { $cff_content .= $cff_class . ' '; } if (!empty($cff_feed_height)) { $cff_content .= 'cff-fixed-height '; } if ($cff_thumb_layout) { $cff_content .= 'cff-thumb-layout '; } if ($cff_half_layout) { $cff_content .= 'cff-half-layout '; } if (!$cff_enable_narrow) { $cff_content .= 'cff-disable-narrow'; } //Lightbox extension if ($cff_disable_lightbox && ($atts['lightbox'] == 'true' || $atts['lightbox'] == 'on')) { $cff_content .= ' cff-lightbox'; } if (!$cff_disable_lightbox) { $cff_content .= ' cff-lb'; } $cff_content .= '" ' . $cff_feed_styles; $cff_content .= ' data-fb-text="' . $cff_facebook_link_text . '"'; $cff_content .= '>'; //Add the page header to the inside of the top of feed if ($cff_show_header && !$cff_header_outside) { $cff_content .= $cff_header; } //Add like box to the inside of the top of feed if ($cff_like_box_position == 'top' && $cff_show_like_box && !$cff_like_box_outside) { $cff_content .= $like_box; } //Limit var $i = 0; //Multifeed extension $cff_ext_multifeed_active ? $page_ids = cff_multifeed_ids($page_id) : ($page_ids = array($page_id)); //Define array for post items $cff_posts_array = array(); //LOOP THROUGH PAGE IDs foreach ($page_ids as $page_id) { //EVENTS ONLY if ($cff_events_only && $cff_events_source == 'eventspage') { //Get the user's ID $get_page_info = cff_fetchUrl('https://graph.facebook.com/' . $page_id . '?fields=name,id&access_token=' . $access_token); $page_info = json_decode($get_page_info); //Get user ID $u_id = $page_info->id; //Add 6 hours to the current time. This means events will still be shown for 6 hours after their start time has passed. $cff_event_offset_time = '-' . $cff_event_offset . ' hours'; $curtimeplus = strtotime($cff_event_offset_time, time()); //Start time string $cff_start_time_string = "start_time>=" . $curtimeplus; //Date range extension if ($cff_ext_date_active && (!empty($atts['from']) || !empty($atts['until']))) { !empty($atts['from']) ? $cff_date_from = strtotime($atts['from']) : ($cff_date_from = $curtimeplus); !empty($atts['until']) ? $cff_date_until = strtotime($atts['until']) : ($cff_date_until = $curtimeplus); $cff_start_time_string = cff_ext_date_events($cff_date_from, $cff_date_until); } //Set the query URL $fql = "SELECT%20eid,name,attending_count,pic_big,pic_cover,start_time,end_time,timezone,venue,location,description,ticket_uri%20FROM%20event%20WHERE%20eid%20IN%20(SELECT%20eid%20FROM%20event_member%20WHERE%20uid='" . $u_id . "')%20AND%20" . $cff_start_time_string . "%20ORDER%20BY%20start_time%20&access_token=" . $access_token . '&format=json-strings' . $cff_ssl; //Featured Post extension if ($cff_featured_post_active && !empty($atts['featuredpost'])) { $fql = cff_featured_event_id(trim($atts['featuredpost']), $access_token); } // Get any existing copy of our transient data $cff_events_json_url = "https://graph.facebook.com/fql?q=" . $fql; //Past events $atts['pastevents'] !== 'false' ? $cff_past_events = true : ($cff_past_events = false); //Get past events. Limit must be set high to get all past events and be able to show the newest ones first if ($cff_past_events) { $cff_events_json_url = 'https://graph.facebook.com/' . $u_id . '/events?fields=name,id,description,start_time,end_time,timezone,location,venue,ticket_uri,cover&limit=200&until=' . date('Y-m-d') . '&access_token=' . $access_token; } if ($cff_is_group) { $cff_events_json_url = 'https://graph.facebook.com/' . $page_id . '/events?fields=name,id,description,start_time,end_time,timezone,location,venue,ticket_uri,cover&limit=200&since=' . date('Y-m-d') . '&access_token=' . $access_token; } //Featured Post extension if ($cff_featured_post_active && !empty($atts['featuredpost'])) { $fql = cff_featured_event_id(trim($atts['featuredpost']), $access_token); } if ($cff_cache_time != 0) { $transient_name = 'cff_events_json_' . $page_id . '_' . strtotime($atts['from']) . strtotime($atts['until']) . $atts['featuredpost'] . $cff_past_events . $cff_page_type; if (false === ($events_json = get_transient($transient_name)) || $events_json === null) { //Get the contents of the events page $events_json = cff_fetchUrl($cff_events_json_url); //Cache the JSON set_transient($transient_name, $events_json, $cache_seconds); } else { $events_json = get_transient($transient_name); //If we can't find the transient then fall back to just getting the json from the api if ($events_json == false) { $events_json = cff_fetchUrl($cff_events_json_url); } } } else { $events_json = cff_fetchUrl($cff_events_json_url); } //Interpret data with JSON //Convert eid integer to a string otherwise json_decode returns it as a float $events_json = preg_replace('/"eid":(\\d+)/', '"eid":"$1"', $events_json); $events_json = preg_replace('/"id":(\\d+)/', '"id":"$1"', $events_json); $event_data = json_decode($events_json); //EVENTS LOOP foreach ($event_data->data as $event) { //Only create posts for the amount of posts specified // if ( $i == $show_posts ) break; $i++; //Past events if ($cff_past_events || $cff_is_group) { isset($event->id) ? $id = $event->id : ($id = ''); } else { isset($event->eid) ? $id = $event->eid : ($id = ''); } isset($event->name) ? $event_name = $event->name : ($event_name = ''); isset($event->attending_count) ? $attending_count = $event->attending_count : ($attending_count = ''); //Picture source if ($cff_past_events || $cff_is_group) { isset($event->cover) ? $pic_big = $event->cover->source : ($pic_big = plugins_url('/img/event-image.png', __FILE__)); } else { $atts['eventimage'] == 'cropped' ? $crop_event_pic = true : ($crop_event_pic = false); isset($event->pic_cover) && !$crop_event_pic ? $pic_big = $event->pic_cover->source : ($pic_big = $event->pic_big); } isset($event->start_time) ? $start_time = $event->start_time : ($start_time = ''); isset($event->end_time) ? $end_time = $event->end_time : ($end_time = ''); isset($event->timezone) ? $timezone = $event->timezone : ($timezone = ''); //Venue isset($event->venue->latitude) ? $venue_latitude = $event->venue->latitude : ($venue_latitude = ''); isset($event->venue->longitude) ? $venue_longitude = $event->venue->longitude : ($venue_longitude = ''); isset($event->venue->city) ? $venue_city = $event->venue->city : ($venue_city = ''); isset($event->venue->state) ? $venue_state = $event->venue->state : ($venue_state = ''); isset($event->venue->country) ? $venue_country = $event->venue->country : ($venue_country = ''); isset($event->venue->id) ? $venue_id = $event->venue->id : ($venue_id = ''); $venue_link = 'https://facebook.com/' . $venue_id; isset($event->venue->street) ? $venue_street = $event->venue->street : ($venue_street = ''); isset($event->venue->zip) ? $venue_zip = $event->venue->zip : ($venue_zip = ''); isset($event->location) ? $location = $event->location : ($location = ''); isset($event->description) ? $description = $event->description : ($description = ''); $event_link = 'https://facebook.com/events/' . $id; isset($event->ticket_uri) ? $ticket_uri = $event->ticket_uri : ($ticket_uri = ''); //Event date $event_time = $start_time; //If timezone migration is enabled then remove last 5 characters if (strlen($event_time) == 24) { $event_time = substr($event_time, 0, -5); } if (!empty($start_time)) { $cff_event_date = '<p class="cff-date" ' . $cff_event_date_styles . '><span class="cff-start-date">' . cff_eventdate(strtotime($event_time), $cff_event_date_formatting, $cff_event_date_custom) . '</span>'; } if (isset($event->end_time)) { $cff_event_date .= ' - <span class="cff-end-date">' . cff_eventdate(strtotime($end_time), $cff_event_date_formatting, $cff_event_date_custom) . '</span>'; } $cff_event_date .= '</p>'; //Event title $cff_event_title = ''; if ($cff_event_title_link) { $cff_event_title .= '<a href="' . $event_link . '" ' . $target . $cff_nofollow . '>'; } $cff_event_title .= '<' . $cff_event_title_format . ' ' . $cff_event_title_styles . '>' . $event_name . '</' . $cff_event_title_format . '>'; if ($cff_event_title_link) { $cff_event_title .= '</a>'; } //***************************// //***CREATE THE EVENT HTML***// //***************************// $cff_post_item = '<div class="cff-item cff-event author-' . cff_to_slug($page_id); if ($cff_post_bg_color_check) { $cff_post_item .= ' cff-box'; } $cff_post_item .= '" id="cff_' . $id . '" ' . $cff_item_styles . '>'; //Picture if ($cff_show_media) { $cff_post_item .= '<a title="' . $cff_facebook_link_text . '" class="cff-photo" href="' . $event_link . '" ' . $target . $cff_nofollow . '><img src="' . $pic_big . '" /></a>'; } //Start text wrapper if ($cff_thumb_layout || $cff_half_layout) { $cff_post_item .= '<div class="cff-details">'; } //show event date above title if ($cff_show_date && $cff_event_date_position == 'above') { $cff_post_item .= $cff_event_date; } //Show event title if ($cff_show_event_title && !empty($event_name)) { $cff_post_item .= $cff_event_title; } //show event date below title if ($cff_show_date && $cff_event_date_position !== 'above') { $cff_post_item .= $cff_event_date; } //Show event details if ($cff_show_event_details) { if (!empty($location)) { $cff_post_item .= '<p class="cff-location" ' . $cff_event_details_styles . '>'; } if (!empty($venue_id)) { $cff_post_item .= '<a href="' . $venue_link . '" ' . $target . $cff_nofollow . ' style="color:#' . $cff_event_link_color . ';">'; } if (!empty($location)) { $cff_post_item .= '<b>' . $location . '</b>'; } if (!empty($venue_id)) { $cff_post_item .= '</a>'; } if (!empty($venue_street)) { $cff_post_item .= '<br />' . $venue_street; } if (!empty($venue_city)) { $cff_post_item .= '<br />' . $venue_city . ', ' . $venue_state . ' ' . $venue_zip; } $cff_map_text = $atts['maptext']; if (!empty($venue_latitude)) { $cff_post_item .= ' <a href="https://maps.google.com/maps?q=' . $venue_latitude . ',+' . $venue_longitude . '" ' . $target . $cff_nofollow . ' style="color:#' . $cff_event_link_color . ';">' . $cff_map_text . '</a>'; } if (!empty($location)) { $cff_post_item .= '</p>'; } if (!empty($description)) { $cff_post_item .= '<p class="cff-desc" '; //Set the char limit on the element if (!empty($body_limit)) { if (strlen($description) > $body_limit) { $cff_post_item .= 'data-char="' . $body_limit . '" '; } } $cff_post_item .= $cff_event_details_styles . '><span class="cff-desc-text">' . cff_autolink($description, $link_color = $cff_event_link_color) . '</span>'; //Add the See More and See Less links if needed if (!empty($body_limit)) { if (strlen($description) > $body_limit) { $cff_post_item .= '<span class="cff-expand">... <a href="#" style="color: #' . $cff_posttext_link_color . '"><span class="cff-more">' . $cff_see_more_text . '</span><span class="cff-less">' . $cff_see_less_text . '</span></a></span>'; } } $cff_post_item .= '</p>'; } } //End details if ($cff_thumb_layout || $cff_half_layout) { $cff_post_item .= '</div>'; } $cff_post_item .= '<div class="cff-meta-wrap">'; $cff_post_item .= '<div class="cff-post-links">'; //Social media sharing URLs $cff_share_facebook = 'https://www.facebook.com/sharer/sharer.php?u=' . urlencode($event_link); $cff_share_twitter = 'https://twitter.com/intent/tweet?text=' . urlencode($event_link); $cff_share_google = 'https://plus.google.com/share?url=' . urlencode($event_link); $cff_share_linkedin = 'https://www.linkedin.com/shareArticle?mini=true&url=' . urlencode($event_link) . '&title=' . rawurlencode(strip_tags($cff_event_title) . ' - ' . strip_tags($cff_event_date)); $cff_share_email = 'mailto:?subject=Facebook&body=' . urlencode($event_link) . '%20-%20' . rawurlencode(strip_tags($cff_event_title) . ' - ' . strip_tags($cff_event_date)); //View on Facebook link if ($cff_show_facebook_link) { $cff_post_item .= '<a class="cff-viewpost" href="' . $event_link . '" ' . $target . $cff_nofollow . ' ' . $cff_link_styles . '>' . $cff_facebook_link_text . '</a>'; } //Share link if ($cff_show_facebook_share) { $cff_post_item .= '<div class="cff-share-container">'; if ($cff_show_facebook_link) { $cff_post_item .= '<span class="cff-dot" ' . $cff_link_styles . '>·</span>'; } $cff_post_item .= '<a class="cff-share-link" href="javascript:void(0);" title="' . $cff_facebook_share_text . '" ' . $cff_link_styles . '>' . $cff_facebook_share_text . '</a>'; $cff_post_item .= "<p class='cff-share-tooltip'><a href='" . $cff_share_facebook . "' target='_blank' class='cff-facebook-icon'><i class='fa fa-facebook-square'></i></a><a href='" . $cff_share_twitter . "' target='_blank' class='cff-twitter-icon'><i class='fa fa-twitter'></i></a><a href='" . $cff_share_google . "' target='_blank' class='cff-google-icon'><i class='fa fa-google-plus'></i></a><a href='" . $cff_share_linkedin . "' target='_blank' class='cff-linkedin-icon'><i class='fa fa-linkedin'></i></a><a href='" . $cff_share_email . "' target='_blank' class='cff-email-icon'><i class='fa fa-envelope'></i></a><i class='fa fa-play fa-rotate-90'></i></p></div>"; } $cff_post_item .= '</div>'; $cff_post_item .= '</div></div><div class="cff-clear"></div>'; //Get the filter string $cff_filter_string = $atts['filter']; //Create a string from the event title, location and address to use in the filter check below $cff_event_address_string = $cff_event_title . $location . $venue_street . $venue_city . $venue_state . $venue_zip; $cff_show_post = true; if ($cff_filter_string != '') { //Explode it into multiples $cff_filter_strings_array = explode(',', $cff_filter_string); //Hide the post if both the post text and description don't contain the string $string_in_address = true; $string_in_desc = true; if (cff_stripos_arr($cff_event_address_string, $cff_filter_strings_array) === false) { $string_in_address = false; } if (cff_stripos_arr($description, $cff_filter_strings_array) === false) { $string_in_desc = false; } if ($string_in_address == false && $string_in_desc == false) { $cff_show_post = false; } } $cff_exclude_string = $atts['exfilter']; if ($cff_exclude_string != '') { //Explode it into multiples $cff_exclude_strings_array = explode(',', $cff_exclude_string); //Hide the post if both the post text and description don't contain the string $string_in_address = false; $string_in_desc = false; if (cff_stripos_arr($cff_event_address_string, $cff_exclude_strings_array) !== false) { $string_in_address = true; } if (cff_stripos_arr($description, $cff_exclude_strings_array) !== false) { $string_in_desc = true; } if ($string_in_address == true || $string_in_desc == true) { $cff_show_post = false; } } //Offset. If the post index ($i) is less than the offset then don't show the post if (intval($i) < intval($atts['offset'])) { $cff_show_post = false; $i++; } //Change the seconds value of the event_time unix value so that if more than 1 event has the same start time then it doesn't get replaced in the posts array $event_time_unix = strtotime($event_time); $event_time = substr($event_time_unix, 0, -1) . rand(1, 9); //PUSH TO ARRAY if the post should be shown if ($cff_show_post !== false) { $cff_posts_array = cff_array_push_assoc($cff_posts_array, $event_time, $cff_post_item); } } // End the loop //Sort all of the events by all page IDs to show the most recent upcoming events first if (!$cff_past_events) { ksort($cff_posts_array); } //If there are no upcoming events then display a message if (!$cff_past_events && empty($cff_posts_array)) { $cff_posts_array = cff_array_push_assoc($cff_posts_array, 1, '<p class="cff-no-events">' . $cff_no_events_text . '</p>'); } // if($cff_past_events) usort($cff_posts_array, 'sortByOrder'); if ($cff_past_events) { krsort($cff_posts_array); } } //End EVENTS ONLY //ALL POSTS if (!$cff_events_only || $cff_events_only && $cff_events_source == 'timeline') { //Create date range using the Date Range extension $cff_ext_date_active ? $cff_date_range = cff_ext_date(strtotime($atts['from']), strtotime($atts['until'])) : ($cff_date_range = ''); $cff_posts_json_url = 'https://graph.facebook.com/v2.3/' . $page_id . '/' . $graph_query . '?fields=id,from,message,message_tags,story,story_tags,picture,full_picture,link,source,name,caption,description,type,status_type,object_id,created_time,attachments{subattachments},shares,likes{id,name},comments{attachment,id,from,message,message_tags,created_time,like_count}&access_token=' . $access_token . '&limit=' . $cff_post_limit . '&locale=' . $cff_locale . $cff_ssl . $cff_date_range; //VIDEOS ONLY if ($cff_videos_only) { $cff_posts_json_url = 'https://graph.facebook.com/' . $page_id . '?fields=videos{source,name,description,embed_html,format{picture}}&access_token=' . $access_token . '&locale=' . $cff_locale; } //PHOTOS ONLY if ($cff_photos_only) { //Get the user's ID $get_page_info = cff_fetchUrl('https://graph.facebook.com/' . $page_id . '?fields=name,id&access_token=' . $access_token); $page_info = json_decode($get_page_info); //Get user ID $u_id = $page_info->id; //PHOTOS ONLY if ($cff_is_group) { //For groups $cff_posts_json_url = "https://graph.facebook.com/fql?q=SELECT%20pid,created,src_big,link,caption%20FROM%20photo%20WHERE%20pid%20IN%20(SELECT%20pid%20FROM%20photo_tag%20WHERE%20subject='" . $u_id . "')%20OR%20pid%20IN%20(SELECT%20pid%20FROM%20photo%20WHERE%20aid%20IN%20(SELECT%20aid%20FROM%20album%20WHERE%20owner='" . $u_id . "'%20AND%20type!='profile'))%20LIMIT%20" . $cff_post_limit . "%20&access_token=" . $access_token; } else { //For pages $cff_posts_json_url = "https://graph.facebook.com/fql?q=SELECT%20pid,created,src_big,link,caption%20FROM%20photo%20WHERE%20pid%20IN%20(SELECT%20pid%20FROM%20photo%20WHERE%20owner='" . $u_id . "')%20LIMIT%20" . $cff_post_limit . "%20&access_token=" . $access_token; } } //ALBUMS ONLY if ($cff_albums_only && $cff_albums_source == 'photospage') { $cff_posts_json_url = 'https://graph.facebook.com/' . $page_id . '/albums?access_token=' . $access_token . '&limit=' . $cff_post_limit . '&locale=' . $cff_locale; } //Featured Post extension if ($cff_featured_post_active && !empty($atts['featuredpost'])) { $cff_posts_json_url = cff_featured_post_id(trim($atts['featuredpost']), $access_token); } //ALBUM EMBED $cff_album_id = $atts['album']; if ($cff_album_active && !empty($cff_album_id)) { //Get the JSON back from the Album extension $cff_album_json_url = cff_album_id(trim($cff_album_id), $access_token, $cff_post_limit); //Don't use caching if the cache time is set to zero if ($cff_cache_time != 0) { // Get any existing copy of our transient data $transient_name = 'cff_album_json_' . $cff_album_id; if (false === ($album_json = get_transient($transient_name)) || $album_json === null) { //Get the contents of the Facebook page $album_json = cff_fetchUrl($cff_album_json_url); //Cache the JSON set_transient($transient_name, $album_json, $cache_seconds); } else { $album_json = get_transient($transient_name); //If we can't find the transient then fall back to just getting the json from the api if ($album_json == false) { $album_json = cff_fetchUrl($cff_album_json_url); } } } else { $album_json = cff_fetchUrl($cff_album_json_url); } } //Don't use caching if the cache time is set to zero if ($cff_cache_time != 0) { // Get any existing copy of our transient data $transient_name = 'cff_' . $page_id . '_' . strtotime($atts['from']) . strtotime($atts['until']) . $atts['featuredpost'] . $cff_albums_only . $cff_albums_source . $cff_photos_only . $cff_videos_only . $cff_post_limit . $show_posts_by; if (false === ($posts_json = get_transient($transient_name)) || $posts_json === null) { //Get the contents of the Facebook page $posts_json = cff_fetchUrl($cff_posts_json_url); //Check whether any data is returned from the API. If it isn't then don't cache the error response and instead keep checking the API on every page load until data is returned. $FBdata = json_decode($posts_json); if (!empty($FBdata->data)) { //Cache the JSON set_transient($transient_name, $posts_json, $cache_seconds); } } else { $posts_json = get_transient($transient_name); //If we can't find the transient then fall back to just getting the json from the api if ($posts_json == false) { $posts_json = cff_fetchUrl($cff_posts_json_url); } } } else { $posts_json = cff_fetchUrl($cff_posts_json_url); } if ($cff_show_only_others) { //Get the numeric ID of the page so can compare it to the author of each post $page_object = cff_fetchUrl('https://graph.facebook.com/' . $page_id . '?fields=name,id&access_token=' . $access_token); $page_object = json_decode($page_object); $numeric_page_id = $page_object->id; } //Interpret data with JSON $FBdata = json_decode($posts_json); //If there's no data then show a pretty error message if (empty($FBdata->data) && empty($FBdata->videos) && (!$cff_featured_post_active || empty($atts['featuredpost'])) && !$cff_ext_multifeed_active) { $cff_content .= '<div class="cff-error-msg"><p>Unable to display Facebook posts.<br/><a href="javascript:void(0);" id="cff-show-error" onclick="cffShowError()">Show error</a>'; $cff_content .= '<script type="text/javascript">function cffShowError() { document.getElementById("cff-error-reason").style.display = "block"; document.getElementById("cff-show-error").style.display = "none"; }</script>'; $cff_content .= '</p><div id="cff-error-reason">'; if (isset($FBdata->error->message)) { $cff_content .= 'Error: ' . $FBdata->error->message; } if (isset($FBdata->error->type)) { $cff_content .= '<br />Type: ' . $FBdata->error->type; } if (isset($FBdata->error->code)) { $cff_content .= '<br />Code: ' . $FBdata->error->code; } if (isset($FBdata->error->error_subcode)) { $cff_content .= '<br />Subcode: ' . $FBdata->error->error_subcode; } if (isset($FBdata->error_msg)) { $cff_content .= 'Error: ' . $FBdata->error_msg; } if (isset($FBdata->error_code)) { $cff_content .= '<br />Code: ' . $FBdata->error_code; } if ($FBdata == null) { $cff_content .= 'Error: Server configuration issue'; } if (empty($FBdata->error) && empty($FBdata->error_msg) && $FBdata !== null) { $cff_content .= 'Error: No posts available for this Facebook ID'; } $cff_content .= '<br />Please refer to our <a href="https://smashballoon.com/custom-facebook-feed/docs/errors/" target="_blank">Error Message Reference</a>.'; $cff_content .= '</div></div>'; //End .cff-error-msg and #cff-error-reason $cff_content .= '</div></div>'; //End #cff and .cff-wrapper return $cff_content; } //ALBUM EMBED if ($cff_album_active && !empty($cff_album_id)) { $FBdata = json_decode($album_json); } //***STARTS POSTS LOOP*** $fbdata_string = ''; //If the Featured Post extension is active then adjust the loop as there is no 'data' if ($cff_featured_post_active && !empty($atts['featuredpost'])) { if (isset($FBdata) && !empty($FBdata)) { $fbdata_string = $FBdata; } } else { if ($cff_videos_only && isset($FBdata->videos)) { //Videos only $fbdata_string = $FBdata->videos->data; } else { //All other posts if (isset($FBdata->data)) { $fbdata_string = $FBdata->data; } } } foreach ($fbdata_string as $news) { if ($cff_featured_post_active && !empty($atts['featuredpost'])) { $news = $FBdata; } $cff_post_item = ''; //Explode News and Page ID's into 2 values $PostID = ''; if (isset($news->id)) { $cff_post_id = $news->id; $PostID = explode("_", $cff_post_id); } if (isset($PostID[0])) { $orig_post_id = $PostID[0]; } if (isset($PostID[1])) { $orig_post_id .= '_' . $PostID[1]; } //Check the post type isset($news->type) ? $cff_post_type = $news->type : ($cff_post_type = ''); if ($cff_post_type == 'link') { isset($news->story) ? $story = $news->story : ($story = ''); //Check whether it's an event $event_link_check = "facebook.com/events/"; //Make sure URL doesn't include 'permalink' as that indicates someone else sharing a post from within an event (eg: https://www.facebook.com/events/617323338414282/permalink/617324268414189/) and the event ID is then not retrieved properly from the event URL as it's formatted like so: facebook.com/events/EVENT_ID/permalink/POST_ID $event_link_check = stripos($news->link, $event_link_check); $event_link_check_2 = stripos($news->link, "permalink/"); if ($event_link_check && !$event_link_check_2) { $cff_post_type = 'event'; } } //Set the post link isset($news->link) ? $link = htmlspecialchars($news->link) : ($link = ''); //If there's no link provided then link to the individual post if (empty($news->link)) { //Link to individual post if (isset($PostID[1])) { $link = "https://www.facebook.com/" . $page_id . "/posts/" . $PostID[1]; } } //If it's an event then check whether the URL contains facebook.com if (isset($news->link)) { if (stripos($news->link, "events/") && $cff_post_type == 'event') { //Facebook changed the event link from absolute to relative, and so if the link isn't absolute then add facebook.com to front stripos($link, 'facebook.com') ? $link = $link : ($link = 'https://facebook.com' . $link); } } //Is it an album? $cff_album = false; $num_photos = 0; //The album check has to be done this way as checking for attachments/subattachments doesn't work as the posts which have the wrong posts IDs (the album ID instead of the post ID - see Facebook bug report) don't have any post attachments in the API even though they do on Facebook. if (isset($news->status_type)) { if ($news->status_type == 'added_photos') { //Check 'story' to see whether it contains a number isset($news->story) ? $str = $news->story : ($str = ''); //Only matches number with a space after them preg_match('!\\d+ !', $str, $matches); isset($matches[0]) ? $num_photos = $matches[0] : ($num_photos = 0); //If the story contains a number... if ($num_photos > 1) { //... and the link is to an album then it most likely has photo attachments $albumLinkArr1 = explode('photos/a.', $link); $albumLinkArr2 = explode('.', $albumLinkArr1[1]); //If it has an album link then set the post type to be album if (isset($albumLinkArr1[1])) { $cff_album = true; //If the post has subattachments then don't change the post ID to the album ID. If it doesn't then change it to the album ID so that we can at least show the photos from the album if (!isset($news->attachments)) { //Change the Post ID to be to the post about adding photos to the album $cff_post_id = $PostID[0] . '_' . $albumLinkArr2[0]; } //Link to the album instead of the photo $album_link = str_replace('photo.php?', 'media/set/?', $link); $link = "https://www.facebook.com/" . $page_id . "/posts/" . $PostID[1]; //If the album link is a new format then link it to the post $album_link_check = 'media/set/?'; if (stripos($album_link, $album_link_check) !== true) { $album_link = $link; } } } } } //Should we show this post or not? $cff_show_post = false; switch ($cff_post_type) { case 'link': if ($cff_show_links_type) { $cff_show_post = true; } break; case 'event': if ($cff_show_event_type) { $cff_show_post = true; } break; case 'video': if ($cff_show_video_type) { $cff_show_post = true; } break; case 'swf': if ($cff_show_video_type) { $cff_show_post = true; } break; case 'photo': if ($cff_show_photos_type && !$cff_album) { $cff_show_post = true; } if ($cff_show_albums_type && $cff_album) { $cff_show_post = true; } break; case 'offer': //Show offer posts if links are shown if ($cff_show_links_type) { $cff_show_post = true; } break; case 'music': //Show music posts if statuses are shown if ($cff_show_status_type) { $cff_show_post = true; } break; case 'status': //Check whether it's a status (author comment or like) if ($cff_show_status_type && !empty($news->message)) { $cff_show_post = true; } break; } //Featured Post extension if ($cff_featured_post_active && !empty($atts['featuredpost'])) { //Always show the post if using the Featured Post extension $cff_show_post = true; if ($cff_show_links_type) { $cff_post_type = 'link'; } if ($cff_show_event_type) { $cff_post_type = 'event'; } if ($cff_show_video_type) { $cff_post_type = 'video'; } if ($cff_show_photos_type) { $cff_post_type = 'photo'; } if ($cff_show_albums_type) { $cff_post_type = 'album'; } if ($cff_show_status_type) { $cff_post_type = 'status'; } //If it's a status then use full-width layout by default if ($cff_post_type == 'status') { $cff_thumb_layout = false; $cff_half_layout = false; } } //ONLY show posts by others if ($cff_show_only_others) { //If the post author's ID is the same as the page ID then don't show the post if ($numeric_page_id == $news->from->id) { $cff_show_post = false; } } //Only show posts containing specified string //Get post text $post_text = ''; if (!empty($news->story)) { $post_text = $news->story; } if (!empty($news->message)) { $post_text = $news->message; } if (!empty($news->name) && empty($news->story) && empty($news->message)) { $post_text = $news->name; } //Get description text if (isset($news->description)) { $description_text = $news->description; } else { isset($news->caption) ? $description_text = $news->caption : ($description_text = ''); } //Get the filter string $cff_filter_string = $atts['filter']; if ($cff_filter_string != '') { //Explode it into multiples $cff_filter_strings_array = explode(',', $cff_filter_string); //Hide the post if both the post text and description don't contain the string $string_in_post_text = true; $string_in_desc = true; if (cff_stripos_arr($post_text, $cff_filter_strings_array) === false) { $string_in_post_text = false; } if (cff_stripos_arr($description_text, $cff_filter_strings_array) === false) { $string_in_desc = false; } if ($string_in_post_text == false && $string_in_desc == false) { $cff_show_post = false; } } $cff_exclude_string = $atts['exfilter']; if ($cff_exclude_string != '') { //Explode it into multiples $cff_exclude_strings_array = explode(',', $cff_exclude_string); //Hide the post if both the post text and description don't contain the string $string_in_post_text = false; $string_in_desc = false; if (cff_stripos_arr($post_text, $cff_exclude_strings_array) !== false) { $string_in_post_text = true; } if (cff_stripos_arr($description_text, $cff_exclude_strings_array) !== false) { $string_in_desc = true; } if ($string_in_post_text == true || $string_in_desc == true) { $cff_show_post = false; } } //Is it a duplicate post? if (!isset($prev_post_message)) { $prev_post_message = ''; } if (!isset($prev_post_link)) { $prev_post_link = ''; } if (!isset($prev_post_description)) { $prev_post_description = ''; } isset($news->message) ? $pm = $news->message : ($pm = ''); isset($news->link) ? $pl = $news->link : ($pl = ''); isset($news->description) ? $pd = $news->description : ($pd = ''); if ($prev_post_message == $pm && $prev_post_link == $pl && $prev_post_description == $pd) { $cff_show_post = false; } //ALBUMS ONLY if ($cff_albums_only && $cff_albums_source == 'photospage') { $cff_show_post = true; } //ALBUM EMBED if ($cff_album_active && !empty($cff_album_id)) { $cff_show_post = true; } //PHOTOS ONLY if ($cff_photos_only) { $cff_show_post = true; } //VIDEOS ONLY if ($cff_videos_only) { $cff_show_post = true; } //Check post type and display post if selected if ($cff_show_post) { //If it isn't then create the post $cff_offset_show_post = true; //Offset. If the post index ($i) is less than the offset then don't show the post if (intval($i) < intval($atts['offset'])) { $cff_offset_show_post = false; $i++; } //If there's an offset then show the post until it's set to false above. This has been moved here so that the offset works correctly when only displaying specific post types, as previously it only worked accurately when all posts were shown if ($cff_offset_show_post) { if (!$cff_ext_multifeed_active) { //Only create posts for the amount of posts specified if (intval($atts['offset']) > 0) { //If offset is being used then stop after showing the number of posts + the offset if ($i == intval($show_posts) + intval($atts['offset'])) { break; } } else { //Else just stop after the number of posts to be displayed is reached, unless it's albums only or photos only if ($cff_albums_only && $cff_albums_source == 'photospage' || $cff_photos_only && empty($cff_album_id) || $cff_videos_only) { //Keep going } else { if ($i == $show_posts) { break; } } } } $i++; //********************************// //***COMPILE SECTION VARIABLES***// //********************************// //Change image size based on layout if (!empty($news->picture) && !empty($news->object_id)) { $object_id = $news->object_id; $picture = 'https://graph.facebook.com/' . $object_id . '/picture?type=normal&width=9999&height=9999'; } //DATE $cff_date_formatting = $atts['dateformat']; $cff_date_custom = $atts['datecustom']; isset($news->created_time) ? $post_time = $news->created_time : ($post_time = ''); $cff_date = '<p class="cff-date" ' . $cff_date_styles . '>' . $cff_date_before . ' ' . cff_getdate(strtotime($post_time), $cff_date_formatting, $cff_date_custom) . ' ' . $cff_date_after; $cff_date .= '</p>'; //Only run if NOT only showing photos from the photos page, or albums, or an album embed if (!$cff_photos_only && !$cff_videos_only && !($cff_albums_only && $cff_albums_source == 'photospage') && empty($cff_album_id)) { //POST AUTHOR $cff_author = '<div class="cff-author">'; //Author text $cff_author .= '<a href="https://facebook.com/' . $news->from->id . '" ' . $target . $cff_nofollow . ' title="' . $news->from->name . ' on Facebook" ' . $cff_author_styles . '><div class="cff-author-text">'; if ($cff_show_date && $cff_date_position !== 'above' && $cff_date_position !== 'below') { $cff_author .= '<p class="cff-page-name cff-author-date">' . $news->from->name . '</p>'; $cff_author .= $cff_date; } else { $cff_author .= '<span class="cff-page-name">' . $news->from->name . '</span>'; } $cff_author .= '</div>'; //Author image //Set the author image as a variable. If it already exists then don't query the api for it again. $cff_author_img_var = '$cff_author_img_' . $news->from->id; if (!isset(${$cff_author_img_var})) { ${$cff_author_img_var} = 'https://graph.facebook.com/' . $news->from->id . '/picture?type=square'; } $cff_author .= '<div class="cff-author-img"><img src="' . ${$cff_author_img_var} . '" title="' . $news->from->name . '" alt="' . $news->from->name . '" width=40 height=40></div>'; $cff_author .= '</a></div>'; //End .cff-author //POST TEXT $cff_post_text = '<' . $cff_title_format . ' class="cff-post-text" ' . $cff_title_styles . '>'; //Get the actual post text //Which content should we use? $post_text = ''; $cff_post_text_type = ''; $cff_story_raw = ''; $cff_message_raw = ''; $cff_name_raw = ''; $text_tags = ''; $post_text_story = ''; $post_text_message = ''; //MESSAGE TAGS $cff_post_tags = $atts['posttags']; //If the post tags option doesn't exist yet (ie. on plugin update) then set them as true if (!array_key_exists('cff_post_tags', $options)) { $cff_post_tags = true; } //Use the story if (!empty($news->story)) { $cff_story_raw = $news->story; $post_text_story .= htmlspecialchars($cff_story_raw); $cff_post_text_type = 'story'; //Add message and story tags if there are any and the post text is the message or the story if ($cff_post_tags && isset($news->story_tags) && !$cff_title_link) { $text_tags = $news->story_tags; //Does the Post Text contain any html tags? - the & symbol is the best indicator of this $cff_html_check_array = array('<', '’', '“', '"', '&', '>>'); //always use the text replace method if (cff_stripos_arr($post_text_story, $cff_html_check_array) !== false) { //Loop through the tags foreach ($text_tags as $message_tag) { $tag_name = $message_tag[0]->name; $tag_link = '<a href="http://facebook.com/' . $message_tag[0]->id . '">' . $message_tag[0]->name . '</a>'; $post_text_story = str_replace($tag_name, $tag_link, $post_text_story); } } else { //If it doesn't contain HTMl tags then use the offset to replace message tags $message_tags_arr = array(); $tag = 0; foreach ($text_tags as $message_tag) { $tag++; isset($message_tag[0]->type) ? $tag_type = $message_tag[0]->type : ($tag_type = ''); if ($tag_type == 'event' || count($message_tag) > 1) { //Don't use the story tag in this case otherwise it changes '__ created an event' to '__ created an Name Of Event' } else { $message_tags_arr = cff_array_push_assoc($message_tags_arr, $tag, array('id' => $message_tag[0]->id, 'name' => $message_tag[0]->name, 'type' => isset($message_tag[0]->type) ? $message_tag[0]->type : '', 'offset' => $message_tag[0]->offset, 'length' => $message_tag[0]->length)); } } for ($tag = count($message_tags_arr); $tag >= 1; $tag--) { //If the name is blank (aka the story tag doesn't work properly) then don't use it if ($message_tags_arr[$tag]['name'] !== '') { if ($message_tags_arr[$tag]['type'] == 'event') { //Don't use the story tag in this case otherwise it changes '__ created an event' to '__ created an Name Of Event' } else { $b = '<a href="http://facebook.com/' . $message_tags_arr[$tag]['id'] . '">' . $message_tags_arr[$tag]['name'] . '</a>'; $c = $message_tags_arr[$tag]['offset']; $d = $message_tags_arr[$tag]['length']; $post_text_story = cff_mb_substr_replace($post_text_story, $b, $c, $d); } } } } // end if/else } //END MESSAGE TAGS } //Use the message if (!empty($news->message)) { $cff_message_raw = $news->message; $post_text_message = htmlspecialchars($cff_message_raw); $cff_post_text_type = 'message'; //Add message and story tags if there are any and the post text is the message or the story if ($cff_post_tags && isset($news->message_tags) && !$cff_title_link) { $text_tags = $news->message_tags; //Does the Post Text contain any html tags? - the & symbol is the best indicator of this $cff_html_check_array = array('<', '’', '“', '"', '&', '>>'); //always use the text replace method if (cff_stripos_arr($post_text_message, $cff_html_check_array) !== false) { //Loop through the tags foreach ($text_tags as $message_tag) { $tag_name = $message_tag[0]->name; $tag_link = '<a href="http://facebook.com/' . $message_tag[0]->id . '">' . $message_tag[0]->name . '</a>'; $post_text_message = str_replace($tag_name, $tag_link, $post_text_message); } } else { //If it doesn't contain HTMl tags then use the offset to replace message tags $message_tags_arr = array(); $tag = 0; foreach ($text_tags as $message_tag) { $tag++; $message_tags_arr = cff_array_push_assoc($message_tags_arr, $tag, array('id' => $message_tag[0]->id, 'name' => $message_tag[0]->name, 'type' => isset($message_tag[0]->type) ? $message_tag[0]->type : '', 'offset' => $message_tag[0]->offset, 'length' => $message_tag[0]->length)); } for ($tag = count($message_tags_arr); $tag >= 1; $tag--) { //If the name is blank (aka the story tag doesn't work properly) then don't use it if ($message_tags_arr[$tag]['name'] !== '') { $b = '<a href="http://facebook.com/' . $message_tags_arr[$tag]['id'] . '">' . $message_tags_arr[$tag]['name'] . '</a>'; $c = $message_tags_arr[$tag]['offset']; $d = $message_tags_arr[$tag]['length']; $post_text_message = cff_mb_substr_replace($post_text_message, $b, $c, $d); } } } // end if/else } //END MESSAGE TAGS } //Add the story and message together $post_text = '<span class="cff-story">' . $post_text_story; if (!empty($post_text_story) && !empty($post_text_message)) { $post_text .= "<br /><br />"; } $post_text .= '</span>'; //Check to see whether it's an embedded video so that we can show the name above the post text if necessary $cff_soundcloud = false; $cff_is_video_embed = false; if ($news->type == 'video') { $url = $news->source; //Embeddable video strings $youtube = 'youtube'; $youtu = 'youtu'; $vimeo = 'vimeo'; $youtubeembed = 'youtube.com/embed'; $soundcloud = 'player.soundcloud.com'; $swf = '.swf'; //Check whether it's a youtube video $youtube = stripos($url, $youtube); $youtu = stripos($url, $youtu); $youtubeembed = stripos($url, $youtubeembed); //Check whether it's a SoundCloud embed $soundcloudembed = stripos($url, $soundcloud); //Check whether it's a youtube video if ($youtube || $youtu || $youtubeembed || stripos($url, $vimeo) !== false) { $cff_is_video_embed = true; } //If it's soundcloud then add it into the shared link box at the bottom of the post if ($soundcloudembed) { $cff_soundcloud = true; } //If the name exists and it's a non-embedded video then show the name at the top of the post text if (isset($news->name) && !$cff_is_video_embed) { if (empty($post_text_message)) { $post_text .= "<br /><br />"; } if (!$cff_title_link) { $post_text .= '<a href="' . $link . '" ' . $target . $cff_nofollow . ' style="color: #' . $cff_posttext_link_color . '">'; } $post_text .= htmlspecialchars($news->name); if (!$cff_title_link) { $post_text .= '</a>'; } $post_text .= '<br />'; } } //Add the message $post_text .= $post_text_message; //Use the name if (!empty($news->name) && empty($news->story) && empty($news->message)) { $cff_name_raw = $news->name; $post_text = htmlspecialchars($cff_name_raw); $cff_post_text_type = 'name'; } // if ($cff_album) { // if (!empty($news->name)) { // $post_text .= htmlspecialchars($news->name); // $cff_post_text_type = 'name'; // } // // if (!empty($news->message) && empty($news->name)) { // if (!empty($news->message)) { // $post_text .= htmlspecialchars($news->message); // $cff_post_text_type = 'message'; // } // // if ($num_photos > 1) $post_text .= ' (' . trim($num_photos) . ' '.$cff_translate_photos_text.')'; // } //OFFER TEXT if ($cff_post_type == 'offer') { isset($news->story) ? $post_text = htmlspecialchars($news->story) . '<br /><br />' : ($post_text = ''); $post_text .= htmlspecialchars($news->name); $cff_post_text_type = 'story'; } //Start HTML for post text $cff_post_text .= '<span class="cff-text" data-color="' . $cff_posttext_link_color . '">'; if ($cff_title_link) { $cff_post_text .= '<a class="cff-post-text-link" ' . $cff_title_styles . ' href="' . $link . '" ' . $target . $cff_nofollow . '>'; } //Replace line breaks in text (needed for IE8) $post_text = preg_replace("/\r\n|\r|\n/", '<br/>', $post_text); //If the text is wrapped in a link then don't hyperlink any text within if ($cff_title_link) { //Wrap links in a span so we can break the text if it's too long $cff_post_text .= cff_wrap_span($post_text) . ' '; } else { //Don't use htmlspecialchars for post_text as it's added above so that it doesn't mess up the message_tag offsets $cff_post_text .= cff_autolink($post_text) . ' '; } if ($cff_title_link) { $cff_post_text .= '</a>'; } $cff_post_text .= '</span>'; //'See More' link $cff_post_text .= '<span class="cff-expand">... <a href="#" style="color: #' . $cff_posttext_link_color . '"><span class="cff-more">' . $cff_see_more_text . '</span><span class="cff-less">' . $cff_see_less_text . '</span></a></span>'; $cff_post_text .= '</' . $cff_title_format . '>'; // $cff_post_text .= '</div>'; //DESCRIPTION $cff_description = ''; if (!empty($news->description) || !empty($news->caption)) { $description_text = ''; if (!empty($news->description)) { $description_text = $news->description; } else { $description_text = $news->caption; } //If the description is the same as the post text then don't show it if ($description_text == $cff_story_raw || $description_text == $cff_message_raw || $description_text == $cff_name_raw) { $cff_description = ''; } else { //Truncate desc if (!empty($body_limit)) { if (strlen($description_text) > $body_limit) { $description_text = substr($description_text, 0, $body_limit) . '...'; } } //Add links and create HTML $cff_description .= '<p class="cff-post-desc" ' . $cff_body_styles . '><span>' . cff_autolink(htmlspecialchars($description_text), $link_color = $cff_posttext_link_color) . ' </span></p>'; } if ($cff_post_type == 'event') { $cff_description = ''; } } //LINK $cff_shared_link = ''; //Display shared link if ($cff_post_type == 'link' || $cff_soundcloud) { if ($cff_soundcloud) { //Put this here so that is also hidden when hiding shared links in the Post Layout settings if ($cff_soundcloud) { $cff_shared_link .= '<iframe class="cff-soundcloud" width="100%" height="100" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=' . $news->link . '&auto_play=false&hide_related=true&show_comments=false&show_user=true&show_reposts=false&visual=false"></iframe>'; } } else { $cff_shared_link .= '<div class="cff-shared-link'; if ($cff_disable_link_box) { $cff_shared_link .= ' cff-no-styles'; } if ($cff_full_link_images) { $cff_shared_link .= ' cff-full-size'; } $cff_shared_link .= '" '; if (!$cff_disable_link_box) { $cff_shared_link .= $cff_link_box_styles; } $cff_shared_link .= '>'; $cff_link_image = ''; if (isset($news->picture)) { if (!empty($news->picture)) { $picture = $news->picture; /*If the image doesn't have a _b version then the URL looks like this: http://photos-h.ak.fbcdn.net/hphotos-ak-prn1/v/1600273_348160658659104_383135394_s.jpg?oh=23124db338cd899962fa7fb2d7285306&oe=52D5F9BE&__gda__=1389770591_64da0df3e725ca2d1fd026b0e922c58b So check for this kind of string below and don't replace _s. with _b. */ $bigjpg = '_s.jpg?'; $bigpng = '_s.png?'; $biggif = '_s.gif?'; $bigbmp = '_s.bmp?'; $bigtjpg = '_t.jpg?'; $bigtpng = '_t.png?'; $bigtgif = '_t.gif?'; $bigtbmp = '_t.bmp?'; $imagecheck1 = stripos($picture, $bigjpg); $imagecheck2 = stripos($picture, $bigpng); $imagecheck3 = stripos($picture, $biggif); $imagecheck4 = stripos($picture, $bigbmp); $imagecheck5 = stripos($picture, $bigtjpg); $imagecheck6 = stripos($picture, $bigtpng); $imagecheck7 = stripos($picture, $bigtgif); $imagecheck8 = stripos($picture, $bigtbmp); if (!($imagecheck1 || $imagecheck2 || $imagecheck3 || $imagecheck4 || $imagecheck5 || $imagecheck6 || $imagecheck7 || $imagecheck8)) { //Show larger image $picture = str_replace('_s.', '_b.', $picture); $picture = str_replace('_q.', '_b.', $picture); $picture = str_replace('_t.', '_b.', $picture); } if (isset($news->picture) && !empty($news->picture)) { $picture = $news->picture; } isset($news->full_picture) && !empty($news->full_picture) ? $full_picture = $news->full_picture : ($full_picture = $picture); //Set the link image to be the full-size image if ($cff_full_link_images) { $picture = $news->full_picture; } } //Check whether the image is a 1x1 placeholder $cff_link_image = true; $cff_one_x_one = '1x1.'; if (stripos($news->picture, $cff_one_x_one) == true || empty($news->picture)) { $cff_link_image = false; } //If there's a picture accompanying the link then display it if ($cff_link_image && $cff_show_media) { $cff_shared_link .= '<a class="cff-link" href="' . $link . '" ' . $target . $cff_nofollow . ' data-full="' . $full_picture . '">'; $cff_shared_link .= '<img src="' . $picture . '" />'; $cff_shared_link .= '</a>'; } } //Display link name and description // if (!empty($news->description)) { $cff_shared_link .= '<div class="cff-text-link '; if (!$cff_link_image) { $cff_shared_link .= 'cff-no-image'; } //The link title: $cff_shared_link .= '"><' . $cff_link_title_format . ' class="cff-link-title" ' . $cff_link_title_styles . '><a href="' . $link . '" ' . $target . $cff_nofollow . ' style="color:#' . $cff_link_title_color . ';">' . $news->name . '</a></' . $cff_link_title_format . '>'; //The link source: !empty($news->caption) ? $cff_link_caption = $news->caption : ($cff_link_caption = ''); if (!empty($cff_link_caption)) { $cff_shared_link .= '<p class="cff-link-caption" style="color:#' . str_replace('#', '', $cff_link_url_color) . ';">' . $cff_link_caption . '</p>'; } if ($cff_show_desc) { if ($description_text != $cff_link_caption) { $cff_shared_link .= $cff_description; } } $cff_shared_link .= '</div>'; // } $cff_shared_link .= '</div>'; } //End soundcloud check } //EVENT $cff_event = ''; if ($cff_show_event_title || $cff_show_event_details) { //Check for media if ($cff_post_type == 'event') { //Get the event id from the event URL. eg: http://www.facebook.com/events/123451234512345/ $event_url = parse_url($link); $url_parts = explode('/', $event_url['path']); //Get the id from the parts $eventID = $url_parts[count($url_parts) - 2]; //Facebook changed the event link from absolute to relative, and so if the link isn't absolute then add facebook.com to front stripos($link, 'facebook.com') ? $link = $link : ($link = 'https://facebook.com' . $link); //New tokens which are 2.3 and newer don't allow us to get the location or venue of timeline events so use older tokens for timeline events $access_token = $access_token_array_fql[rand(0, 4)]; //Get the contents of the event // $event_json_url = 'https://graph.facebook.com/'.$eventID.'?access_token=' . $access_token . $cff_ssl; $event_json_url = 'https://graph.facebook.com/v2.2/' . $eventID . '?fields=description,location,name,owner,start_time,timezone,venue,id,likes,comments&access_token=' . $access_token . $cff_ssl; //Don't use caching if the cache time is set to zero if ($cff_cache_time != 0) { // Get any existing copy of our transient data $transient_name = 'cff_tl_event_json_' . $eventID; if (false === ($event_json = get_transient($transient_name)) || $event_json === null) { //Get the contents of the Facebook page $event_json = cff_fetchUrl($event_json_url); //Cache the JSON set_transient($transient_name, $event_json, $cache_seconds); } else { $event_json = get_transient($transient_name); //If we can't find the transient then fall back to just getting the json from the api if ($event_json == false) { $event_json = cff_fetchUrl($event_json_url); } } } else { $event_json = cff_fetchUrl($event_json_url); } //Interpret data with JSON $event_object = json_decode($event_json); //Picture if ($cff_show_media) { $cff_event .= '<a title="' . $cff_facebook_link_text . '" class="cff-event-thumb" href="' . $link . '" ' . $target . $cff_nofollow . '><img src="https://graph.facebook.com/' . $eventID . '/picture?width=200&height=200" alt="' . $cff_facebook_link_text . '" /></a>'; } //Event date isset($event_object->start_time) ? $event_time = $event_object->start_time : ($event_time = ''); isset($event_object->end_time) ? $event_end_time = ' - <span class="cff-end-date">' . cff_eventdate(strtotime($event_object->end_time), $cff_event_date_formatting, $cff_event_date_custom) . '</span>' : ($event_end_time = ''); //If timezone migration is enabled then remove last 5 characters if (strlen($event_time) == 24) { $event_time = substr($event_time, 0, -5); } $cff_event_date = ''; if (!empty($event_time)) { $cff_event_date = '<p class="cff-date" ' . $cff_event_date_styles . '><span class="cff-start-date">' . cff_eventdate(strtotime($event_time), $cff_event_date_formatting, $cff_event_date_custom) . '</span>' . $event_end_time . '</p>'; } //EVENT //Display the event details $cff_event .= '<div class="cff-details">'; //show event date above title if ($cff_event_date_position == 'above') { $cff_event .= $cff_event_date; } //Show event title if ($cff_show_event_title && !empty($event_object->name)) { if ($cff_event_title_link) { $cff_event .= '<a href="' . $link . '" ' . $target . $cff_nofollow . '>'; } $cff_event .= '<' . $cff_event_title_format . ' ' . $cff_event_title_styles . '>' . $event_object->name . '</' . $cff_event_title_format . '>'; if ($cff_event_title_link) { $cff_event .= '</a>'; } } //show event date below title if ($cff_event_date_position !== 'above') { $cff_event .= $cff_event_date; } //Show event details if ($cff_show_event_details) { //Location if (!empty($event_object->location)) { $cff_event .= '<p class="cff-where" ' . $cff_event_details_styles . '>' . $event_object->location . '</p>'; } //Description if (!empty($event_object->description)) { $description = $event_object->description; if (!empty($body_limit)) { if (strlen($description) > $body_limit) { $description = substr($description, 0, $body_limit) . '...'; } } $cff_event .= '<p class="cff-info" ' . $cff_event_details_styles . '>' . cff_autolink($description, $link_color = $cff_event_link_color) . '</p>'; } } $cff_event .= '</div>'; } } //MEDIA $cff_media = ''; //If it's a photo or a Featured post which is an image if ($news->type == 'photo' || $news->type == 'offer' || $cff_featured_post_active && !empty($atts['featuredpost']) && isset($news->images)) { if ($cff_post_type == 'offer' && !empty($news->picture)) { $picture = $news->picture; /*If the image doesn't have a _b version then the URL looks like this: http://photos-h.ak.fbcdn.net/hphotos-ak-prn1/v/1600273_348160658659104_383135394_s.jpg?oh=23124db338cd899962fa7fb2d7285306&oe=52D5F9BE&__gda__=1389770591_64da0df3e725ca2d1fd026b0e922c58b So check for this kind of string below and don't replace _s. with _b. */ $bigjpg = '_s.jpg?'; $bigpng = '_s.png?'; $biggif = '_s.gif?'; $bigbmp = '_s.bmp?'; $bigtjpg = '_t.jpg?'; $bigtpng = '_t.png?'; $bigtgif = '_t.gif?'; $bigtbmp = '_t.bmp?'; $imagecheck1 = stripos($picture, $bigjpg); $imagecheck2 = stripos($picture, $bigpng); $imagecheck3 = stripos($picture, $biggif); $imagecheck4 = stripos($picture, $bigbmp); $imagecheck5 = stripos($picture, $bigtjpg); $imagecheck6 = stripos($picture, $bigtpng); $imagecheck7 = stripos($picture, $bigtgif); $imagecheck8 = stripos($picture, $bigtbmp); if (!($imagecheck1 || $imagecheck2 || $imagecheck3 || $imagecheck4 || $imagecheck5 || $imagecheck6 || $imagecheck7 || $imagecheck8)) { //Show larger image $picture = str_replace('_s.', '_b.', $picture); $picture = str_replace('_q.', '_b.', $picture); $picture = str_replace('_t.', '_b.', $picture); } } if ($cff_facebook_link_text == '') { $cff_facebook_link_text = 'View on Facebook'; } $link_text = $cff_facebook_link_text; $cff_media = '<a title="' . $link_text . '" class="cff-photo'; if ($cff_media_position == 'above') { $cff_media .= ' cff-media-above'; } $cff_media .= '" href="'; //If it's an album then link the photo to the album if ($cff_album) { $link = $album_link; } //If it's a shared post then change the link to use the Post ID so that it links to the shared post and not the original post that's being shared if (isset($news->status_type)) { if ($news->status_type == 'shared_story') { $link = "https://www.facebook.com/" . $cff_post_id; } } $cff_media .= $link . '" ' . $target . $cff_nofollow . '>'; //Alt text isset($news->caption) ? $cff_alt_text = strip_tags($news->caption) : ($cff_alt_text = $cff_facebook_link_text); // if ($cff_album && $num_photos > 1) $cff_media .= '<div class="cff-album-icon">'.$num_photos.'</div>'; if ($cff_album) { $cff_media .= '<div class="cff-album-icon"></div>'; } $cff_media .= '<img src="' . $picture . '" alt="' . $cff_alt_text . '" />'; $cff_media .= '</a>'; } if ($news->type == 'swf') { if (!empty($news->picture)) { $picture = $news->picture; /*If the image doesn't have a _b version then the URL looks like this: http://photos-h.ak.fbcdn.net/hphotos-ak-prn1/v/1600273_348160658659104_383135394_s.jpg?oh=23124db338cd899962fa7fb2d7285306&oe=52D5F9BE&__gda__=1389770591_64da0df3e725ca2d1fd026b0e922c58b So check for this kind of string below and don't replace _s. with _b. */ $bigjpg = '_s.jpg?'; $bigpng = '_s.png?'; $biggif = '_s.gif?'; $bigbmp = '_s.bmp?'; $bigtjpg = '_t.jpg?'; $bigtpng = '_t.png?'; $bigtgif = '_t.gif?'; $bigtbmp = '_t.bmp?'; $imagecheck1 = stripos($picture, $bigjpg); $imagecheck2 = stripos($picture, $bigpng); $imagecheck3 = stripos($picture, $biggif); $imagecheck4 = stripos($picture, $bigbmp); $imagecheck5 = stripos($picture, $bigtjpg); $imagecheck6 = stripos($picture, $bigtpng); $imagecheck7 = stripos($picture, $bigtgif); $imagecheck8 = stripos($picture, $bigtbmp); if (!($imagecheck1 || $imagecheck2 || $imagecheck3 || $imagecheck4 || $imagecheck5 || $imagecheck6 || $imagecheck7 || $imagecheck8)) { //Show larger image $picture = str_replace('_s.', '_b.', $picture); $picture = str_replace('_q.', '_b.', $picture); $picture = str_replace('_t.', '_b.', $picture); } } $cff_swf_url = 'http://www.facebook.com/permalink.php?story_fbid=' . $PostID["1"] . '&id=' . $PostID['0']; $cff_media = '<a href="' . $cff_swf_url . '" class="cff-photo'; if ($cff_media_position == 'above') { $cff_media .= ' cff-media-above'; } $cff_media .= '" ' . $target . $cff_nofollow . '><img src="' . $picture . '" /></a>'; } if ($news->type == 'video' && !$cff_soundcloud) { if (!empty($news->picture)) { $picture = $news->picture; // $object_id = $news->object_id; // $picture = 'https://graph.facebook.com/'.$object_id.'/picture?type=normal&width=9999&height=9999'; /*If the image doesn't have a _b version then the URL looks like this: http://photos-h.ak.fbcdn.net/hphotos-ak-prn1/v/1600273_348160658659104_383135394_s.jpg?oh=23124db338cd899962fa7fb2d7285306&oe=52D5F9BE&__gda__=1389770591_64da0df3e725ca2d1fd026b0e922c58b So check for this kind of string below and don't replace _s. with _b. */ $bigjpg = '_s.jpg?'; $bigpng = '_s.png?'; $biggif = '_s.gif?'; $bigbmp = '_s.bmp?'; $bigtjpg = '_t.jpg?'; $bigtpng = '_t.png?'; $bigtgif = '_t.gif?'; $bigtbmp = '_t.bmp?'; $imagecheck1 = stripos($picture, $bigjpg); $imagecheck2 = stripos($picture, $bigpng); $imagecheck3 = stripos($picture, $biggif); $imagecheck4 = stripos($picture, $bigbmp); $imagecheck5 = stripos($picture, $bigtjpg); $imagecheck6 = stripos($picture, $bigtpng); $imagecheck7 = stripos($picture, $bigtgif); $imagecheck8 = stripos($picture, $bigtbmp); if (!($imagecheck1 || $imagecheck2 || $imagecheck3 || $imagecheck4 || $imagecheck5 || $imagecheck6 || $imagecheck7 || $imagecheck8)) { //Show larger image $picture = str_replace('_s.', '_b.', $picture); $picture = str_replace('_q.', '_b.', $picture); $picture = str_replace('_t.', '_b.', $picture); } } // url of video $url = $news->source; //Check whether it's a youtube video if ($youtube || $youtu || $youtubeembed) { //Get the unique video id from the url by matching the pattern if ($youtube || $youtubeembed) { if (preg_match("/v=([^&]+)/i", $url, $matches)) { $id = $matches[1]; } elseif (preg_match("/\\/v\\/([^&]+)/i", $url, $matches)) { $id = $matches[1]; } elseif (preg_match("/\\/embed\\/([^&]+)/i", $url, $matches)) { $id = $matches[1]; } } elseif ($youtu) { $id = end(explode('/', $url)); } $id = substr($id, 0, strrpos($id, '?')); // this is your template for generating embed codes $code = '<iframe class="youtube-player" type="text/html" src="https://www.youtube.com/embed/{id}" allowfullscreen></iframe>'; // we replace each {id} with the actual ID of the video to get embed code for this particular video $code = str_replace('{id}', $id, $code); $cff_media_video = '<div class="cff-iframe-wrap" data-poster="' . $picture . '"'; if (!empty($cff_video_height)) { $cff_media_video .= 'style="height: ' . $cff_video_height . '"'; } $cff_media_video .= '>'; if ($cff_video_action == 'facebook') { $cff_media_video .= '<a href="http://facebook.com/' . $cff_post_id . '" target="_blank" class="cff-media-overlay"></a>'; } $cff_media_video .= $code . '</div>'; //Check whether it's a vimeo } else { if (stripos($url, $vimeo) !== false) { if (isset($news->source)) { $clip_id = ''; //http://vimeo.com/moogaloop.swf?clip_id=101557016&autoplay=1 $query = parse_url($news->source, PHP_URL_QUERY); parse_str($query, $params); if (isset($params['clip_id'])) { $clip_id = $params['clip_id']; } //https://player.vimeo.com/video/116446625?autoplay=1 if (!isset($clip_id) || $clip_id == '') { $vimeo_url = strtok($news->source, '?'); $clip_id = end(explode('/', $vimeo_url)); } $cff_media_video = '<div class="cff-iframe-wrap" data-poster="' . $picture . '"'; if (!empty($cff_video_height)) { $cff_media_video .= 'style="height: ' . $cff_video_height . '"'; } $cff_media_video .= '>'; if ($cff_video_action == 'facebook') { $cff_media_video .= '<a href="http://facebook.com/' . $cff_post_id . '" target="_blank" class="cff-media-overlay"></a>'; } $cff_media_video .= '<iframe src="https://player.vimeo.com/video/' . $clip_id . '" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>'; } //Else link to the video file } else { //Show play button over video thumbnail $vid_link = $news->source; //Check whether the video source contains an mp4, as the HTML5 video player can't play any other type $cff_mp4_check = stripos($vid_link, '.mp4'); if ($cff_video_action == 'facebook' && $cff_disable_lightbox) { $vid_link = $link; } //Title & alt text isset($news->name) ? $vid_title = $news->name : ($vid_title = $cff_facebook_link_text); if (empty($picture)) { $cff_is_video_embed = true; $cff_media_video = '<a class="cff-playbtn-solo" title="' . $vid_title . '" href="' . $vid_link . '" target="_blank"><i class="fa fa-play cff-playbtn no-poster"></i></a>'; } isset($news->full_picture) && !empty($news->full_picture) ? $poster = $news->full_picture : ($poster = $picture); //Check to see whether it's a swf file and if it is then load it into an iframe in the lightbox stripos($url, $swf) !== false ? $swf_file = true : ($swf_file = false); //If the video action is file then add the HTML5 video tags $cff_media_video = ''; if ($cff_video_action !== 'facebook' && $cff_mp4_check || !$cff_disable_lightbox) { $cff_media_video .= '<div class="cff-html5-video'; if ($swf_file) { $cff_media_video .= ' cff-swf'; } $cff_media_video .= '"><a href="http://facebook.com/' . $cff_post_id . '" class="cff-html5-play"><i class="fa fa-play cff-playbtn"></i></a><video src="' . $vid_link . '" poster="' . $poster . '" >'; } $cff_media_video .= '<a title="' . $vid_title . '" class="cff-vidLink" href="' . $link . '" ' . $target . $cff_nofollow . '><i class="fa fa-play cff-playbtn"></i><img class="cff-poster" src="' . $poster . '" alt="' . $vid_title . '" /></a>'; if ($cff_video_action !== 'facebook' && $cff_mp4_check || !$cff_disable_lightbox) { $cff_media_video .= '</video></div>'; } } } //Add video to HTML $cff_media = $cff_media_video; //Add the name to the description if it's a video embed if ($cff_is_video_embed) { $cff_description = '<div class="cff-desc-wrap '; if (empty($picture)) { $cff_description .= 'cff-no-image'; } $cff_description .= '"><' . $cff_link_title_format . ' class="cff-link-title" ' . $cff_link_title_styles . '><a href="' . $link . '" ' . $target . $cff_nofollow . ' style="color:#' . $cff_link_title_color . ';">' . $news->name . '</a></' . $cff_link_title_format . '>'; if (!empty($body_limit)) { if (strlen($description_text) > $body_limit) { $description_text = substr($description_text, 0, $body_limit) . '...'; } } $cff_description .= '<p class="cff-post-desc" ' . $cff_body_styles . '><span>' . cff_autolink(htmlspecialchars($description_text), $link_color = $cff_posttext_link_color) . ' </span></p></div>'; } } //META //how many comments are there? $comment_count = 0; $comment_count_display = '0'; //Save the original $news object to a variable so can use it after the comments section $news_event = $news; //If it's a timeline event then switch to the event_object variable which contains the comments if ($cff_post_type == 'event') { $news = $event_object; } if (!empty($news->comments)) { $comment_count = count($news->comments->data); $comment_count_display = $comment_count; if ($comment_count > 20) { //If count is more than 20 then it could be in the cached array $item_arr_name = $cff_post_id . '_comments'; //If the transient doesn't exist if (false === ($cff_cached_meta = get_transient('cff_meta'))) { $comment_count_display = '<div class="cff-loader fa-spin"></div><span class="cff-replace">20+</span>'; } else { if (empty($cff_cached_meta[$item_arr_name])) { $comment_count_display = '<div class="cff-loader fa-spin"></div><span class="cff-replace">20+</span>'; } else { //load corresponding count from array in transient $comment_count_display = $cff_cached_meta[$item_arr_name]; } } } } $cff_meta_total = '<div class="cff-meta-wrap">'; //Check for likes $cff_meta = ''; $cff_meta .= '<a href="javaScript:void(0);" class="cff-view-comments" ' . $cff_meta_styles . ' id="' . $orig_post_id . '"><ul class="cff-meta '; $cff_meta .= $cff_icon_style; $cff_meta .= '"><li class="cff-likes"><span class="cff-icon">Likes:</span> <span class="cff-count">'; //How many likes are there? if (!empty($news->likes)) { $like_count = count($news->likes->data); } else { $like_count = '0'; } //If there is no likes then display zero if ($like_count == 0) { $cff_meta .= '0'; } else { if ($like_count < 25) { $cff_meta .= $like_count; } else { //If count is more than 20 then it could be in the cached array $item_arr_name = $cff_post_id . '_likes'; //If the transient doesn't exist if (false === ($cff_cached_meta = get_transient('cff_meta'))) { $cff_meta .= '<div class="cff-loader fa-spin"></div><span class="cff-replace">' . $like_count . '+</span>'; } else { if (empty($cff_cached_meta[$item_arr_name])) { $cff_meta .= '<div class="cff-loader fa-spin"></div><span class="cff-replace">' . $like_count . '+</span>'; } else { //load corresponding count from array in transient //like_count var is also used in the -2 line inside the comments box $like_count = $cff_cached_meta[$item_arr_name]; $cff_meta .= $like_count; } } } } //Check for shares $cff_meta .= '</span></li><li class="cff-shares"><span class="cff-icon">Shares:</span> <span class="cff-count">'; if (empty($news->shares->count)) { $cff_meta .= '0'; } else { $cff_meta .= $news->shares->count; } //Check for comments $cff_meta .= '</span></li><li class="cff-comments"><span class="cff-icon">Comments:</span> <span class="cff-count">'; //How many comments are there? $cff_meta .= $comment_count_display; $cff_meta .= '</span></li></ul></a>'; //Display the link to the Facebook post or external link $cff_link = ''; //Default link $cff_viewpost_class = 'cff-viewpost-facebook'; if ($cff_facebook_link_text == '') { $cff_facebook_link_text = 'View on Facebook'; } $link_text = $cff_facebook_link_text; //Link to the Facebook post if it's a link or a video if ($cff_post_type == 'link' || $cff_post_type == 'video') { $link = "https://www.facebook.com/" . $page_id . "/posts/" . $PostID[1]; } //If Featured Post extension then change the $link var based on whether a full or half post ID is used if ($cff_featured_post_active && !empty($atts['featuredpost'])) { //If the post type is a link or a video (other link types have the link included in the JSON) if ($cff_post_type == 'link' || $cff_post_type == 'video') { if (stripos($cff_post_id, '_') !== false) { //If using the full post ID with an underscore then create the link like this: $link = "https://www.facebook.com/" . $PostID[0] . "/posts/" . $PostID[1]; } else { //If just using the short ID then create the link like this: $link = "https://www.facebook.com/" . $cff_post_id; } } } //If it's a shared post then change the link to use the Post ID so that it links to the shared post and not the original post that's being shared if (isset($news->status_type)) { if ($news->status_type == 'shared_story') { $link = "https://www.facebook.com/" . $cff_post_id; } } //Social media sharing URLs $cff_share_facebook = 'https://www.facebook.com/sharer/sharer.php?u=' . urlencode($link); $cff_share_twitter = 'https://twitter.com/intent/tweet?text=' . urlencode($link); $cff_share_google = 'https://plus.google.com/share?url=' . urlencode($link); $cff_share_linkedin = 'https://www.linkedin.com/shareArticle?mini=true&url=' . urlencode($link) . '&title=' . rawurlencode(strip_tags($cff_post_text)); $cff_share_email = 'mailto:?subject=Facebook&body=' . urlencode($link) . '%20-%20' . rawurlencode(strip_tags($cff_post_text)); //If it's an offer post then change the text if ($cff_post_type == 'offer') { $link_text = 'View Offer'; } //Create post action links HTML $cff_link = ''; if ($cff_show_facebook_link || $cff_show_facebook_share) { $cff_link .= '<div class="cff-post-links">'; //View on Facebook link if ($cff_show_facebook_link) { $cff_link .= '<a class="' . $cff_viewpost_class . '" href="' . $link . '" title="' . $link_text . '" ' . $target . $cff_nofollow . ' ' . $cff_link_styles . '>' . $link_text . '</a>'; } //Share link if ($cff_show_facebook_share) { $cff_link .= '<div class="cff-share-container">'; //Only show separating dot if both links are enabled if ($cff_show_facebook_link) { $cff_link .= '<span class="cff-dot" ' . $cff_link_styles . '>·</span>'; } $cff_link .= '<a class="cff-share-link" href="javascript:void(0);" title="' . $cff_facebook_share_text . '" ' . $cff_link_styles . '>' . $cff_facebook_share_text . '</a>'; $cff_link .= "<p class='cff-share-tooltip'><a href='" . $cff_share_facebook . "' target='_blank' class='cff-facebook-icon'><i class='fa fa-facebook-square'></i></a><a href='" . $cff_share_twitter . "' target='_blank' class='cff-twitter-icon'><i class='fa fa-twitter'></i></a><a href='" . $cff_share_google . "' target='_blank' class='cff-google-icon'><i class='fa fa-google-plus'></i></a><a href='" . $cff_share_linkedin . "' target='_blank' class='cff-linkedin-icon'><i class='fa fa-linkedin'></i></a><a href='" . $cff_share_email . "' target='_blank' class='cff-email-icon'><i class='fa fa-envelope'></i></a><i class='fa fa-play fa-rotate-90'></i></p></div>"; } $cff_link .= '</div>'; } //Compile the meta and link if included if ($cff_show_link) { $cff_meta_total .= $cff_link; } if ($cff_show_meta) { $cff_meta_total .= $cff_meta; } $cff_meta_total .= '</div>'; $cff_comments = ''; //Get custom text strings $cff_translate_view_previous_comments_text = $atts['previouscommentstext']; $cff_translate_comment_on_facebook_text = $atts['commentonfacebooktext']; $cff_translate_likes_this_text = $atts['likesthistext']; $cff_translate_like_this_text = $atts['likethistext']; $cff_translate_and_text = $atts['andtext']; $cff_translate_other_text = $atts['othertext']; $cff_translate_others_text = $atts['otherstext']; if (!isset($cff_translate_view_previous_comments_text) || empty($cff_translate_view_previous_comments_text)) { $cff_translate_view_previous_comments_text = 'View previous comments'; } if (!isset($cff_translate_comment_on_facebook_text) || empty($cff_translate_comment_on_facebook_text)) { $cff_translate_comment_on_facebook_text = 'Comment on Facebook'; } if (!isset($cff_translate_likes_this_text) || empty($cff_translate_likes_this_text)) { $cff_translate_likes_this_text = 'likes this'; } if (!isset($cff_translate_like_this_text) || empty($cff_translate_like_this_text)) { $cff_translate_like_this_text = 'like this'; } if (!isset($cff_translate_and_text) || empty($cff_translate_and_text)) { $cff_translate_and_text = 'and'; } if (!isset($cff_translate_other_text) || empty($cff_translate_other_text)) { $cff_translate_other_text = 'other'; } if (!isset($cff_translate_others_text) || empty($cff_translate_others_text)) { $cff_translate_others_text = 'others'; } //Create the comments box $cff_comments .= '<div class="cff-comments-box ' . $cff_icon_style; if ($comment_count == 0 || $cff_comments_num == 0) { $cff_comments .= ' cff-no-comments'; } $cff_comments .= '"'; //Expand comments box initially if ($cff_expand_comments) { $cff_comments .= ' style="display: block;"'; } //Number of comments to show initially $cff_comments .= ' data-num="' . $cff_comments_num . '"'; $cff_comments .= '>'; //Get the likes if (!empty($news->likes->data)) { $liker_one = ''; $liker_two = ''; if ($news->likes->data[0]) { $liker_one = '<a href="https://facebook.com/' . $news->likes->data[0]->id . '" ' . $cff_meta_link_color . ' ' . $target . $cff_nofollow . '>' . $news->likes->data[0]->name . '</a>'; } if ($like_count > 1) { $liker_two = '<a href="https://facebook.com/' . $news->likes->data[1]->id . '" ' . $cff_meta_link_color . ' ' . $target . $cff_nofollow . '>' . $news->likes->data[1]->name . '</a>'; } if ($like_count > 0) { $cff_comments .= '<p class="cff-comment-likes cff-likes" ' . $cff_meta_styles . '><span class="cff-icon"></span>'; } if ($like_count == 1) { $cff_comments .= $liker_one . ' ' . $cff_translate_likes_this_text; } else { if ($like_count == 2) { $cff_comments .= $liker_one . ' ' . $cff_translate_and_text . ' ' . $liker_two . ' ' . $cff_translate_like_this_text; } else { if ($like_count == 3) { $cff_comments .= $liker_one . ', ' . $liker_two . ' ' . $cff_translate_and_text . ' 1 ' . $cff_translate_other_text . ' ' . $cff_translate_like_this_text; } else { $cff_comments .= $liker_one . ', ' . $liker_two . ' ' . $cff_translate_and_text . ' '; if ($like_count == 25) { $cff_comments .= '<span class="cff-comment-likes-count">'; } $cff_comments .= intval($like_count) - 2; if ($like_count == 25) { $cff_comments .= '</span>'; } $cff_comments .= ' ' . $cff_translate_others_text . ' ' . $cff_translate_like_this_text; } } } if ($like_count > 0) { $cff_comments .= '</p>'; } } //Show more comments if ($comment_count > $cff_comments_num) { $cff_comments .= '<p class="cff-comments cff-show-more-comments" ' . $cff_meta_styles . '><a href="javascript:void(0);" ' . $cff_meta_link_color . '><span class="cff-icon"></span>' . $cff_translate_view_previous_comments_text . '</a></p>'; } //Get the comments if (!empty($news->comments->data)) { //Give the comment an index so we know which one it is $comment_index = 0; //Loop through comments foreach ($news->comments->data as $comment_item) { $comment_likes = $comment_item->like_count; $comment = htmlspecialchars($comment_item->message); //MESSAGE TAGS if ($cff_post_tags && isset($comment_item->message_tags)) { //Loop through the tags and use the name to replace them foreach ($comment_item->message_tags as $message_tag) { $tag_name = $message_tag->name; $tag_link = '<a href="http://facebook.com/' . $message_tag->id . '" ' . $target . $cff_nofollow . ' ' . $cff_meta_link_color . '>' . $message_tag->name . '</a>'; $comment = str_replace($tag_name, $tag_link, $comment); } } //END MESSAGE TAGS //Create comments $cff_comments .= '<div class="cff-comment" id="cff_' . $comment_item->from->id . '" data-id="' . $comment_item->from->id . '" ' . $cff_meta_styles . '>'; $cff_comments .= '<div class="cff-comment-text-wrapper">'; $cff_comments .= '<div class="cff-comment-text'; if ($cff_hide_comment_avatars) { $cff_comments .= ' cff-no-image'; } $cff_comments .= '"><p><a href="https://facebook.com/' . $comment_item->from->id . '" class="cff-name" ' . $target . $cff_nofollow . ' ' . $cff_meta_link_color . '>' . $comment_item->from->name . '</a>' . cff_autolink($comment, $link_color = str_replace('#', '', $atts['sociallinkcolor'])) . '</p>'; //Add image attachment if exists if (isset($comment_item->attachment)) { $cff_comments .= '<a class="cff-comment-attachment" href="' . $comment_item->attachment->url . '" target="_blank"><img src="' . $comment_item->attachment->media->image->src . '" alt="' . $comment_item->attachment->title . '" /></a>'; } $cff_comments .= '<span class="cff-time">'; $cff_comments .= cff_timeSince(strtotime($comment_item->created_time)) . ' ' . $cff_date_after; if ($comment_likes > 0) { $cff_comments .= '<span class="cff-comment-likes"> · <b></b>' . $comment_likes . '</span>'; } $cff_comments .= '</span>'; $cff_comments .= '</div>'; //End .cff-comment-text $cff_comments .= '</div>'; //End .cff-comment-text-wrapper $cff_comments .= '<div class="cff-comment-img"><a href="https://facebook.com/' . $comment_item->from->id . '" ' . $target . $cff_nofollow . '>'; //Only load the comment avatars if they're being displayed initially, otherwise load via JS on click if (!$cff_hide_comment_avatars) { if ($cff_expand_comments && $comment_index >= $comment_count - $cff_comments_num) { $cff_comments .= '<img src="https://graph.facebook.com/' . $comment_item->from->id . '/picture" width=32 height=32 alt="' . $comment_item->from->name . '">'; } else { $cff_comments .= '<img src="' . plugins_url('/img/avatar.png', __FILE__) . '" width=32 height=32 alt="Avatar">'; } } $cff_comments .= '</a></div>'; $cff_comments .= '</div>'; //End .cff-comment $comment_index++; } } $cff_comments .= '<p class="cff-comments cff-comment-on-facebook" ' . $cff_meta_styles . '><a href="' . $link . '" ' . $target . $cff_nofollow . ' ' . $cff_meta_link_color . '><span class="cff-icon"></span>' . $cff_translate_comment_on_facebook_text . '</a></p>'; $cff_comments .= '</div>'; //Compile comments if meta is included if ($cff_show_meta) { $cff_meta_total .= $cff_comments; } //If it's an event then set the $news object back to the original posts data rather than the new event data object used to get the comments for the event if ($cff_post_type == 'event') { $news = $news_event; } //**************************// //***CREATE THE POST HTML***// //**************************// //Start the container $cff_post_item .= '<div class="cff-item '; if ($cff_post_type == 'link') { $cff_post_item .= 'cff-link-item'; } if ($cff_post_type == 'event') { $cff_post_item .= 'cff-timeline-event'; } if ($cff_post_type == 'photo') { $cff_post_item .= 'cff-photo-post'; } if ($cff_post_type == 'video' && !$cff_soundcloud) { $cff_post_item .= 'cff-video-post'; } if ($cff_soundcloud) { $cff_post_item .= 'cff-audio-post'; } if ($cff_is_video_embed) { $cff_post_item .= ' cff-embedded-video'; } if ($cff_post_type == 'swf') { $cff_post_item .= 'cff-swf-post'; } if ($cff_post_type == 'status') { $cff_post_item .= 'cff-status-post'; } if ($cff_post_type == 'offer') { $cff_post_item .= 'cff-offer-post'; } if ($cff_album) { $cff_post_item .= ' cff-album'; } if ($cff_post_bg_color_check) { $cff_post_item .= ' cff-box'; } $cff_post_item .= ' author-'; if (isset($news->from->name)) { $cff_post_item .= cff_to_slug($news->from->name); } $cff_post_item .= '" id="cff_' . $cff_post_id . '" ' . $cff_item_styles . '>'; //POST AUTHOR $cff_is_video_embed = false; if ($cff_is_video_embed) { if ($cff_show_author) { $cff_post_item .= $cff_author; } //DATE ABOVE if ($cff_show_date && $cff_date_position == 'above') { $cff_post_item .= $cff_date; } //If embedded video then show post text above the wrapper if ($cff_show_text) { $cff_post_item .= $cff_post_text; } $cff_post_item .= '<div class="cff-embed-wrap">'; } //Start text wrapper if (($cff_thumb_layout || $cff_half_layout) && !empty($news->picture) && $cff_post_type != 'event') { $cff_post_item .= '<div class="cff-text-wrapper">'; } //POST AUTHOR if ($cff_show_author && !$cff_is_video_embed) { $cff_post_item .= $cff_author; } //MEDIA if ($cff_show_media && $cff_media_position == 'above') { $cff_post_item .= $cff_media; } //DATE ABOVE if ($cff_show_date && $cff_date_position == 'above' && !$cff_is_video_embed) { $cff_post_item .= $cff_date; } //POST TEXT if ($cff_show_text && !$cff_is_video_embed) { $cff_post_item .= $cff_post_text; } //DESCRIPTION if ($cff_show_desc && $cff_post_type != 'offer' && $cff_post_type != 'link') { $cff_post_item .= $cff_description; } //LINK if ($cff_show_shared_links) { $cff_post_item .= $cff_shared_link; } //DATE BELOW if (!$cff_show_author && $cff_date_position == 'author' || $cff_show_date && $cff_date_position == 'below' && !$cff_is_video_embed) { if ($cff_show_date && $cff_post_type !== 'event') { $cff_post_item .= $cff_date; } } //End text wrapper if (($cff_thumb_layout || $cff_half_layout) && !empty($news->picture) && $cff_post_type != 'event') { $cff_post_item .= '</div>'; } //EVENT if ($cff_show_event_title || $cff_show_event_details) { $cff_post_item .= $cff_event; } //MEDIA if ($cff_show_media && $cff_media_position !== 'above') { $cff_post_item .= $cff_media; if ($cff_is_video_embed) { $cff_post_item .= '</div>'; } } //DATE BELOW if ($cff_show_date && $cff_date_position == 'below' && $cff_is_video_embed) { $cff_post_item .= $cff_date; } if ($cff_show_date && $cff_post_type == 'event' && ($cff_date_position == 'below' || $cff_date_position == 'author' && !$cff_show_author)) { $cff_post_item .= $cff_date; } //META if ($cff_show_meta || $cff_show_link) { $cff_post_item .= $cff_meta_total; } //End the post item $cff_post_item .= '</div>'; // $cff_post_item .= '<div class="cff-clear"></div>'; } // End !$cff_photos_only || albums only || album embed //ALBUMS ONLY if ($cff_albums_only && $cff_albums_source == 'photospage') { isset($news->link) ? $cff_album_link = $news->link : ($cff_album_link = ''); isset($news->name) ? $cff_album_name = $news->name : ($cff_album_name = ''); //Don't put this in for now as the description sometimes has @ markup in it which looks bad. eg: "on behalf of @[38494804824:274:Breakthrough Breast Cancer]." // isset($news->description) ? $cff_album_description = $news->description : $cff_album_description = $cff_album_name; $cff_show_post = true; //Get the filter string $cff_filter_string = $atts['filter']; if ($cff_filter_string != '') { //Explode it into multiples $cff_filter_strings_array = explode(',', $cff_filter_string); //Hide the post if both the post text and description don't contain the string $string_in_post_text = true; $string_in_desc = true; if (cff_stripos_arr($cff_album_name, $cff_filter_strings_array) === false) { $cff_show_post = false; } } $cff_exclude_string = $atts['exfilter']; if ($cff_exclude_string != '') { //Explode it into multiples $cff_exclude_strings_array = explode(',', $cff_exclude_string); //Hide the post if both the post text and description don't contain the string $string_in_post_text = false; $string_in_desc = false; if (cff_stripos_arr($cff_album_name, $cff_exclude_strings_array) !== false) { $cff_show_post = false; } } if ($cff_show_post) { //GROUP ALBUMS if ($cff_is_group) { //Cover photos aren't available for group albums $cff_post_item = '<div class="cff-album-item cff-albums-only cff-col-'; $cff_post_item .= $cff_album_cols; $cff_post_item .= '">'; $cff_post_item .= '<h4><a href="' . $cff_album_link . '" ' . $target . $cff_nofollow . '>' . $cff_album_name . '</a></h4>'; $cff_post_item .= '</div>'; //Group albums use 'created' instead of 'created_time' like other posts $post_time = $news->created; } else { isset($news->cover_photo) ? $thumb = 'https://graph.facebook.com/' . $news->cover_photo . '/picture' : ($thumb = ''); isset($news->count) ? $cff_album_count = $news->count : ($cff_album_count = ''); $cff_post_item = '<div class="cff-album-item cff-albums-only cff-col-'; $cff_post_item .= $cff_album_cols; $cff_post_item .= '" id="cff_' . $news->id . '">'; $cff_post_item .= '<a href="' . $cff_album_link . '" class="cff-album-cover" ' . $target . $cff_nofollow . '><img src="' . $thumb . '" alt="' . $cff_album_name . '" /></a>'; if ($cff_show_album_title || $cff_show_album_number) { $cff_post_item .= '<div class="cff-album-info">'; } if ($cff_show_album_title) { $cff_post_item .= '<h4><a href="' . $cff_album_link . '" ' . $target . $cff_nofollow . '>' . $cff_album_name . '</a></h4>'; } if ($cff_show_album_number && isset($news->count)) { $cff_post_item .= '<p>' . $cff_album_count . ' ' . $cff_translate_photos_text . '</p>'; } if ($cff_show_album_title || $cff_show_album_number) { $cff_post_item .= '</div>'; } $cff_post_item .= '</div>'; //If there's no photos in the album then don't show it if (!isset($news->cover_photo)) { $cff_post_item = ''; } } } } //ALBUM EMBED if ($cff_album_active && !empty($cff_album_id)) { isset($news->name) ? $cff_album_desc = $news->name : ($cff_album_desc = ''); $cff_show_post = true; //Get the filter string $cff_filter_string = $atts['filter']; if ($cff_filter_string != '') { //Explode it into multiples $cff_filter_strings_array = explode(',', $cff_filter_string); //Hide the post if both the post text and description don't contain the string $string_in_post_text = true; $string_in_desc = true; if (cff_stripos_arr($cff_album_desc, $cff_filter_strings_array) === false) { $cff_show_post = false; } } $cff_exclude_string = $atts['exfilter']; if ($cff_exclude_string != '') { //Explode it into multiples $cff_exclude_strings_array = explode(',', $cff_exclude_string); //Hide the post if both the post text and description don't contain the string $string_in_post_text = false; $string_in_desc = false; if (cff_stripos_arr($cff_album_desc, $cff_exclude_strings_array) !== false) { $cff_show_post = false; } } if ($cff_show_post) { $cff_post_item = '<div class="cff-album-item cff-col-'; $cff_post_item .= $cff_album_cols; $cff_post_item .= '" id="cff_' . $news->id . '">'; $cff_post_item .= '<a href="https://facebook.com/' . $news->id . '" class="cff-album-cover" ' . $target . $cff_nofollow . '><img src="' . $news->source . '" alt="' . $cff_album_desc . '" /></a>'; $cff_post_item .= '</div>'; $post_time = $i; } } //VIDEOS ONLY if ($cff_videos_only) { $cff_post_item = ''; if ($cff_show_post) { foreach ($news->format as $value) { //If there's a large image then use it if (isset($value->picture)) { $poster = $value->picture; //Otherwise use the small one } else { if (isset($news->picture)) { $poster = $news->picture; } else { $poster = ''; } } } isset($news->description) ? $description_text = $news->description : ($description_text = ''); isset($news->name) ? $video_name = $news->name : ($video_name = ''); $poster_alt = $video_name; if (!empty($video_name) && !empty($description_text)) { $poster_alt .= ' - '; } $poster_alt .= $description_text; $cff_post_item .= '<div class="cff-album-item cff-col-' . $cff_video_cols . '" id="cff_' . $news->id . '">'; $cff_post_item .= '<a href="" class="cff-album-cover cff-video" ' . $target . $cff_nofollow . ' id="' . $news->id . '" data-source="' . $news->source . '"><i class="fa fa-play cff-playbtn"></i><img src="' . $poster . '" alt="' . $poster_alt . '" /></a>'; if ($cff_show_video_name) { $cff_post_item .= '<div class="cff-album-info">'; } if ($cff_show_video_name && !empty($video_name)) { $cff_post_item .= '<h4><a href="http://facebook.com/' . $news->id . '" ' . $target . $cff_nofollow . '>' . $video_name . '</a></h4>'; } if ($cff_show_video_desc) { $cff_post_item .= '<p>' . substr($description_text, 0, 50); if (strlen($description_text) > 50) { $cff_post_item .= '...'; } $cff_post_item .= '</p>'; } if ($cff_show_video_name) { $cff_post_item .= '</div>'; } $cff_post_item .= '</div>'; $post_time = $i; } } //PHOTOS ONLY if ($cff_photos_only && empty($cff_album_id)) { //Get the caption !empty($news->caption) ? $cff_caption = htmlspecialchars($news->caption) : ($cff_caption = ' '); $cff_filter_string = $atts['filter']; $cff_show_post = true; if ($cff_filter_string != '') { //Explode it into multiples $cff_filter_strings_array = explode(',', $cff_filter_string); //Hide the post if both the post text and description don't contain the string $string_in_post_text = true; $string_in_desc = true; if (cff_stripos_arr($cff_caption, $cff_filter_strings_array) === false) { $cff_show_post = false; } } $cff_exclude_string = $atts['exfilter']; if ($cff_exclude_string != '') { //Explode it into multiples $cff_exclude_strings_array = explode(',', $cff_exclude_string); //Hide the post if both the post text and description don't contain the string $string_in_post_text = false; $string_in_desc = false; if (cff_stripos_arr($cff_caption, $cff_exclude_strings_array) !== false) { $cff_show_post = false; } } $cff_post_item = ''; if ($cff_show_post) { $cff_post_item .= '<div class="cff-album-item cff-col-' . $cff_photos_cols . '" id="cff_' . $news->pid . '">'; $cff_post_item .= '<a href="' . $news->link . '" class="cff-album-cover" ' . $target . $cff_nofollow . '><img src="' . $news->src_big . '" alt="' . $cff_caption . '" /></a>'; $cff_post_item .= '</div>'; } if ($cff_is_group) { //FOR GROUPS $post_time = $news->created; $cff_posts_array = cff_array_push_assoc_photos($cff_posts_array, $i, $cff_post_item, $post_time); } else { //FOR PAGES if ($i <= $show_posts) { $cff_content .= $cff_post_item; } } } else { //PUSH POSTS TO ARRAY $cff_posts_array = cff_array_push_assoc($cff_posts_array, $post_time, $cff_post_item); } } // End offset } // End post type check if (isset($news->message)) { $prev_post_message = $news->message; } if (isset($news->link)) { $prev_post_link = $news->link; } if (isset($news->description)) { $prev_post_description = $news->description; } } // End the loop if ($cff_photos_only) { //PHOTOS ONLY usort($cff_posts_array, 'sortByOrder'); } else { if ($cff_album_active && !empty($cff_album_id) || $cff_videos_only) { //ALBUM EMBED //Don't sort array. Display posts in their native order. } else { //Sort the array in reverse order (newest first) krsort($cff_posts_array); } } } // End ALL POSTS } // END PAGE_IDS LOOP //Output the posts array if ($cff_photos_only) { //PHOTOS ONLY $p = 0; foreach ($cff_posts_array as $post) { if ($p == $show_posts) { break; } $cff_content .= $post['post']; $p++; } } else { $p = 0; foreach ($cff_posts_array as $post) { if ($p == $show_posts) { break; } $cff_content .= $post; $p++; } } //Reset the timezone date_default_timezone_set($cff_orig_timezone); //Add the Like Box inside if ($cff_like_box_position == 'bottom' && $cff_show_like_box && !$cff_like_box_outside) { $cff_content .= $like_box; } /* Credit link */ $cff_show_credit = $atts['credit']; $cff_show_credit == 'true' || $cff_show_credit == 'on' ? $cff_show_credit = true : ($cff_show_credit = false); if ($cff_show_credit) { $cff_content .= '<p class="cff-credit"><a href="https://smashballoon.com/custom-facebook-feed/" target="_blank" style="color: #' . ($link_color = $cff_posttext_link_color . '" title="Smash Balloon Custom Facebook Feed WordPress Plugin"><img src="' . plugins_url('/img/smashballoon-tiny.png', __FILE__) . '" alt="Smash Balloon Custom Facebook Feed WordPress Plugin" />The Custom Facebook Feed plugin</a></p>'); } //End the feed $cff_content .= '</div>'; $cff_content .= '<div class="cff-clear"></div>'; //Add the Like Box outside if ($cff_like_box_position == 'bottom' && $cff_show_like_box && $cff_like_box_outside) { $cff_content .= $like_box; } //If the feed is loaded via Ajax then put the scripts into the shortcode itself $ajax_theme = $atts['ajax']; $ajax_theme == 'on' || $ajax_theme == 'true' || $ajax_theme == true ? $ajax_theme = true : ($ajax_theme = false); if ($atts['ajax'] == 'false') { $ajax_theme = false; } if ($ajax_theme) { $url = plugins_url(); $path = urlencode(ABSPATH); $cff_link_hashtags = $atts['linkhashtags']; $cff_link_hashtags == 'true' || $cff_link_hashtags == 'on' ? $cff_link_hashtags = 'true' : ($cff_link_hashtags = 'false'); if ($cff_title_link == 'true' || $cff_title_link == 'on') { $cff_link_hashtags = 'false'; } $cff_content .= '<script type="text/javascript">var cffsiteurl = "' . $url . '", cfflinkhashtags = "' . $cff_link_hashtags . '";</script>'; $cff_content .= '<script type="text/javascript" src="' . plugins_url('/js/cff-scripts.js?ver=' . CFFVER, __FILE__) . '"></script>'; } $cff_content .= '</div>'; if (isset($cff_posttext_link_color) && !empty($cff_posttext_link_color)) { $cff_content .= '<style>#cff .cff-post-text a{ color: #' . $cff_posttext_link_color . '; }</style>'; } //Return our feed HTML to display return $cff_content; }
function display_cff($atts) { //Style options $options = get_option('cff_style_settings'); //Create the types string to set as shortcode default $include_string = ''; if ($options['cff_show_author']) { $include_string .= 'author,'; } if ($options['cff_show_text']) { $include_string .= 'text,'; } if ($options['cff_show_desc']) { $include_string .= 'desc,'; } if ($options['cff_show_shared_links']) { $include_string .= 'sharedlinks,'; } if ($options['cff_show_date']) { $include_string .= 'date,'; } if ($options['cff_show_media']) { $include_string .= 'media,'; } if ($options['cff_show_event_title']) { $include_string .= 'eventtitle,'; } if ($options['cff_show_event_details']) { $include_string .= 'eventdetails,'; } if ($options['cff_show_meta']) { $include_string .= 'social,'; } if ($options['cff_show_link']) { $include_string .= 'link,'; } if ($options['cff_show_like_box']) { $include_string .= 'likebox,'; } //Pass in shortcode attrbutes $atts = shortcode_atts(array('accesstoken' => trim(get_option('cff_access_token')), 'id' => get_option('cff_page_id'), 'pagetype' => get_option('cff_page_type'), 'num' => get_option('cff_num_show'), 'limit' => get_option('cff_post_limit'), 'others' => '', 'showpostsby' => get_option('cff_show_others'), 'cachetime' => get_option('cff_cache_time'), 'cacheunit' => get_option('cff_cache_time_unit'), 'locale' => get_option('cff_locale'), 'ajax' => get_option('cff_ajax'), 'offset' => '', 'width' => isset($options['cff_feed_width']) ? $options['cff_feed_width'] : '', 'widthresp' => isset($options['cff_feed_width_resp']) ? $options['cff_feed_width_resp'] : '', 'height' => isset($options['cff_feed_height']) ? $options['cff_feed_height'] : '', 'padding' => isset($options['cff_feed_padding']) ? $options['cff_feed_padding'] : '', 'bgcolor' => isset($options['cff_bg_color']) ? $options['cff_bg_color'] : '', 'showauthor' => '', 'showauthornew' => isset($options['cff_show_author']) ? $options['cff_show_author'] : '', 'class' => isset($options['cff_class']) ? $options['cff_class'] : '', 'layout' => isset($options['cff_preset_layout']) ? $options['cff_preset_layout'] : '', 'include' => $include_string, 'exclude' => '', 'postbgcolor' => isset($options['cff_post_bg_color']) ? $options['cff_post_bg_color'] : '', 'postcorners' => isset($options['cff_post_rounded']) ? $options['cff_post_rounded'] : '', 'textformat' => isset($options['cff_title_format']) ? $options['cff_title_format'] : '', 'textsize' => isset($options['cff_title_size']) ? $options['cff_title_size'] : '', 'textweight' => isset($options['cff_title_weight']) ? $options['cff_title_weight'] : '', 'textcolor' => isset($options['cff_title_color']) ? $options['cff_title_color'] : '', 'textlinkcolor' => isset($options['cff_posttext_link_color']) ? $options['cff_posttext_link_color'] : '', 'textlink' => isset($options['cff_title_link']) ? $options['cff_title_link'] : '', 'posttags' => isset($options['cff_post_tags']) ? $options['cff_post_tags'] : '', 'linkhashtags' => isset($options['cff_link_hashtags']) ? $options['cff_link_hashtags'] : '', 'descsize' => isset($options['cff_body_size']) ? $options['cff_body_size'] : '', 'descweight' => isset($options['cff_body_weight']) ? $options['cff_body_weight'] : '', 'desccolor' => isset($options['cff_body_color']) ? $options['cff_body_color'] : '', 'linktitleformat' => isset($options['cff_link_title_format']) ? $options['cff_link_title_format'] : '', 'linktitlesize' => isset($options['cff_link_title_size']) ? $options['cff_link_title_size'] : '', 'linktitlecolor' => isset($options['cff_link_title_color']) ? $options['cff_link_title_color'] : '', 'linkurlcolor' => isset($options['cff_link_url_color']) ? $options['cff_link_url_color'] : '', 'linkbgcolor' => isset($options['cff_link_bg_color']) ? $options['cff_link_bg_color'] : '', 'linkbordercolor' => isset($options['cff_link_border_color']) ? $options['cff_link_border_color'] : '', 'disablelinkbox' => isset($options['cff_disable_link_box']) ? $options['cff_disable_link_box'] : '', 'authorsize' => isset($options['cff_author_size']) ? $options['cff_author_size'] : '', 'authorcolor' => isset($options['cff_author_color']) ? $options['cff_author_color'] : '', 'eventtitleformat' => isset($options['cff_event_title_format']) ? $options['cff_event_title_format'] : '', 'eventtitlesize' => isset($options['cff_event_title_size']) ? $options['cff_event_title_size'] : '', 'eventtitleweight' => isset($options['cff_event_title_weight']) ? $options['cff_event_title_weight'] : '', 'eventtitlecolor' => isset($options['cff_event_title_color']) ? $options['cff_event_title_color'] : '', 'eventtitlelink' => isset($options['cff_event_title_link']) ? $options['cff_event_title_link'] : '', 'eventdatesize' => isset($options['cff_event_date_size']) ? $options['cff_event_date_size'] : '', 'eventdateweight' => isset($options['cff_event_date_weight']) ? $options['cff_event_date_weight'] : '', 'eventdatecolor' => isset($options['cff_event_date_color']) ? $options['cff_event_date_color'] : '', 'eventdatepos' => isset($options['cff_event_date_position']) ? $options['cff_event_date_position'] : '', 'eventdateformat' => isset($options['cff_event_date_formatting']) ? $options['cff_event_date_formatting'] : '', 'eventdatecustom' => isset($options['cff_event_date_custom']) ? $options['cff_event_date_custom'] : '', 'eventdetailssize' => isset($options['cff_event_details_size']) ? $options['cff_event_details_size'] : '', 'eventdetailsweight' => isset($options['cff_event_details_weight']) ? $options['cff_event_details_weight'] : '', 'eventdetailscolor' => isset($options['cff_event_details_color']) ? $options['cff_event_details_color'] : '', 'eventlinkcolor' => isset($options['cff_event_link_color']) ? $options['cff_event_link_color'] : '', 'datepos' => isset($options['cff_date_position']) ? $options['cff_date_position'] : '', 'datesize' => isset($options['cff_date_size']) ? $options['cff_date_size'] : '', 'dateweight' => isset($options['cff_date_weight']) ? $options['cff_date_weight'] : '', 'datecolor' => isset($options['cff_date_color']) ? $options['cff_date_color'] : '', 'dateformat' => isset($options['cff_date_formatting']) ? $options['cff_date_formatting'] : '', 'datecustom' => isset($options['cff_date_custom']) ? $options['cff_date_custom'] : '', 'timezone' => isset($options['cff_timezone']) ? $options['cff_timezone'] : 'America/Chicago', 'linksize' => isset($options['cff_link_size']) ? $options['cff_link_size'] : '', 'linkweight' => isset($options['cff_link_weight']) ? $options['cff_link_weight'] : '', 'linkcolor' => isset($options['cff_link_color']) ? $options['cff_link_color'] : '', 'viewlinktext' => isset($options['cff_view_link_text']) ? $options['cff_view_link_text'] : '', 'linktotimeline' => isset($options['cff_link_to_timeline']) ? $options['cff_link_to_timeline'] : '', 'iconstyle' => isset($options['cff_icon_style']) ? $options['cff_icon_style'] : '', 'socialtextcolor' => isset($options['cff_meta_text_color']) ? $options['cff_meta_text_color'] : '', 'socialbgcolor' => isset($options['cff_meta_bg_color']) ? $options['cff_meta_bg_color'] : '', 'textlength' => get_option('cff_title_length'), 'desclength' => get_option('cff_body_length'), 'likeboxpos' => isset($options['cff_like_box_position']) ? $options['cff_like_box_position'] : '', 'likeboxoutside' => isset($options['cff_like_box_outside']) ? $options['cff_like_box_outside'] : '', 'likeboxcolor' => isset($options['cff_likebox_bg_color']) ? $options['cff_likebox_bg_color'] : '', 'likeboxtextcolor' => isset($options['cff_like_box_text_color']) ? $options['cff_like_box_text_color'] : '', 'likeboxwidth' => isset($options['cff_likebox_width']) ? $options['cff_likebox_width'] : '', 'likeboxheight' => isset($options['cff_likebox_height']) ? $options['cff_likebox_height'] : '', 'likeboxfaces' => isset($options['cff_like_box_faces']) ? $options['cff_like_box_faces'] : '', 'likeboxborder' => isset($options['cff_like_box_border']) ? $options['cff_like_box_border'] : '', 'likeboxcover' => isset($options['cff_like_box_cover']) ? $options['cff_like_box_cover'] : '', 'likeboxsmallheader' => isset($options['cff_like_box_small_header']) ? $options['cff_like_box_small_header'] : '', 'likeboxhidebtn' => isset($options['cff_like_box_hide_cta']) ? $options['cff_like_box_hide_cta'] : '', 'credit' => isset($options['cff_show_credit']) ? $options['cff_show_credit'] : '', 'nofollow' => 'true', 'disablestyles' => isset($options['cff_disable_styles']) ? $options['cff_disable_styles'] : '', 'showheader' => isset($options['cff_show_header']) ? $options['cff_show_header'] : '', 'headeroutside' => isset($options['cff_header_outside']) ? $options['cff_header_outside'] : '', 'headertext' => isset($options['cff_header_text']) ? $options['cff_header_text'] : '', 'headerbg' => isset($options['cff_header_bg_color']) ? $options['cff_header_bg_color'] : '', 'headerpadding' => isset($options['cff_header_padding']) ? $options['cff_header_padding'] : '', 'headertextsize' => isset($options['cff_header_text_size']) ? $options['cff_header_text_size'] : '', 'headertextweight' => isset($options['cff_header_text_weight']) ? $options['cff_header_text_weight'] : '', 'headertextcolor' => isset($options['cff_header_text_color']) ? $options['cff_header_text_color'] : '', 'headericon' => isset($options['cff_header_icon']) ? $options['cff_header_icon'] : '', 'headericoncolor' => isset($options['cff_header_icon_color']) ? $options['cff_header_icon_color'] : '', 'headericonsize' => isset($options['cff_header_icon_size']) ? $options['cff_header_icon_size'] : '', 'videoheight' => isset($options['cff_video_height']) ? $options['cff_video_height'] : '', 'videoaction' => isset($options['cff_video_action']) ? $options['cff_video_action'] : '', 'sepcolor' => isset($options['cff_sep_color']) ? $options['cff_sep_color'] : '', 'sepsize' => isset($options['cff_sep_size']) ? $options['cff_sep_size'] : '', 'seemoretext' => isset($options['cff_see_more_text']) ? stripslashes(esc_attr($options['cff_see_more_text'])) : '', 'seelesstext' => isset($options['cff_see_less_text']) ? stripslashes(esc_attr($options['cff_see_less_text'])) : '', 'photostext' => isset($options['cff_translate_photos_text']) ? stripslashes(esc_attr($options['cff_translate_photos_text'])) : '', 'facebooklinktext' => isset($options['cff_facebook_link_text']) ? stripslashes(esc_attr($options['cff_facebook_link_text'])) : '', 'sharelinktext' => isset($options['cff_facebook_share_text']) ? stripslashes(esc_attr($options['cff_facebook_share_text'])) : '', 'showfacebooklink' => isset($options['cff_show_facebook_link']) ? $options['cff_show_facebook_link'] : '', 'showsharelink' => isset($options['cff_show_facebook_share']) ? $options['cff_show_facebook_share'] : ''), $atts); /********** GENERAL **********/ $cff_page_type = $atts['pagetype']; $cff_page_type == 'group' ? $cff_is_group = true : ($cff_is_group = false); $cff_feed_width = $atts['width']; if (is_numeric(substr($cff_feed_width, -1, 1))) { $cff_feed_width = $cff_feed_width . 'px'; } //Set to be 100% width on mobile? $cff_feed_width_resp = $atts['widthresp']; $cff_feed_width_resp == 'on' || $cff_feed_width_resp == 'true' || $cff_feed_width_resp == true ? $cff_feed_width_resp = true : ($cff_feed_width_resp = false); if ($atts['widthresp'] == 'false') { $cff_feed_width_resp = false; } $cff_feed_height = $atts['height']; if (is_numeric(substr($cff_feed_height, -1, 1))) { $cff_feed_height = $cff_feed_height . 'px'; } $cff_feed_padding = $atts['padding']; if (is_numeric(substr($cff_feed_padding, -1, 1))) { $cff_feed_padding = $cff_feed_padding . 'px'; } $cff_bg_color = $atts['bgcolor']; $cff_show_author = $atts['showauthornew']; $cff_cache_time = $atts['cachetime']; $cff_locale = $atts['locale']; if (empty($cff_locale) || !isset($cff_locale) || $cff_locale == '') { $cff_locale = 'en_US'; } if (!isset($cff_cache_time)) { $cff_cache_time = 0; } $cff_cache_time_unit = $atts['cacheunit']; //Don't allow cache time to be zero - set to 1 minute instead to minimize API requests if (!isset($cff_cache_time) || $cff_cache_time == '0') { $cff_cache_time = 1; $cff_cache_time_unit = 'minutes'; } if ($cff_cache_time == 'none') { $cff_cache_time = 0; } $cff_class = $atts['class']; //Compile feed styles $cff_feed_styles = ''; if (!empty($cff_feed_width) || !empty($cff_feed_height) || !empty($cff_feed_padding) || !empty($cff_bg_color) && $cff_bg_color !== '#') { $cff_feed_styles = 'style="'; } if (!empty($cff_feed_width)) { $cff_feed_styles .= 'width:' . $cff_feed_width . '; '; } if (!empty($cff_feed_height)) { $cff_feed_styles .= 'height:' . $cff_feed_height . '; '; } if (!empty($cff_feed_padding)) { $cff_feed_styles .= 'padding:' . $cff_feed_padding . '; '; } if (!empty($cff_bg_color) && $cff_bg_color !== '#') { $cff_feed_styles .= 'background-color:#' . str_replace('#', '', $cff_bg_color) . '; '; } if (!empty($cff_feed_width) || !empty($cff_feed_height) || !empty($cff_feed_padding) || !empty($cff_bg_color) && $cff_bg_color !== '#') { $cff_feed_styles .= '"'; } //Like box $cff_like_box_position = $atts['likeboxpos']; $cff_like_box_outside = $atts['likeboxoutside']; //Open links in new window? $target = 'target="_blank"'; /********** POST TYPES **********/ $cff_show_links_type = true; $cff_show_event_type = true; $cff_show_video_type = true; $cff_show_photos_type = true; $cff_show_status_type = true; $cff_events_only = false; //Are we showing ONLY events? 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; } /********** LAYOUT **********/ $cff_includes = $atts['include']; //Look for non-plural version of string in the types string in case user specifies singular in shortcode $cff_show_author = false; $cff_show_text = false; $cff_show_desc = false; $cff_show_shared_links = false; $cff_show_date = false; $cff_show_media = false; $cff_show_event_title = false; $cff_show_event_details = false; $cff_show_meta = false; $cff_show_link = false; $cff_show_like_box = false; if (stripos($cff_includes, 'author') !== false) { $cff_show_author = true; } if (stripos($cff_includes, 'text') !== false) { $cff_show_text = true; } if (stripos($cff_includes, 'desc') !== false) { $cff_show_desc = true; } if (stripos($cff_includes, 'sharedlink') !== false) { $cff_show_shared_links = true; } if (stripos($cff_includes, 'date') !== false) { $cff_show_date = true; } if (stripos($cff_includes, 'media') !== false) { $cff_show_media = true; } if (stripos($cff_includes, 'eventtitle') !== false) { $cff_show_event_title = true; } if (stripos($cff_includes, 'eventdetail') !== false) { $cff_show_event_details = true; } if (stripos($cff_includes, 'social') !== false) { $cff_show_meta = true; } if (stripos($cff_includes, ',link') !== false) { $cff_show_link = true; } //comma used to separate it from 'sharedlinks' - which also contains 'link' string if (stripos($cff_includes, 'like') !== false) { $cff_show_like_box = true; } //Exclude string $cff_excludes = $atts['exclude']; //Look for non-plural version of string in the types string in case user specifies singular in shortcode if (stripos($cff_excludes, 'author') !== false) { $cff_show_author = false; } if (stripos($cff_excludes, 'text') !== false) { $cff_show_text = false; } if (stripos($cff_excludes, 'desc') !== false) { $cff_show_desc = false; } if (stripos($cff_excludes, 'sharedlink') !== false) { $cff_show_shared_links = false; } if (stripos($cff_excludes, 'date') !== false) { $cff_show_date = false; } if (stripos($cff_excludes, 'media') !== false) { $cff_show_media = false; } if (stripos($cff_excludes, 'eventtitle') !== false) { $cff_show_event_title = false; } if (stripos($cff_excludes, 'eventdetail') !== false) { $cff_show_event_details = false; } if (stripos($cff_excludes, 'social') !== false) { $cff_show_meta = false; } if (stripos($cff_excludes, ',link') !== false) { $cff_show_link = false; } //comma used to separate it from 'sharedlinks' - which also contains 'link' string if (stripos($cff_excludes, 'like') !== false) { $cff_show_like_box = false; } //Set free version to thumb layout by default as layout option not available on settings page $cff_preset_layout = 'thumb'; //If the old shortcode option 'showauthor' is being used then apply it $cff_show_author_old = $atts['showauthor']; if ($cff_show_author_old == 'false') { $cff_show_author = false; } if ($cff_show_author_old == 'true') { $cff_show_author = true; } /********** META **********/ $cff_icon_style = $atts['iconstyle']; $cff_meta_text_color = $atts['socialtextcolor']; $cff_meta_bg_color = $atts['socialbgcolor']; $cff_meta_styles = ''; if (!empty($cff_meta_text_color) || !empty($cff_meta_bg_color) && $cff_meta_bg_color !== '#') { $cff_meta_styles = 'style="'; } if (!empty($cff_meta_text_color)) { $cff_meta_styles .= 'color:#' . str_replace('#', '', $cff_meta_text_color) . ';'; } if (!empty($cff_meta_bg_color) && $cff_meta_bg_color !== '#') { $cff_meta_styles .= 'background-color:#' . str_replace('#', '', $cff_meta_bg_color) . ';'; } if (!empty($cff_meta_text_color) || !empty($cff_meta_bg_color) && $cff_meta_bg_color !== '#') { $cff_meta_styles .= '"'; } $cff_nocomments_text = isset($options['cff_nocomments_text']) ? $options['cff_nocomments_text'] : ''; $cff_hide_comments = isset($options['cff_hide_comments']) ? $options['cff_hide_comments'] : ''; if (!isset($cff_nocomments_text) || empty($cff_nocomments_text)) { $cff_hide_comments = true; } /********** TYPOGRAPHY **********/ //See More text $cff_see_more_text = $atts['seemoretext']; $cff_see_less_text = $atts['seelesstext']; //See Less text //Title $cff_title_format = $atts['textformat']; if (empty($cff_title_format)) { $cff_title_format = 'p'; } $cff_title_size = $atts['textsize']; $cff_title_weight = $atts['textweight']; $cff_title_color = $atts['textcolor']; $cff_title_styles = ''; if (!empty($cff_title_size) && $cff_title_size != 'inherit' || !empty($cff_title_weight) && $cff_title_weight != 'inherit' || !empty($cff_title_color) && $cff_title_color !== '#') { $cff_title_styles = 'style="'; } if (!empty($cff_title_size) && $cff_title_size != 'inherit') { $cff_title_styles .= 'font-size:' . $cff_title_size . 'px; '; } if (!empty($cff_title_weight) && $cff_title_weight != 'inherit') { $cff_title_styles .= 'font-weight:' . $cff_title_weight . '; '; } if (!empty($cff_title_color) && $cff_title_color !== '#') { $cff_title_styles .= 'color:#' . str_replace('#', '', $cff_title_color) . ';'; } if (!empty($cff_title_size) && $cff_title_size != 'inherit' || !empty($cff_title_weight) && $cff_title_weight != 'inherit' || !empty($cff_title_color) && $cff_title_color !== '#') { $cff_title_styles .= '"'; } $cff_title_link = $atts['textlink']; $cff_posttext_link_color = str_replace('#', '', $atts['textlinkcolor']); $cff_title_link == 'on' || $cff_title_link == 'true' || $cff_title_link == true ? $cff_title_link = true : ($cff_title_link = false); if ($atts['textlink'] == 'false') { $cff_title_link = false; } //Author $cff_author_size = $atts['authorsize']; $cff_author_color = $atts['authorcolor']; $cff_author_styles = ''; if (!empty($cff_author_size) && $cff_author_size != 'inherit' || !empty($cff_author_color) && $cff_author_color !== '#') { $cff_author_styles = 'style="'; } if (!empty($cff_author_size) && $cff_author_size != 'inherit') { $cff_author_styles .= 'font-size:' . $cff_author_size . 'px; '; } if (!empty($cff_author_color) && $cff_author_color !== '#') { $cff_author_styles .= 'color:#' . str_replace('#', '', $cff_author_color) . ';'; } if (!empty($cff_author_size) && $cff_author_size != 'inherit' || !empty($cff_author_color) && $cff_author_color !== '#') { $cff_author_styles .= '"'; } //Description $cff_body_size = $atts['descsize']; $cff_body_weight = $atts['descweight']; $cff_body_color = $atts['desccolor']; $cff_body_styles = ''; if (!empty($cff_body_size) && $cff_body_size != 'inherit' || !empty($cff_body_weight) && $cff_body_weight != 'inherit' || !empty($cff_body_color) && $cff_body_color !== '#') { $cff_body_styles = 'style="'; } if (!empty($cff_body_size) && $cff_body_size != 'inherit') { $cff_body_styles .= 'font-size:' . $cff_body_size . 'px; '; } if (!empty($cff_body_weight) && $cff_body_weight != 'inherit') { $cff_body_styles .= 'font-weight:' . $cff_body_weight . '; '; } if (!empty($cff_body_color) && $cff_body_color !== '#') { $cff_body_styles .= 'color:#' . str_replace('#', '', $cff_body_color) . ';'; } if (!empty($cff_body_size) && $cff_body_size != 'inherit' || !empty($cff_body_weight) && $cff_body_weight != 'inherit' || !empty($cff_body_color) && $cff_body_color !== '#') { $cff_body_styles .= '"'; } //Shared link title $cff_link_title_format = $atts['linktitleformat']; if (empty($cff_link_title_format)) { $cff_link_title_format = 'p'; } $cff_link_title_size = $atts['linktitlesize']; $cff_link_title_color = str_replace('#', '', $atts['linktitlecolor']); $cff_link_url_color = $atts['linkurlcolor']; $cff_link_title_styles = ''; if (!empty($cff_link_title_size) && $cff_link_title_size != 'inherit') { $cff_link_title_styles = 'style="font-size:' . $cff_link_title_size . 'px;"'; } //Shared link box $cff_link_bg_color = $atts['linkbgcolor']; $cff_link_border_color = $atts['linkbordercolor']; $cff_disable_link_box = $atts['disablelinkbox']; $cff_disable_link_box == 'true' || $cff_disable_link_box == 'on' ? $cff_disable_link_box = true : ($cff_disable_link_box = false); $cff_link_box_styles = ''; if (!empty($cff_link_border_color) || !empty($cff_link_bg_color) && $cff_link_bg_color !== '#') { $cff_link_box_styles = 'style="'; } if (!empty($cff_link_border_color)) { $cff_link_box_styles .= 'border: 1px solid #' . str_replace('#', '', $cff_link_border_color) . '; '; } if (!empty($cff_link_bg_color) && $cff_link_bg_color !== '#') { $cff_link_box_styles .= 'background-color: #' . str_replace('#', '', $cff_link_bg_color) . ';'; } if (!empty($cff_link_border_color) || !empty($cff_link_bg_color) && $cff_link_bg_color !== '#') { $cff_link_box_styles .= '"'; } //Event Title $cff_event_title_format = $atts['eventtitleformat']; if (empty($cff_event_title_format)) { $cff_event_title_format = 'p'; } $cff_event_title_size = $atts['eventtitlesize']; $cff_event_title_weight = $atts['eventtitleweight']; $cff_event_title_color = $atts['eventtitlecolor']; $cff_event_title_styles = ''; if (!empty($cff_event_title_size) && $cff_event_title_size != 'inherit' || !empty($cff_event_title_weight) && $cff_event_title_weight != 'inherit' || !empty($cff_event_title_color) && $cff_event_title_color !== '#') { $cff_event_title_styles = 'style="'; } if (!empty($cff_event_title_size) && $cff_event_title_size != 'inherit') { $cff_event_title_styles .= 'font-size:' . $cff_event_title_size . 'px; '; } if (!empty($cff_event_title_weight) && $cff_event_title_weight != 'inherit') { $cff_event_title_styles .= 'font-weight:' . $cff_event_title_weight . '; '; } if (!empty($cff_event_title_color) && $cff_event_title_color !== '#') { $cff_event_title_styles .= 'color:#' . str_replace('#', '', $cff_event_title_color) . ';'; } if (!empty($cff_event_title_size) && $cff_event_title_size != 'inherit' || !empty($cff_event_title_weight) && $cff_event_title_weight != 'inherit' || !empty($cff_event_title_color) && $cff_event_title_color !== '#') { $cff_event_title_styles .= '"'; } $cff_event_title_link = $atts['eventtitlelink']; $cff_event_title_link == 'on' || $cff_event_title_link == 'true' || $cff_event_title_link == true ? $cff_event_title_link = true : ($cff_event_title_link = false); if ($atts['eventtitlelink'] == 'false') { $cff_event_title_link = false; } //Event Date $cff_event_date_size = $atts['eventdatesize']; $cff_event_date_weight = $atts['eventdateweight']; $cff_event_date_color = $atts['eventdatecolor']; $cff_event_date_position = $atts['eventdatepos']; $cff_event_date_formatting = $atts['eventdateformat']; $cff_event_date_custom = $atts['eventdatecustom']; $cff_event_date_styles = ''; if (!empty($cff_event_date_size) && $cff_event_date_size != 'inherit' || !empty($cff_event_date_weight) && $cff_event_date_weight != 'inherit' || !empty($cff_event_date_color) && $cff_event_date_color !== '#') { $cff_event_date_styles = 'style="'; } if (!empty($cff_event_date_size) && $cff_event_date_size != 'inherit') { $cff_event_date_styles .= 'font-size:' . $cff_event_date_size . 'px; '; } if (!empty($cff_event_date_weight) && $cff_event_date_weight != 'inherit') { $cff_event_date_styles .= 'font-weight:' . $cff_event_date_weight . '; '; } if (!empty($cff_event_date_color) && $cff_event_date_color !== '#') { $cff_event_date_styles .= 'color:#' . str_replace('#', '', $cff_event_date_color) . ';'; } if (!empty($cff_event_date_size) && $cff_event_date_size != 'inherit' || !empty($cff_event_date_weight) && $cff_event_date_weight != 'inherit' || !empty($cff_event_date_color) && $cff_event_date_color !== '#') { $cff_event_date_styles .= '"'; } //Event Details $cff_event_details_size = $atts['eventdetailssize']; $cff_event_details_weight = $atts['eventdetailsweight']; $cff_event_details_color = $atts['eventdetailscolor']; $cff_event_link_color = $atts['eventlinkcolor']; $cff_event_details_styles = ''; if (!empty($cff_event_details_size) && $cff_event_details_size != 'inherit' || !empty($cff_event_details_weight) && $cff_event_details_weight != 'inherit' || !empty($cff_event_details_color) && $cff_event_details_color !== '#') { $cff_event_details_styles = 'style="'; } if (!empty($cff_event_details_size) && $cff_event_details_size != 'inherit') { $cff_event_details_styles .= 'font-size:' . $cff_event_details_size . 'px; '; } if (!empty($cff_event_details_weight) && $cff_event_details_weight != 'inherit') { $cff_event_details_styles .= 'font-weight:' . $cff_event_details_weight . '; '; } if (!empty($cff_event_details_color) && $cff_event_details_color !== '#') { $cff_event_details_styles .= 'color:#' . str_replace('#', '', $cff_event_details_color) . ';'; } if (!empty($cff_event_details_size) && $cff_event_details_size != 'inherit' || !empty($cff_event_details_weight) && $cff_event_details_weight != 'inherit' || !empty($cff_event_details_color) && $cff_event_details_color !== '#') { $cff_event_details_styles .= '"'; } //Date $cff_date_position = $atts['datepos']; if (!isset($cff_date_position)) { $cff_date_position = 'below'; } $cff_date_size = $atts['datesize']; $cff_date_weight = $atts['dateweight']; $cff_date_color = $atts['datecolor']; $cff_date_styles = ''; if (!empty($cff_date_size) && $cff_date_size != 'inherit' || !empty($cff_date_weight) && $cff_date_weight != 'inherit' || !empty($cff_date_color) && $cff_date_color !== '#') { $cff_date_styles = 'style="'; } if (!empty($cff_date_size) && $cff_date_size != 'inherit') { $cff_date_styles .= 'font-size:' . $cff_date_size . 'px; '; } if (!empty($cff_date_weight) && $cff_date_weight != 'inherit') { $cff_date_styles .= 'font-weight:' . $cff_date_weight . '; '; } if (!empty($cff_date_color) && $cff_date_color !== '#') { $cff_date_styles .= 'color:#' . str_replace('#', '', $cff_date_color) . ';'; } if (!empty($cff_date_size) && $cff_date_size != 'inherit' || !empty($cff_date_weight) && $cff_date_weight != 'inherit' || !empty($cff_date_color) && $cff_date_color !== '#') { $cff_date_styles .= '"'; } $cff_date_before = isset($options['cff_date_before']) ? $options['cff_date_before'] : ''; $cff_date_after = isset($options['cff_date_after']) ? $options['cff_date_after'] : ''; //Set user's timezone based on setting $cff_timezone = $atts['timezone']; $cff_orig_timezone = date_default_timezone_get(); date_default_timezone_set($cff_timezone); //Link to Facebook $cff_link_size = $atts['linksize']; $cff_link_weight = $atts['linkweight']; $cff_link_color = $atts['linkcolor']; $cff_link_styles = ''; if (!empty($cff_link_size) && $cff_link_size != 'inherit' || !empty($cff_link_weight) && $cff_link_weight != 'inherit' || !empty($cff_link_color) && $cff_link_color !== '#') { $cff_link_styles = 'style="'; } if (!empty($cff_link_size) && $cff_link_size != 'inherit') { $cff_link_styles .= 'font-size:' . $cff_link_size . 'px; '; } if (!empty($cff_link_weight) && $cff_link_weight != 'inherit') { $cff_link_styles .= 'font-weight:' . $cff_link_weight . '; '; } if (!empty($cff_link_color) && $cff_link_color !== '#') { $cff_link_styles .= 'color:#' . str_replace('#', '', $cff_link_color) . ';'; } if (!empty($cff_link_size) && $cff_link_size != 'inherit' || !empty($cff_link_weight) && $cff_link_weight != 'inherit' || !empty($cff_link_color) && $cff_link_color !== '#') { $cff_link_styles .= '"'; } //Link custom text $cff_facebook_link_text = $atts['facebooklinktext']; $cff_facebook_share_text = $atts['sharelinktext']; if ($cff_facebook_share_text == '') { $cff_facebook_share_text = 'Share'; } //Show Facebook link $cff_show_facebook_link = $atts['showfacebooklink']; $cff_show_facebook_link == 'on' || $cff_show_facebook_link == 'true' || $cff_show_facebook_link == true ? $cff_show_facebook_link = true : ($cff_show_facebook_link = false); if ($atts['showfacebooklink'] === 'false') { $cff_show_facebook_link = false; } //Show Share link $cff_show_facebook_share = $atts['showsharelink']; $cff_show_facebook_share == 'on' || $cff_show_facebook_share == 'true' || $cff_show_facebook_share == true ? $cff_show_facebook_share = true : ($cff_show_facebook_share = false); if ($atts['showsharelink'] === 'false') { $cff_show_facebook_share = false; } $cff_view_link_text = $atts['viewlinktext']; $cff_link_to_timeline = $atts['linktotimeline']; /********** MISC **********/ //Like Box styles $cff_likebox_bg_color = $atts['likeboxcolor']; $cff_like_box_text_color = $atts['likeboxtextcolor']; $cff_like_box_colorscheme = 'light'; if ($cff_like_box_text_color == 'white') { $cff_like_box_colorscheme = 'dark'; } $cff_likebox_width = $atts['likeboxwidth']; if (is_numeric(substr($cff_likebox_width, -1, 1))) { $cff_likebox_width = $cff_likebox_width . 'px'; } $cff_likebox_height = $atts['likeboxheight']; $cff_likebox_height = preg_replace('/px$/', '', $cff_likebox_height); if (!isset($cff_likebox_width) || empty($cff_likebox_width) || $cff_likebox_width == '') { $cff_likebox_width = '100%'; } $cff_like_box_faces = $atts['likeboxfaces']; if (!isset($cff_like_box_faces) || empty($cff_like_box_faces)) { $cff_like_box_faces = 'false'; } else { $cff_like_box_faces = 'true'; } $cff_like_box_border = $atts['likeboxborder']; if ($cff_like_box_border) { $cff_like_box_border = 'true'; } else { $cff_like_box_border = 'false'; } $cff_like_box_cover = $atts['likeboxcover']; if ($cff_like_box_cover) { $cff_like_box_cover = 'false'; } else { $cff_like_box_cover = 'true'; } $cff_like_box_small_header = $atts['likeboxsmallheader']; if ($cff_like_box_small_header) { $cff_like_box_small_header = 'true'; } else { $cff_like_box_small_header = 'false'; } $cff_like_box_hide_cta = $atts['likeboxhidebtn']; if ($cff_like_box_hide_cta) { $cff_like_box_hide_cta = 'true'; } else { $cff_like_box_hide_cta = 'false'; } //Compile Like box styles $cff_likebox_styles = 'style="width: ' . $cff_likebox_width . ';'; if (!empty($cff_likebox_bg_color)) { $cff_likebox_styles .= ' background-color: #' . str_replace('#', '', $cff_likebox_bg_color) . ';'; } //Set the left margin on the like box based on how it's being displayed if (!empty($cff_likebox_bg_color) && $cff_likebox_bg_color != '#' || ($cff_like_box_faces == 'true' || $cff_like_box_faces == 'on')) { $cff_likebox_styles .= ' margin-left: 0px;'; } $cff_likebox_styles .= '"'; //Get feed header settings $cff_header_bg_color = $atts['headerbg']; $cff_header_padding = $atts['headerpadding']; if (is_numeric(substr($cff_header_padding, -1, 1))) { $cff_header_padding = $cff_header_padding . 'px'; } $cff_header_text_size = $atts['headertextsize']; $cff_header_text_weight = $atts['headertextweight']; $cff_header_text_color = $atts['headertextcolor']; //Compile feed header styles $cff_header_styles = ''; if (!empty($cff_header_bg_color) && $cff_header_bg_color !== '#' || !empty($cff_header_padding) || !empty($cff_header_text_size) && $cff_header_text_size != 'inherit' || !empty($cff_header_text_weight) && $cff_header_text_weight != 'inherit' || !empty($cff_header_text_color) && $cff_header_text_color !== '#') { $cff_header_styles = 'style="'; } if (!empty($cff_header_bg_color) && $cff_header_bg_color !== '#') { $cff_header_styles .= 'background-color: #' . str_replace('#', '', $cff_header_bg_color) . '; '; } if (!empty($cff_header_padding)) { $cff_header_styles .= 'padding: ' . $cff_header_padding . '; '; } if (!empty($cff_header_text_size) && $cff_header_text_size != 'inherit') { $cff_header_styles .= 'font-size: ' . $cff_header_text_size . 'px; '; } if (!empty($cff_header_text_weight) && $cff_header_text_weight != 'inherit') { $cff_header_styles .= 'font-weight: ' . $cff_header_text_weight . '; '; } if (!empty($cff_header_text_color) && $cff_header_text_color !== '#') { $cff_header_styles .= 'color: #' . str_replace('#', '', $cff_header_text_color) . '; '; } if (!empty($cff_header_bg_color) && $cff_header_bg_color !== '#' || !empty($cff_header_padding) || !empty($cff_header_text_size) && $cff_header_text_size != 'inherit' || !empty($cff_header_text_weight) && $cff_header_text_weight != 'inherit' || !empty($cff_header_text_color) && $cff_header_text_color !== '#') { $cff_header_styles .= '"'; } //Video //Dimensions $cff_video_width = 640; $cff_video_height = $atts['videoheight']; //Action $cff_video_action = $atts['videoaction']; //Separating Line $cff_sep_color = $atts['sepcolor']; if (empty($cff_sep_color)) { $cff_sep_color = 'ddd'; } $cff_sep_size = $atts['sepsize']; //If empty then set a 0px border if (empty($cff_sep_size) || $cff_sep_size == '') { $cff_sep_size = 0; //Need to set a color otherwise the CSS is invalid $cff_sep_color = 'fff'; } $cff_post_bg_color = str_replace('#', '', $atts['postbgcolor']); $cff_post_rounded = $atts['postcorners']; $cff_post_bg_color !== '#' && $cff_post_bg_color !== '' ? $cff_post_bg_color_check = true : ($cff_post_bg_color_check = false); $cff_sep_color !== '#' && $cff_sep_color !== '' ? $cff_sep_color_check = true : ($cff_sep_color_check = false); $cff_item_styles = ''; //CFF item styles if ($cff_sep_color_check || $cff_post_bg_color_check) { $cff_item_styles = 'style="'; if ($cff_sep_color_check && !$cff_post_bg_color_check) { $cff_item_styles .= 'border-bottom: ' . $cff_sep_size . 'px solid #' . str_replace('#', '', $cff_sep_color) . '; '; } if ($cff_post_bg_color_check) { $cff_item_styles .= 'background-color: #' . $cff_post_bg_color . '; '; } if (isset($cff_post_rounded) && $cff_post_rounded !== '0') { $cff_item_styles .= '-webkit-border-radius: ' . $cff_post_rounded . 'px; -moz-border-radius: ' . $cff_post_rounded . 'px; border-radius: ' . $cff_post_rounded . 'px; '; } $cff_item_styles .= '"'; } //Text limits $title_limit = $atts['textlength']; if (!isset($title_limit)) { $title_limit = 9999; } $body_limit = $atts['desclength']; //Assign the Access Token and Page ID variables $access_token = $atts['accesstoken']; $page_id = trim($atts['id']); //If user pastes their full URL into the Page ID field then strip it out $cff_facebook_string = 'facebook.com'; $cff_page_id_url_check = stripos($page_id, $cff_facebook_string); if ($cff_page_id_url_check) { //Remove trailing slash if exists $page_id = preg_replace('{/$}', '', $page_id); //Get last part of url $page_id = substr($page_id, strrpos($page_id, '/') + 1); } //If the Page ID contains a query string at the end then remove it if (stripos($page_id, '?') !== false) { $page_id = substr($page_id, 0, strrpos($page_id, '?')); } //Get show posts attribute. If not set then default to 25 $show_posts = $atts['num']; if (empty($show_posts)) { $show_posts = 25; } if ($show_posts == 'undefined') { $show_posts = 25; } //If the 'Enter my own Access Token' box is unchecked then don't use the user's access token, even if there's one in the field get_option('cff_show_access_token') ? $cff_show_access_token = true : ($cff_show_access_token = false); //If there's no Access Token then use a default $access_token_array = array('1489500477999288|KFys5ppNi3sreihdreqPkU2ChIE', '859332767418162|BR-YU8zjzvonNrszlll_1a4y_xE', '360558880785446|4jyruti_VkxxK7gS7JeyX-EuSXs', '1487072591579718|0KQzP-O2E4mvFCPxTLWP1b87I4Q', '640861236031365|2rENQzxtWtG12DtlZwqfZ6Vu6BE', '334487440086538|hI_NNy1NvxQiQxm-TtXsrmoCVaE', '755471677869105|Jxv8xVDad7vUUTauk8K2o71wG2w', '518353204973067|dA7YTe-k8eSvgZ8lqa51xSm16DA', '444286039063163|5qkYu2qxpERWO3gcs2f3nxeqhpg', '944793728885704|XJ6QqKK8Ldsssr4n5Qrs2tVr7rs', '1444667452511509|wU7tzWiuj6NadfpHfgkIGLGO86o', '1574171666165548|ZL9tXNXxpnCdAvdUjCX5HtRnsR8'); if ($access_token == '' || !$cff_show_access_token) { $access_token = $access_token_array[rand(0, 11)]; } //Check whether a Page ID has been defined if ($page_id == '') { 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=YOUR_PAGE_ID_HERE].<br /><br />"; return false; } //Is it SSL? $cff_ssl = ''; if (is_ssl()) { $cff_ssl = '&return_ssl_resources=true'; } //Use posts? or feed? $old_others_option = get_option('cff_show_others'); //Use this to help depreciate the old option $show_others = $atts['others']; $show_posts_by = $atts['showpostsby']; $graph_query = 'posts'; $cff_show_only_others = false; //If 'others' shortcode option is used then it overrides any other option if ($show_others || $old_others_option == 'on') { //Show posts by everyone if ($old_others_option == 'on' || $show_others == 'on' || $show_others == 'true' || $show_others == true || $cff_is_group) { $graph_query = 'feed'; } //Only show posts by me if ($show_others == 'false') { $graph_query = 'posts'; } } else { //Else use the settings page option or the 'showpostsby' shortcode option //Only show posts by me if ($show_posts_by == 'me') { $graph_query = 'posts'; } //Show posts by everyone if ($show_posts_by == 'others' || $cff_is_group) { $graph_query = 'feed'; } //Show posts ONLY by others if ($show_posts_by == 'onlyothers' && !$cff_is_group) { $graph_query = 'feed'; $cff_show_only_others = true; } } //If the limit isn't set then set it to be 5 more than the number of posts defined if (isset($atts['limit']) && $atts['limit'] !== '') { $cff_post_limit = $atts['limit']; } else { $cff_post_limit = intval(intval($show_posts) + 7); } if ($cff_post_limit >= 100) { $cff_post_limit = 100; } //Calculate the cache time in seconds if ($cff_cache_time_unit == 'minutes') { $cff_cache_time_unit = 60; } if ($cff_cache_time_unit == 'hours') { $cff_cache_time_unit = 60 * 60; } if ($cff_cache_time_unit == 'days') { $cff_cache_time_unit = 60 * 60 * 24; } $cache_seconds = $cff_cache_time * $cff_cache_time_unit; //Get like box vars $cff_likebox_width = $atts['likeboxwidth']; if (!isset($cff_likebox_width) || empty($cff_likebox_width) || $cff_likebox_width == '') { $cff_likebox_width = 300; } //Set like box variable isset($options['cff_app_id']) ? $cff_app_id = $options['cff_app_id'] : ($cff_app_id = ''); isset($cff_app_id) && !empty($cff_app_id) ? $cff_like_box_params = '&app_id=' . $cff_app_id : ($cff_like_box_params = ''); $like_box = '<div class="cff-likebox'; if ($cff_like_box_outside) { $like_box .= ' cff-outside'; } $like_box .= $cff_like_box_position == 'top' ? ' cff-top' : ' cff-bottom'; $like_box_page_id = explode(",", str_replace(' ', '', $page_id)); $like_box .= '" ><script src="https://connect.facebook.net/' . $cff_locale . '/all.js#xfbml=1' . $cff_like_box_params . '"></script><div class="fb-page" data-href="https://www.facebook.com/' . $like_box_page_id[0] . '" data-width="' . $cff_likebox_width . '" data-hide-cover="' . $cff_like_box_cover . '" data-show-facepile="' . $cff_like_box_faces . '" data-small-header="' . $cff_like_box_small_header . '" data-hide-cta="' . $cff_like_box_hide_cta . '" data-show-posts="false" data-adapt-container-width="true"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/' . $like_box_page_id[0] . '"><a href="https://www.facebook.com/' . $like_box_page_id[0] . '">' . $cff_facebook_link_text . '</a></blockquote></div></div><div id="fb-root"></div></div>'; //Don't show like box if it's a group if ($cff_is_group) { $like_box = ''; } //Feed header $cff_show_header = $atts['showheader']; $cff_show_header == 'true' || $cff_show_header == 'on' ? $cff_show_header = true : ($cff_show_header = false); $cff_header_outside = $atts['headeroutside']; $cff_header_outside == 'true' || $cff_header_outside == 'on' ? $cff_header_outside = true : ($cff_header_outside = false); $cff_header_text = $atts['headertext']; $cff_header_icon = $atts['headericon']; $cff_header_icon_color = $atts['headericoncolor']; $cff_header_icon_size = $atts['headericonsize']; $cff_header = '<h3 class="cff-header'; if ($cff_header_outside) { $cff_header .= ' cff-outside'; } $cff_header .= '" ' . $cff_header_styles . '>'; $cff_header .= '<i class="fa fa-' . $cff_header_icon . '"'; if (!empty($cff_header_icon_color) || !empty($cff_header_icon_size)) { $cff_header .= ' style="'; } if (!empty($cff_header_icon_color)) { $cff_header .= 'color: #' . str_replace('#', '', $cff_header_icon_color) . ';'; } if (!empty($cff_header_icon_size)) { $cff_header .= ' font-size: ' . $cff_header_icon_size . 'px;'; } if (!empty($cff_header_icon_color) || !empty($cff_header_icon_size)) { $cff_header .= '"'; } $cff_header .= '></i>'; $cff_header .= '<span class="header-text" style="height: ' . $cff_header_icon_size . 'px;">' . $cff_header_text . '</span>'; $cff_header .= '</h3>'; //Misc Settings $cff_nofollow = $atts['nofollow']; $cff_nofollow == 'on' || $cff_nofollow == 'true' || $cff_nofollow == true ? $cff_nofollow = true : ($cff_nofollow = false); if ($atts['nofollow'] == 'false') { $cff_nofollow = false; } $cff_nofollow ? $cff_nofollow = ' rel="nofollow"' : ($cff_nofollow = ''); //If the number of posts is set to zero then don't show any and set limit to one if (($atts['num'] == '0' || $atts['num'] == 0) && $atts['num'] !== '') { $show_posts = 0; $cff_post_limit = 1; } //***START FEED*** $cff_content = ''; //Add the page header to the outside of the top of feed if ($cff_show_header && $cff_header_outside) { $cff_content .= $cff_header; } //Add like box to the outside of the top of feed if ($cff_like_box_position == 'top' && $cff_show_like_box && $cff_like_box_outside) { $cff_content .= $like_box; } //Create CFF container HTML $cff_content .= '<div class="cff-wrapper">'; $cff_content .= '<div id="cff" data-char="' . $title_limit . '"'; //Disable default CSS styles? $cff_disable_styles = $atts['disablestyles']; $cff_disable_styles == 'on' || $cff_disable_styles == 'true' || $cff_disable_styles == true ? $cff_disable_styles = true : ($cff_disable_styles = false); if ($atts['disablestyles'] === 'false') { $cff_disable_styles = false; } //If there's a class then add it here if (!empty($cff_class) || !empty($cff_feed_height) || !$cff_disable_styles || $cff_feed_width_resp) { $cff_content .= ' class="'; } if (!empty($cff_class)) { $cff_content .= $cff_class . ' '; } if (!empty($cff_feed_height)) { $cff_content .= 'cff-fixed-height '; } if ($cff_feed_width_resp) { $cff_content .= 'cff-width-resp '; } if (!$cff_disable_styles) { $cff_content .= 'cff-default-styles'; } if (!empty($cff_class) || !empty($cff_feed_height) || !$cff_disable_styles || $cff_feed_width_resp) { $cff_content .= '"'; } $cff_content .= ' ' . $cff_feed_styles . '>'; //Add the page header to the inside of the top of feed if ($cff_show_header && !$cff_header_outside) { $cff_content .= $cff_header; } //Add like box to the inside of the top of feed if ($cff_like_box_position == 'top' && $cff_show_like_box && !$cff_like_box_outside) { $cff_content .= $like_box; } //Limit var $i = 0; //Define array for post items $cff_posts_array = array(); //ALL POSTS if (!$cff_events_only) { // $cff_posts_json_url = 'https://graph.facebook.com/' . $page_id . '/' . $graph_query . '?access_token=' . $access_token . '&limit=' . $cff_post_limit . '&locale=' . $cff_locale . $cff_ssl; $cff_posts_json_url = 'https://graph.facebook.com/' . $page_id . '/' . $graph_query . '?fields=id,from,message,message_tags,story,story_tags,link,source,name,caption,description,type,status_type,object_id,created_time&access_token=' . $access_token . '&limit=' . $cff_post_limit . '&locale=' . $cff_locale . $cff_ssl; //Don't use caching if the cache time is set to zero if ($cff_cache_time != 0) { //Create the transient name //Split the Page ID in half and stick it together so we definitely have the beginning and end of it $trans_page_id = substr($page_id, 0, 17) . substr($page_id, -16); $transient_name = 'cff_' . substr($graph_query, 0, 1) . '_' . $trans_page_id . substr($cff_post_limit, 0, 3) . substr($show_posts_by, 0, 2); //Limit to 45 chars max $transient_name = substr($transient_name, 0, 45); //Get any existing copy of our transient data if (false === ($posts_json = get_transient($transient_name)) || $posts_json === null) { //Get the contents of the Facebook page $posts_json = cff_fetchUrl($cff_posts_json_url); //Check whether any data is returned from the API. If it isn't then don't cache the error response and instead keep checking the API on every page load until data is returned. $FBdata = json_decode($posts_json); if (!empty($FBdata->data)) { //Cache the JSON set_transient($transient_name, $posts_json, $cache_seconds); } } else { $posts_json = get_transient($transient_name); //If we can't find the transient then fall back to just getting the json from the api if ($posts_json == false) { $posts_json = cff_fetchUrl($cff_posts_json_url); } } } else { $posts_json = cff_fetchUrl($cff_posts_json_url); } //Interpret data with JSON $FBdata = json_decode($posts_json); //If there's no data then show a pretty error message if (empty($FBdata->data)) { $cff_content .= '<div class="cff-error-msg"><p>Unable to display Facebook posts.<br/><a href="javascript:void(0);" id="cff-show-error" onclick="cffShowError()">Show error</a>'; $cff_content .= '<script type="text/javascript">function cffShowError() { document.getElementById("cff-error-reason").style.display = "block"; document.getElementById("cff-show-error").style.display = "none"; }</script>'; $cff_content .= '</p><div id="cff-error-reason">'; if (isset($FBdata->error->message)) { $cff_content .= 'Error: ' . $FBdata->error->message; } if (isset($FBdata->error->type)) { $cff_content .= '<br />Type: ' . $FBdata->error->type; } if (isset($FBdata->error->code)) { $cff_content .= '<br />Code: ' . $FBdata->error->code; } if (isset($FBdata->error->error_subcode)) { $cff_content .= '<br />Subcode: ' . $FBdata->error->error_subcode; } if (isset($FBdata->error_msg)) { $cff_content .= 'Error: ' . $FBdata->error_msg; } if (isset($FBdata->error_code)) { $cff_content .= '<br />Code: ' . $FBdata->error_code; } if ($FBdata == null) { $cff_content .= 'Error: Server configuration issue'; } if (empty($FBdata->error) && empty($FBdata->error_msg) && $FBdata !== null) { $cff_content .= 'Error: No posts available for this Facebook ID'; } $cff_content .= '<br />Please refer to our <a href="http://smashballoon.com/custom-facebook-feed/docs/errors/" target="_blank">Error Message Reference</a>.'; $cff_content .= '</div></div>'; //End .cff-error-msg and #cff-error-reason $cff_content .= '</div></div>'; //End #cff and .cff-wrapper return $cff_content; } //***STARTS POSTS LOOP*** foreach ($FBdata->data as $news) { //Explode News and Page ID's into 2 values $PostID = ''; $cff_post_id = ''; if (isset($news->id)) { $cff_post_id = $news->id; $PostID = explode("_", $cff_post_id); } //Check the post type $cff_post_type = $news->type; if ($cff_post_type == 'link') { isset($news->story) ? $story = $news->story : ($story = ''); //Check whether it's an event $event_link_check = "facebook.com/events/"; $event_link_check = stripos($news->link, $event_link_check); if ($event_link_check) { $cff_post_type = 'event'; } } //Should we show this post or not? $cff_show_post = false; switch ($cff_post_type) { case 'link': if ($cff_show_links_type) { $cff_show_post = true; } break; case 'event': if ($cff_show_event_type) { $cff_show_post = true; } break; case 'video': if ($cff_show_video_type) { $cff_show_post = true; } break; case 'swf': if ($cff_show_video_type) { $cff_show_post = true; } break; case 'photo': if ($cff_show_photos_type) { $cff_show_post = true; } break; case 'offer': $cff_show_post = true; break; case 'status': //Check whether it's a status (author comment or like) if ($cff_show_status_type && !empty($news->message)) { $cff_show_post = true; } break; } //ONLY show posts by others if ($cff_show_only_others) { //Get the numeric ID of the page $page_object = cff_fetchUrl('https://graph.facebook.com/' . $page_id . '?fields=name,id&access_token=' . $access_token); $page_object = json_decode($page_object); $numeric_page_id = $page_object->id; //If the post author's ID is the same as the page ID then don't show the post if ($numeric_page_id == $news->from->id) { $cff_show_post = false; } } //Is it a duplicate post? if (!isset($prev_post_message)) { $prev_post_message = ''; } if (!isset($prev_post_link)) { $prev_post_link = ''; } if (!isset($prev_post_description)) { $prev_post_description = ''; } isset($news->message) ? $pm = $news->message : ($pm = ''); isset($news->link) ? $pl = $news->link : ($pl = ''); isset($news->description) ? $pd = $news->description : ($pd = ''); if ($prev_post_message == $pm && $prev_post_link == $pl && $prev_post_description == $pd) { $cff_show_post = false; } //Offset. If the post index ($i) is less than the offset then don't show the post if (intval($i) < intval($atts['offset'])) { $cff_show_post = false; $i++; } //Check post type and display post if selected if ($cff_show_post) { //If it isn't then create the post //Only create posts for the amount of posts specified if (intval($atts['offset']) > 0) { //If offset is being used then stop after showing the number of posts + the offset if ($i == intval($show_posts) + intval($atts['offset'])) { break; } } else { //Else just stop after the number of posts to be displayed is reached if ($i == $show_posts) { break; } } $i++; //********************************// //***COMPILE SECTION VARIABLES***// //********************************// //Set the post link isset($news->link) ? $link = htmlspecialchars($news->link) : ($link = ''); //Is it a shared album? $shared_album_string = 'shared an album:'; isset($news->story) ? $story = $news->story : ($story = ''); $shared_album = stripos($story, $shared_album_string); if ($shared_album) { $link = str_replace('photo.php?', 'media/set/?', $link); } //Check the post type isset($news->type) ? $cff_post_type = $news->type : ($cff_post_type = ''); if ($cff_post_type == 'link') { isset($news->story) ? $story = $news->story : ($story = ''); //Check whether it's an event $event_link_check = "facebook.com/events/"; //Make sure URL doesn't include 'permalink' as that indicates someone else sharing a post from within an event (eg: https://www.facebook.com/events/617323338414282/permalink/617324268414189/) and the event ID is then not retrieved properly from the event URL as it's formatted like so: facebook.com/events/EVENT_ID/permalink/POST_ID $event_link_check = stripos($news->link, $event_link_check); $event_link_check_2 = stripos($news->link, "permalink/"); if ($event_link_check && !$event_link_check_2) { $cff_post_type = 'event'; } } //If it's an event then check whether the URL contains facebook.com if (isset($news->link)) { if (stripos($news->link, "events/") && $cff_post_type == 'event') { //Facebook changed the event link from absolute to relative, and so if the link isn't absolute then add facebook.com to front stripos($link, 'facebook.com') ? $link = $link : ($link = 'https://facebook.com' . $link); } } //Is it an album? $cff_album = false; $num_photos = 0; if (isset($news->status_type)) { if ($news->status_type == 'added_photos') { //Check 'story' to see whether it contains a number isset($news->story) ? $str = $news->story : ($str = ''); //Only matches number with a space after them preg_match('!\\d+ !', $str, $matches); isset($matches[0]) ? $num_photos = $matches[0] : ($num_photos = 0); //If the story contains a number... if ($num_photos > 1) { //... and the link is to an album then it most likely has photo attachments $albumLinkArr1 = explode('photos/a.', $link); $albumLinkArr2 = explode('.', $albumLinkArr1[1]); //If it has an album link then set the post type to be album if (isset($albumLinkArr1[1])) { $cff_album = true; //Change the Post ID to be to the post about adding photos to the album $cff_post_id = $PostID[0] . '_' . $albumLinkArr2[0]; //Link to the album instead of the photo $album_link = str_replace('photo.php?', 'media/set/?', $link); $link = "https://www.facebook.com/" . $page_id . "/posts/" . $PostID[1]; //If the album link is a new format then link it to the post $album_link_check = 'media/set/?'; if (stripos($album_link, $album_link_check) !== true) { $album_link = $link; } } } } } //If there's no link provided then link to either the Facebook page or the individual status if (empty($news->link)) { if ($cff_link_to_timeline == true) { //Link to page $link = 'http://facebook.com/' . $page_id; } else { //Link to status $link = "https://www.facebook.com/" . $page_id . "/posts/" . $PostID[1]; } } //DATE $cff_date_formatting = $atts['dateformat']; $cff_date_custom = $atts['datecustom']; $post_time = $news->created_time; $cff_date = '<p class="cff-date" ' . $cff_date_styles . '>' . $cff_date_before . ' ' . cff_getdate(strtotime($post_time), $cff_date_formatting, $cff_date_custom) . ' ' . $cff_date_after; if ($cff_date_position == 'below' || !$cff_show_author && $cff_date_position == 'author') { $cff_date .= '<span class="cff-date-dot"> · </span>'; } $cff_date .= '</p>'; //POST AUTHOR $cff_author = '<div class="cff-author">'; //Author text $cff_author .= '<a href="https://facebook.com/' . $news->from->id . '" ' . $target . $cff_nofollow . ' title="' . $news->from->name . ' on Facebook" ' . $cff_author_styles . '><div class="cff-author-text">'; if ($cff_show_date && $cff_date_position !== 'above' && $cff_date_position !== 'below') { $cff_author .= '<p class="cff-page-name cff-author-date">' . $news->from->name . '</p>'; $cff_author .= $cff_date; } else { $cff_author .= '<span class="cff-page-name">' . $news->from->name . '</span>'; } $cff_author .= '</div>'; //Author image //Set the author image as a variable. If it already exists then don't query the api for it again. $cff_author_img_var = '$cff_author_img_' . $news->from->id; if (!isset(${$cff_author_img_var})) { ${$cff_author_img_var} = 'https://graph.facebook.com/' . $news->from->id . '/picture?type=square'; } $cff_author .= '<div class="cff-author-img"><img src="' . ${$cff_author_img_var} . '" title="' . $news->from->name . '" alt="' . $news->from->name . '" width=40 height=40></div>'; $cff_author .= '</a></div>'; //End .cff-author //POST TEXT $cff_translate_photos_text = $atts['photostext']; if (!isset($cff_translate_photos_text) || empty($cff_translate_photos_text)) { $cff_translate_photos_text = 'photos'; } $cff_post_text = '<' . $cff_title_format . ' class="cff-post-text" ' . $cff_title_styles . '>'; //Start HTML for post text $cff_post_text .= '<span class="cff-text" data-color="' . $cff_posttext_link_color . '">'; if ($cff_title_link) { //Link to the Facebook post if it's a link or a video $cff_post_type == 'link' || $cff_post_type == 'video' ? $text_link = "https://www.facebook.com/" . $page_id . "/posts/" . $PostID[1] : ($text_link = $link); $cff_post_text .= '<a class="cff-post-text-link" ' . $cff_title_styles . ' href="' . $text_link . '" ' . $target . $cff_nofollow . '>'; } //Which content should we use? $cff_post_text_type = ''; $post_text = ''; //Use the story if (!empty($news->story)) { $post_text = htmlspecialchars($news->story); $cff_post_text_type = 'story'; } //Use the message if (!empty($news->message)) { $post_text = htmlspecialchars($news->message); $cff_post_text_type = 'message'; } //Use the name if (!empty($news->name) && empty($news->story) && empty($news->message)) { $post_text = htmlspecialchars($news->name); $cff_post_text_type = 'name'; } // if ($cff_album) { // if (!empty($news->name)) { // $post_text = htmlspecialchars($news->name); // $cff_post_text_type = 'name'; // } // if (!empty($news->message) && empty($news->name)) { // $post_text = htmlspecialchars($news->message); // $cff_post_text_type = 'message'; // } // if ($num_photos > 1) $post_text .= ' (' . trim($num_photos) . ' '.$cff_translate_photos_text.')'; // } //MESSAGE TAGS $cff_post_tags = $atts['posttags']; //If the post tags option doesn't exist yet (ie. on plugin update) then set them as true if (!array_key_exists('cff_post_tags', $options)) { $cff_post_tags = true; } //Add message and story tags if there are any and the post text is the message or the story if ($cff_post_tags && (isset($news->message_tags) || isset($news->story_tags)) && ($cff_post_text_type == 'message' || $cff_post_text_type == 'story') && !$cff_title_link) { //Use message_tags or story_tags? isset($news->message_tags) ? $text_tags = $news->message_tags : ($text_tags = $news->story_tags); //If message tags and message is being used as the post text, or same with story. This stops story tags being used to replace the message inadvertently. if ($cff_post_text_type == 'message' && isset($news->message_tags) || $cff_post_text_type == 'story' && !isset($news->message_tags)) { //Does the Post Text contain any html tags? - the & symbol is the best indicator of this $cff_html_check_array = array('<', '’', '“', '"', '&', '>>', '>'); //always use the text replace method if (cff_stripos_arr($post_text, $cff_html_check_array) !== false) { //Loop through the tags foreach ($text_tags as $message_tag) { isset($message_tag->id) ? $message_tag = $message_tag : ($message_tag = $message_tag[0]); $tag_name = $message_tag->name; $tag_link = '<a href="http://facebook.com/' . $message_tag->id . '" style="color: #' . $cff_posttext_link_color . ';" target="_blank">' . $message_tag->name . '</a>'; $post_text = str_replace($tag_name, $tag_link, $post_text); } } else { //If it doesn't contain HTMl tags then use the offset to replace message tags $message_tags_arr = array(); $i = 0; foreach ($text_tags as $message_tag) { $i++; isset($message_tag->id) ? $message_tag = $message_tag : ($message_tag = $message_tag[0]); $message_tags_arr = cff_array_push_assoc($message_tags_arr, $i, array('id' => $message_tag->id, 'name' => $message_tag->name, 'type' => isset($message_tag->type) ? $message_tag->type : '', 'offset' => $message_tag->offset, 'length' => $message_tag->length)); } for ($i = count($message_tags_arr); $i >= 1; $i--) { //If the name is blank (aka the story tag doesn't work properly) then don't use it if ($message_tags_arr[$i]['name'] !== '') { if ($cff_post_text_type == 'story' && $message_tags_arr[$i]['type'] == 'event') { //Don't use the story tag in this case otherwise it changes '__ created an event' to '__ created an Name Of Event' } else { $b = '<a href="http://facebook.com/' . $message_tags_arr[$i]['id'] . '">' . $message_tags_arr[$i]['name'] . '</a>'; $c = $message_tags_arr[$i]['offset']; $d = $message_tags_arr[$i]['length']; $post_text = cff_mb_substr_replace($post_text, $b, $c, $d); } } } } // end if/else } // end message check } //END MESSAGE TAGS //Replace line breaks in text (needed for IE8) $post_text = preg_replace("/\r\n|\r|\n/", '<br/>', $post_text); //If the text is wrapped in a link then don't hyperlink any text within if ($cff_title_link) { //Wrap links in a span so we can break the text if it's too long $cff_post_text .= cff_wrap_span($post_text) . ' '; } else { //Don't use htmlspecialchars for post_text as it's added above so that it doesn't mess up the message_tag offsets $cff_post_text .= cff_autolink($post_text) . ' '; } if ($cff_title_link) { $cff_post_text .= '</a>'; } $cff_post_text .= '</span>'; //'See More' link $cff_post_text .= '<span class="cff-expand">... <a href="#" style="color: #' . $cff_posttext_link_color . '"><span class="cff-more">' . $cff_see_more_text . '</span><span class="cff-less">' . $cff_see_less_text . '</span></a></span>'; $cff_post_text .= '</' . $cff_title_format . '>'; //DESCRIPTION $cff_description = ''; //Use the description if it's available and the post type isn't set to offer (offer description isn't useful) if ((!empty($news->description) || !empty($news->caption)) && $cff_post_type != 'offer') { $description_text = ''; if (!empty($news->description)) { $description_text = $news->description; } else { $description_text = $news->caption; } if (!empty($body_limit)) { if (strlen($description_text) > $body_limit) { $description_text = substr($description_text, 0, $body_limit) . '...'; } } $cff_description .= '<p class="cff-post-desc" ' . $cff_body_styles . '><span>' . cff_autolink(htmlspecialchars($description_text), $link_color = $cff_posttext_link_color) . ' </span></p>'; //If the post text and description/caption are the same then don't show the description if ($post_text == $description_text) { $cff_description = ''; } if ($cff_post_type == 'event') { $cff_description = ''; } } //LINK $cff_shared_link = ''; //Display shared link if ($cff_post_type == 'link') { $cff_shared_link .= '<div class="cff-shared-link'; if ($cff_disable_link_box) { $cff_shared_link .= ' cff-no-styles"'; } if (!$cff_disable_link_box) { $cff_shared_link .= '" ' . $cff_link_box_styles; } $cff_shared_link .= '>'; //Display link name and description if (!empty($news->description)) { $cff_shared_link .= '<div class="cff-text-link '; $cff_shared_link .= 'cff-no-image'; $cff_shared_link .= '">'; //The link title: $cff_shared_link .= '<' . $cff_link_title_format . ' class="cff-link-title" ' . $cff_link_title_styles . '><a href="' . $link . '" ' . $target . $cff_nofollow . ' style="color:#' . $cff_link_title_color . ';">' . $news->name . '</a></' . $cff_link_title_format . '>'; //The link source: !empty($news->caption) ? $cff_link_caption = $news->caption : ($cff_link_caption = ''); if (!empty($cff_link_caption)) { $cff_shared_link .= '<p class="cff-link-caption" style="color:#' . str_replace('#', '', $cff_link_url_color) . ';">' . $cff_link_caption . '</p>'; } if ($cff_show_desc) { if ($description_text != $cff_link_caption) { $cff_shared_link .= $cff_description; } } $cff_shared_link .= '</div>'; } $cff_shared_link .= '</div>'; } //EVENT $cff_event = ''; if ($cff_show_event_title || $cff_show_event_details) { //Check for media if ($cff_post_type == 'event') { //Get the event id from the event URL. eg: http://www.facebook.com/events/123451234512345/ $event_url = parse_url($link); $url_parts = explode('/', $event_url['path']); //Get the id from the parts $eventID = $url_parts[count($url_parts) - 2]; //Facebook changed the event link from absolute to relative, and so if the link isn't absolute then add facebook.com to front stripos($link, 'facebook.com') ? $link = $link : ($link = 'https://facebook.com' . $link); //Get the contents of the event using the WP HTTP API $event_json_url = 'https://graph.facebook.com/' . $eventID . '?access_token=' . $access_token . $cff_ssl; //Don't use caching if the cache time is set to zero if ($cff_cache_time != 0) { // Get any existing copy of our transient data $transient_name = 'cff_tle_' . $eventID; $transient_name = substr($transient_name, 0, 45); if (false === ($event_json = get_transient($transient_name)) || $event_json === null) { //Get the contents of the Facebook page $event_json = cff_fetchUrl($event_json_url); //Cache the JSON set_transient($transient_name, $event_json, $cache_seconds); } else { $event_json = get_transient($transient_name); //If we can't find the transient then fall back to just getting the json from the api if ($event_json == false) { $event_json = cff_fetchUrl($event_json_url); } } } else { $event_json = cff_fetchUrl($event_json_url); } //Interpret data with JSON $event_object = json_decode($event_json); //Event date $event_time = $event_object->start_time; isset($event_object->end_time) ? $event_end_time = ' - ' . cff_eventdate(strtotime($event_object->end_time), $cff_event_date_formatting, $cff_event_date_custom) : ($event_end_time = ''); //If timezone migration is enabled then remove last 5 characters if (strlen($event_time) == 24) { $event_time = substr($event_time, 0, -5); } 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) . $event_end_time . '</p>'; } //EVENT //Display the event details $cff_event .= '<div class="cff-details">'; //show event date above title if ($cff_event_date_position == 'above') { $cff_event .= $cff_event_date; } //Show event title if ($cff_show_event_title && !empty($event_object->name)) { if ($cff_event_title_link) { $cff_event .= '<a href="' . $link . '" ' . $target . $cff_nofollow . '>'; } $cff_event .= '<' . $cff_event_title_format . ' ' . $cff_event_title_styles . '>' . $event_object->name . '</' . $cff_event_title_format . '>'; if ($cff_event_title_link) { $cff_event .= '</a>'; } } //show event date below title if ($cff_event_date_position !== 'above') { $cff_event .= $cff_event_date; } //Show event details if ($cff_show_event_details) { //Location if (!empty($event_object->location)) { $cff_event .= '<p class="cff-where" ' . $cff_event_details_styles . '>' . $event_object->location . '</p>'; } //Description if (!empty($event_object->description)) { $description = $event_object->description; if (!empty($body_limit)) { if (strlen($description) > $body_limit) { $description = substr($description, 0, $body_limit) . '...'; } } $cff_event .= '<p class="cff-info" ' . $cff_event_details_styles . '>' . cff_autolink($description, $link_color = str_replace('#', '', $cff_event_link_color)) . '</p>'; } } $cff_event .= '</div>'; } } /* VIDEO */ //Check to see whether it's an embedded video so that we can show the name above the post text if necessary $cff_is_video_embed = false; if ($news->type == 'video') { $url = $news->source; //Embeddable video strings $youtube = 'youtube'; $youtu = 'youtu'; $vimeo = 'vimeo'; $youtubeembed = 'youtube.com/embed'; //Check whether it's a youtube video $youtube = stripos($url, $youtube); $youtu = stripos($url, $youtu); $youtubeembed = stripos($url, $youtubeembed); //Check whether it's a youtube video if ($youtube || $youtu || $youtubeembed || stripos($url, $vimeo) !== false) { $cff_is_video_embed = true; } } $cff_media = ''; if ($news->type == 'video') { //Add the name to the description if it's a video embed if ($cff_is_video_embed) { isset($news->name) ? $video_name = $news->name : ($video_name = $link); isset($news->description) ? $description_text = $news->description : ($description_text = ''); //Add the 'cff-shared-link' class so that embedded videos display in a box $cff_description = '<div class="cff-desc-wrap cff-shared-link '; if (empty($picture)) { $cff_description .= 'cff-no-image'; } if ($cff_disable_link_box) { $cff_description .= ' cff-no-styles"'; } if (!$cff_disable_link_box) { $cff_description .= '" ' . $cff_link_box_styles; } $cff_description .= '>'; if (isset($news->name)) { $cff_description .= '<' . $cff_link_title_format . ' class="cff-link-title" ' . $cff_link_title_styles . '><a href="' . $link . '" ' . $target . $cff_nofollow . ' style="color:#' . $cff_link_title_color . ';">' . $news->name . '</a></' . $cff_link_title_format . '>'; } if (!empty($body_limit)) { if (strlen($description_text) > $body_limit) { $description_text = substr($description_text, 0, $body_limit) . '...'; } } $cff_description .= '<p class="cff-post-desc" ' . $cff_body_styles . '><span>' . cff_autolink(htmlspecialchars($description_text)) . '</span></p></div>'; } else { isset($news->name) ? $video_name = $news->name : ($video_name = $link); if (isset($news->name)) { $cff_description .= '<' . $cff_link_title_format . ' class="cff-link-title" ' . $cff_link_title_styles . '><a href="' . $link . '" ' . $target . $cff_nofollow . ' style="color:#' . $cff_link_title_color . ';">' . $news->name . '</a></' . $cff_link_title_format . '>'; } } } //Display the link to the Facebook post or external link $cff_link = ''; //Default link $cff_viewpost_class = 'cff-viewpost-facebook'; if ($cff_facebook_link_text == '') { $cff_facebook_link_text = 'View on Facebook'; } $link_text = $cff_facebook_link_text; //Link to the Facebook post if it's a link or a video if ($cff_post_type == 'link' || $cff_post_type == 'video') { $link = "https://www.facebook.com/" . $page_id . "/posts/" . $PostID[1]; } //If it's a shared post then change the link to use the Post ID so that it links to the shared post and not the original post that's being shared if (isset($news->status_type)) { if ($news->status_type == 'shared_story') { $link = "https://www.facebook.com/" . $cff_post_id; } } //Social media sharing URLs $cff_share_facebook = 'https://www.facebook.com/sharer/sharer.php?u=' . urlencode($link); $cff_share_twitter = 'https://twitter.com/intent/tweet?text=' . urlencode($link); $cff_share_google = 'https://plus.google.com/share?url=' . urlencode($link); $cff_share_linkedin = 'https://www.linkedin.com/shareArticle?mini=true&url=' . urlencode($link) . '&title=' . rawurlencode(strip_tags($cff_post_text)); $cff_share_email = 'mailto:?subject=Facebook&body=' . urlencode($link) . '%20-%20' . rawurlencode(strip_tags($cff_post_text)); //If it's an offer post then change the text if ($cff_post_type == 'offer') { $link_text = 'View Offer'; } //Create post action links HTML $cff_link = ''; if ($cff_show_facebook_link || $cff_show_facebook_share) { $cff_link .= '<div class="cff-post-links">'; //View on Facebook link if ($cff_show_facebook_link) { $cff_link .= '<a class="' . $cff_viewpost_class . '" href="' . $link . '" title="' . $link_text . '" ' . $target . $cff_nofollow . ' ' . $cff_link_styles . '>' . $link_text . '</a>'; } //Share link if ($cff_show_facebook_share) { $cff_link .= '<div class="cff-share-container">'; //Only show separating dot if both links are enabled if ($cff_show_facebook_link) { $cff_link .= '<span class="cff-dot" ' . $cff_link_styles . '>·</span>'; } $cff_link .= '<a class="cff-share-link" href="javascript:void(0);" title="' . $cff_facebook_share_text . '" ' . $cff_link_styles . '>' . $cff_facebook_share_text . '</a>'; $cff_link .= "<p class='cff-share-tooltip'><a href='" . $cff_share_facebook . "' target='_blank' class='cff-facebook-icon'><i class='fa fa-facebook-square'></i></a><a href='" . $cff_share_twitter . "' target='_blank' class='cff-twitter-icon'><i class='fa fa-twitter'></i></a><a href='" . $cff_share_google . "' target='_blank' class='cff-google-icon'><i class='fa fa-google-plus'></i></a><a href='" . $cff_share_linkedin . "' target='_blank' class='cff-linkedin-icon'><i class='fa fa-linkedin'></i></a><a href='" . $cff_share_email . "' target='_blank' class='cff-email-icon'><i class='fa fa-envelope'></i></a><i class='fa fa-play fa-rotate-90'></i></p></div>"; } $cff_link .= '</div>'; } //**************************// //***CREATE THE POST HTML***// //**************************// //Start the container $cff_post_item = '<div class="cff-item '; if ($cff_post_type == 'link') { $cff_post_item .= 'cff-link-item'; } if ($cff_post_type == 'event') { $cff_post_item .= 'cff-timeline-event'; } if ($cff_post_type == 'photo') { $cff_post_item .= 'cff-photo-post'; } if ($cff_post_type == 'video') { $cff_post_item .= 'cff-video-post'; } if ($cff_post_type == 'swf') { $cff_post_item .= 'cff-swf-post'; } if ($cff_post_type == 'status') { $cff_post_item .= 'cff-status-post'; } if ($cff_post_type == 'offer') { $cff_post_item .= 'cff-offer-post'; } if ($cff_album) { $cff_post_item .= ' cff-album'; } if ($cff_post_bg_color_check) { $cff_post_item .= ' cff-box'; } $cff_post_item .= ' author-' . cff_to_slug($news->from->name) . '" id="cff_' . $cff_post_id . '" ' . $cff_item_styles . '>'; //POST AUTHOR if ($cff_show_author) { $cff_post_item .= $cff_author; } //DATE ABOVE if ($cff_show_date && $cff_date_position == 'above') { $cff_post_item .= $cff_date; } //POST TEXT if ($cff_show_text) { $cff_post_item .= $cff_post_text; } //DESCRIPTION if ($cff_show_desc && $cff_post_type != 'offer' && $cff_post_type != 'link') { $cff_post_item .= $cff_description; } //LINK if ($cff_show_shared_links) { $cff_post_item .= $cff_shared_link; } //DATE BELOW if (!$cff_show_author && $cff_date_position == 'author' || $cff_show_date && $cff_date_position == 'below') { if ($cff_show_date && $cff_post_type !== 'event') { $cff_post_item .= $cff_date; } } //EVENT if ($cff_show_event_title || $cff_show_event_details) { $cff_post_item .= $cff_event; } //DATE BELOW (only for Event posts) if (!$cff_show_author && $cff_date_position == 'author' || $cff_show_date && $cff_date_position == 'below') { if ($cff_show_date && $cff_post_type == 'event') { $cff_post_item .= $cff_date; } } //VIEW ON FACEBOOK LINK if ($cff_show_link) { $cff_post_item .= $cff_link; } //End the post item $cff_post_item .= '</div>'; //PUSH TO ARRAY $cff_posts_array = cff_array_push_assoc($cff_posts_array, strtotime($post_time), $cff_post_item); } // End post type check if (isset($news->message)) { $prev_post_message = $news->message; } if (isset($news->link)) { $prev_post_link = $news->link; } if (isset($news->description)) { $prev_post_description = $news->description; } } // End the loop //Sort the array in reverse order (newest first) krsort($cff_posts_array); } // End ALL POSTS //Output the posts array $p = 0; foreach ($cff_posts_array as $post) { if ($p == $show_posts) { break; } $cff_content .= $post; $p++; } //Reset the timezone date_default_timezone_set($cff_orig_timezone); //Add the Like Box inside if ($cff_like_box_position == 'bottom' && $cff_show_like_box && !$cff_like_box_outside) { $cff_content .= $like_box; } /* Credit link */ $cff_show_credit = $atts['credit']; $cff_show_credit == 'true' || $cff_show_credit == 'on' ? $cff_show_credit = true : ($cff_show_credit = false); if ($cff_show_credit) { $cff_content .= '<p class="cff-credit"><a href="https://smashballoon.com/custom-facebook-feed/" target="_blank" style="color: #' . ($link_color = $cff_posttext_link_color . '" title="Smash Balloon Custom Facebook Feed WordPress Plugin"><img src="' . plugins_url('/img/smashballoon-tiny.png', __FILE__) . '" alt="Smash Balloon Custom Facebook Feed WordPress Plugin" />The Custom Facebook Feed plugin</a></p>'); } //End the feed $cff_content .= '</div><div class="cff-clear"></div>'; //Add the Like Box outside if ($cff_like_box_position == 'bottom' && $cff_show_like_box && $cff_like_box_outside) { $cff_content .= $like_box; } //If the feed is loaded via Ajax then put the scripts into the shortcode itself $ajax_theme = $atts['ajax']; $ajax_theme == 'on' || $ajax_theme == 'true' || $ajax_theme == true ? $ajax_theme = true : ($ajax_theme = false); if ($atts['ajax'] == 'false') { $ajax_theme = false; } if ($ajax_theme) { $cff_link_hashtags = $atts['linkhashtags']; $cff_link_hashtags == 'true' || $cff_link_hashtags == 'on' ? $cff_link_hashtags = 'true' : ($cff_link_hashtags = 'false'); if ($cff_title_link == 'true' || $cff_title_link == 'on') { $cff_link_hashtags = 'false'; } $cff_content .= '<script type="text/javascript">var cfflinkhashtags = "' . $cff_link_hashtags . '";</script>'; $cff_content .= '<script type="text/javascript" src="' . plugins_url('/js/cff-scripts.js?ver=' . CFFVER, __FILE__) . '"></script>'; } $cff_content .= '</div>'; if (isset($cff_posttext_link_color) && !empty($cff_posttext_link_color)) { $cff_content .= '<style>#cff .cff-post-text a{ color: #' . $cff_posttext_link_color . '; }</style>'; } //Return our feed HTML to display return $cff_content; }
function cff_settings_page() { //Declare variables for fields $hidden_field_name = 'cff_submit_hidden'; $show_access_token = 'cff_show_access_token'; $access_token = 'cff_access_token'; $page_id = 'cff_page_id'; $cff_page_type = 'cff_page_type'; $num_show = 'cff_num_show'; $cff_post_limit = 'cff_post_limit'; $cff_show_others = 'cff_show_others'; $cff_cache_time = 'cff_cache_time'; $cff_cache_time_unit = 'cff_cache_time_unit'; $cff_locale = 'cff_locale'; // Read in existing option value from database $show_access_token_val = get_option($show_access_token); $access_token_val = get_option($access_token); $page_id_val = get_option($page_id); $cff_page_type_val = get_option($cff_page_type, 'page'); $num_show_val = get_option($num_show, '5'); $cff_post_limit_val = get_option($cff_post_limit); $cff_show_others_val = get_option($cff_show_others); $cff_cache_time_val = get_option($cff_cache_time, '1'); $cff_cache_time_unit_val = get_option($cff_cache_time_unit, 'hours'); $cff_locale_val = get_option($cff_locale, 'en_US'); // See if the user has posted us some information. If they did, this hidden field will be set to 'Y'. if (isset($_POST[$hidden_field_name]) && $_POST[$hidden_field_name] == 'Y') { // Read their posted value $show_access_token_val = $_POST[$show_access_token]; $access_token_val = $_POST[$access_token]; $page_id_val = $_POST[$page_id]; $cff_page_type_val = $_POST[$cff_page_type]; $num_show_val = $_POST[$num_show]; $cff_post_limit_val = $_POST[$cff_post_limit]; $cff_show_others_val = $_POST[$cff_show_others]; $cff_cache_time_val = $_POST[$cff_cache_time]; $cff_cache_time_unit_val = $_POST[$cff_cache_time_unit]; $cff_locale_val = $_POST[$cff_locale]; // Save the posted value in the database update_option($show_access_token, $show_access_token_val); update_option($access_token, $access_token_val); update_option($page_id, $page_id_val); update_option($cff_page_type, $cff_page_type_val); update_option($num_show, $num_show_val); update_option($cff_post_limit, $cff_post_limit_val); update_option($cff_show_others, $cff_show_others_val); update_option($cff_cache_time, $cff_cache_time_val); update_option($cff_cache_time_unit, $cff_cache_time_unit_val); update_option($cff_locale, $cff_locale_val); //Delete the transient for the main page ID delete_transient('cff_posts_json_' . $page_id_val); delete_transient('cff_feed_json_' . $page_id_val); delete_transient('cff_events_json_' . $page_id_val); //Delete ALL transients global $wpdb; $table_name = $wpdb->prefix . "options"; $wpdb->query("\n DELETE\n FROM {$table_name}\n WHERE `option_name` LIKE ('%cff\\_posts\\_json\\_%')\n "); $wpdb->query("\n DELETE\n FROM {$table_name}\n WHERE `option_name` LIKE ('%cff\\_feed\\_json\\_%')\n "); $wpdb->query("\n DELETE\n FROM {$table_name}\n WHERE `option_name` LIKE ('%cff\\_events\\_json\\_%')\n "); // Put an settings updated message on the screen ?> <div class="updated"><p><strong><?php _e('Settings saved.', 'custom-facebook-feed'); ?> </strong></p></div> <?php } ?> <div id="cff-admin" class="wrap"> <div id="header"> <h2><?php _e('Custom Facebook Feed Settings'); ?> </h2> </div> <?php $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'configuration'; ?> <h2 class="nav-tab-wrapper"> <a href="?page=cff-top&tab=configuration" class="nav-tab <?php echo $active_tab == 'configuration' ? 'nav-tab-active' : ''; ?> "><?php _e('Configuration'); ?> </a> <a href="?page=cff-style" class="nav-tab <?php echo $active_tab == 'customize' ? 'nav-tab-active' : ''; ?> "><?php _e('Customize'); ?> </a> <a href="?page=cff-top&tab=support" class="nav-tab <?php echo $active_tab == 'support' ? 'nav-tab-active' : ''; ?> "><?php _e('Support'); ?> </a> </h2> <?php if ($active_tab == 'configuration') { //Start Extensions tab ?> <form name="form1" method="post" action=""> <input type="hidden" name="<?php echo $hidden_field_name; ?> " value="Y"> <br /> <h3><?php _e('Configuration'); ?> </h3> <table class="form-table"> <tbody> <tr valign="top"> <th scope="row"><?php _e('Facebook Page ID<br /><i style="font-weight: normal; font-size: 12px;">ID of your Facebook Page or Group</i>'); ?> </th> <td> <input name="cff_page_id" id="cff_page_id" type="text" value="<?php esc_attr_e($page_id_val); ?> " size="45" /> <a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e('What\'s my Page ID?'); ?> </a> <br /><i style="color: #666; font-size: 11px;">Eg. 1234567890123 or smashballoon</i> <div class="cff-tooltip cff-more-info"> <ul> <li><?php _e('If you have a Facebook <b>page</b> with a URL like this: <code>https://www.facebook.com/your_page_name</code> then the Page ID is just <b>your_page_name</b>. If your page URL is structured like this: <code>https://www.facebook.com/pages/your_page_name/123654123654123</code> then the Page ID is actually the number at the end, so in this case <b>123654123654123</b>.</li>'); ?> <li><?php _e('If you have a Facebook <b>group</b> then use <a href="http://lookup-id.com/" target="_blank" title="Find my ID">this tool</a> to find your ID.'); ?> </li> <li><?php _e('You can copy and paste your ID into the <a href="https://smashballoon.com/custom-facebook-feed/demo/" target="_blank">demo</a> to test it.'); ?> </li> </ul> </div> </td> </tr> <tr valign="top"> <th scope="row" style="padding-bottom: 10px;"><?php _e('Enter my own Access Token <i style="font-weight: normal; font-size: 12px;">This is Recommended</i>'); ?> </th> <td> <input name="cff_show_access_token" type="checkbox" id="cff_show_access_token" <?php if ($show_access_token_val == true) { echo "checked"; } ?> /> <a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e("What is this?"); ?> </a> <p class="cff-tooltip cff-more-info"><?php _e("A Facebook Access Token is not required to use this plugin, but we recommend it so that you're not reliant on the token built into the plugin. If you have your own token then you can check this box and enter it here. To get your own Access Token you can follow these <a href='https://smashballoon.com/custom-facebook-feed/access-token/' target='_blank'>step-by-step instructions</a>"); ?> .</p> </td> </tr> <tr valign="top" class="cff-access-token-hidden"> <th scope="row" style="padding-bottom: 10px;"><?php _e('Facebook Access Token'); ?> </th> <td> <input name="cff_access_token" id="cff_access_token" type="text" value="<?php esc_attr_e($access_token_val); ?> " size="45" /> <div class="cff-notice cff-profile-error cff-access-token"> <?php _e("<p>This doesn't appear to be an Access Token. Please be sure that you didn't enter your App Secret instead of your Access Token.<br />Your App ID and App Secret are used to obtain your Access Token; simply paste them into the fields in the last step of the <a href='https://smashballoon.com/custom-facebook-feed/access-token/' target='_blank'>Access Token instructions</a> and click '<b>Get my Access Token</b>'.</p>"); ?> </div> </td> </tr> </tbody> </table> <hr /> <table class="form-table"> <tbody> <h3><?php _e('Settings'); ?> </h3> <tr valign="top" class="cff-page-type"> <th scope="row"><?php _e('Is this a page, group or profile?'); ?> </th> <td> <select name="cff_page_type"> <option value="page" <?php if ($cff_page_type_val == "page") { echo 'selected="selected"'; } ?> ><?php _e('Page'); ?> </option> <option value="group" <?php if ($cff_page_type_val == "group") { echo 'selected="selected"'; } ?> ><?php _e('Group'); ?> </option> <option value="profile" <?php if ($cff_page_type_val == "profile") { echo 'selected="selected"'; } ?> ><?php _e('Profile'); ?> </option> </select> <div class="cff-notice cff-profile-error cff-page-type"> <?php _e("<p>Due to Facebook's privacy policy you're not able to display posts from a personal profile, only from a public page or group.</p><p>If you're using a profile to represent a business, organization, product, public figure or the like, then Facebook recommends <a href='http://www.facebook.com/help/175644189234902/' target='_blank'>converting your profile to a page</a>. There are many advantages to using pages over profiles, and once you've converted then the plugin will be able to successfully retrieve and display all of your posts.</p>"); ?> </div> </td> </tr> <tr valign="top" class="cff-page-options"> <th scope="row"><?php _e('Show posts on my page by:'); ?> </th> <td> <select name="cff_show_others" id="cff_show_others" style="width: 250px;"> <option value="me" <?php if ($cff_show_others_val == 'me') { echo 'selected="selected"'; } ?> ><?php _e('Only the page owner (me)'); ?> </option> <option value="others" <?php if ($cff_show_others_val == 'others' || $cff_show_others_val == 'on') { echo 'selected="selected"'; } ?> ><?php _e('Page owner + other people'); ?> </option> <option value="onlyothers" <?php if ($cff_show_others_val == 'onlyothers') { echo 'selected="selected"'; } ?> ><?php _e('Only other people'); ?> </option> </select> <p id="cff-others-only" style="font-size: 12px;"><b>Note:</b> Only displaying posts by other people works by retrieving your posts from Facebook and then filtering out the posts by the page owner. If this option doesn't display many posts then you can retrieve more by setting the post limit option (below) to a higher number (a number 15-20 greater than the number of posts you want to display).</p> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Number of posts to display'); ?> </th> <td> <input name="cff_num_show" type="text" value="<?php esc_attr_e($num_show_val); ?> " size="4" /> <i style="color: #666; font-size: 11px;">Eg. 5</i> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Change the post limit'); ?> </th> <td> <input name="cff_post_limit" type="text" value="<?php esc_attr_e($cff_post_limit_val); ?> " size="4" /> <i style="color: #666; font-size: 11px;">Eg. 50</i> <a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e('What does this mean?'); ?> </a> <p class="cff-tooltip cff-more-info"><?php _e("Most users don't need to change the post lmit. The 'limit' is the number of posts retrieved from the Facebook API. By default the plugin retrieves 7 posts more from the Facebook API than you specify in the 'Number of posts to display' field above, as some posts are filtered out. You can alter how many posts are retrieved by manually setting this value. If you choose to retrieve a high number of posts then it will take longer for Facebook to return the posts when the plugin checks for new ones."); ?> </p> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Check for new Facebook posts every'); ?> </th> <td> <input name="cff_cache_time" type="text" value="<?php esc_attr_e($cff_cache_time_val); ?> " size="4" /> <select name="cff_cache_time_unit"> <option value="minutes" <?php if ($cff_cache_time_unit_val == "minutes") { echo 'selected="selected"'; } ?> ><?php _e('Minutes'); ?> </option> <option value="hours" <?php if ($cff_cache_time_unit_val == "hours") { echo 'selected="selected"'; } ?> ><?php _e('Hours'); ?> </option> <option value="days" <?php if ($cff_cache_time_unit_val == "days") { echo 'selected="selected"'; } ?> ><?php _e('Days'); ?> </option> </select> <a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e('What does this mean?'); ?> </a> <p class="cff-tooltip cff-more-info"><?php _e('Your Facebook posts and comments data is temporarily cached by the plugin in your WordPress database. You can choose how long this data should be cached for. If you set the time to 60 minutes then the plugin will clear the cached data after that length of time, and the next time the page is viewed it will check for new data.'); ?> </p> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Localization'); ?> </th> <td> <select name="cff_locale"> <option value="af_ZA" <?php if ($cff_locale_val == "af_ZA") { echo 'selected="selected"'; } ?> ><?php _e('Afrikaans'); ?> </option> <option value="ar_AR" <?php if ($cff_locale_val == "ar_AR") { echo 'selected="selected"'; } ?> ><?php _e('Arabic'); ?> </option> <option value="az_AZ" <?php if ($cff_locale_val == "az_AZ") { echo 'selected="selected"'; } ?> ><?php _e('Azerbaijani'); ?> </option> <option value="be_BY" <?php if ($cff_locale_val == "be_BY") { echo 'selected="selected"'; } ?> ><?php _e('Belarusian'); ?> </option> <option value="bg_BG" <?php if ($cff_locale_val == "bg_BG") { echo 'selected="selected"'; } ?> ><?php _e('Bulgarian'); ?> </option> <option value="bn_IN" <?php if ($cff_locale_val == "bn_IN") { echo 'selected="selected"'; } ?> ><?php _e('Bengali'); ?> </option> <option value="bs_BA" <?php if ($cff_locale_val == "bs_BA") { echo 'selected="selected"'; } ?> ><?php _e('Bosnian'); ?> </option> <option value="ca_ES" <?php if ($cff_locale_val == "ca_ES") { echo 'selected="selected"'; } ?> ><?php _e('Catalan'); ?> </option> <option value="cs_CZ" <?php if ($cff_locale_val == "cs_CZ") { echo 'selected="selected"'; } ?> ><?php _e('Czech'); ?> </option> <option value="cy_GB" <?php if ($cff_locale_val == "cy_GB") { echo 'selected="selected"'; } ?> ><?php _e('Welsh'); ?> </option> <option value="da_DK" <?php if ($cff_locale_val == "da_DK") { echo 'selected="selected"'; } ?> ><?php _e('Danish'); ?> </option> <option value="de_DE" <?php if ($cff_locale_val == "de_DE") { echo 'selected="selected"'; } ?> ><?php _e('German'); ?> </option> <option value="el_GR" <?php if ($cff_locale_val == "el_GR") { echo 'selected="selected"'; } ?> ><?php _e('Greek'); ?> </option> <option value="en_GB" <?php if ($cff_locale_val == "en_GB") { echo 'selected="selected"'; } ?> ><?php _e('English (UK)'); ?> </option> <option value="en_PI" <?php if ($cff_locale_val == "en_PI") { echo 'selected="selected"'; } ?> ><?php _e('English (Pirate)'); ?> </option> <option value="en_UD" <?php if ($cff_locale_val == "en_UD") { echo 'selected="selected"'; } ?> ><?php _e('English (Upside Down)'); ?> </option> <option value="en_US" <?php if ($cff_locale_val == "en_US") { echo 'selected="selected"'; } ?> ><?php _e('English (US)'); ?> </option> <option value="eo_EO" <?php if ($cff_locale_val == "eo_EO") { echo 'selected="selected"'; } ?> ><?php _e('Esperanto'); ?> </option> <option value="es_ES" <?php if ($cff_locale_val == "es_ES") { echo 'selected="selected"'; } ?> ><?php _e('Spanish (Spain)'); ?> </option> <option value="es_LA" <?php if ($cff_locale_val == "es_LA") { echo 'selected="selected"'; } ?> ><?php _e('Spanish'); ?> </option> <option value="et_EE" <?php if ($cff_locale_val == "et_EE") { echo 'selected="selected"'; } ?> ><?php _e('Estonian'); ?> </option> <option value="eu_ES" <?php if ($cff_locale_val == "eu_ES") { echo 'selected="selected"'; } ?> ><?php _e('Basque'); ?> </option> <option value="fa_IR" <?php if ($cff_locale_val == "fa_IR") { echo 'selected="selected"'; } ?> ><?php _e('Persian'); ?> </option> <option value="fb_LT" <?php if ($cff_locale_val == "fb_LT") { echo 'selected="selected"'; } ?> ><?php _e('Leet Speak'); ?> </option> <option value="fi_FI" <?php if ($cff_locale_val == "fi_FI") { echo 'selected="selected"'; } ?> ><?php _e('Finnish'); ?> </option> <option value="fo_FO" <?php if ($cff_locale_val == "fo_FO") { echo 'selected="selected"'; } ?> ><?php _e('Faroese'); ?> </option> <option value="fr_CA" <?php if ($cff_locale_val == "fr_CA") { echo 'selected="selected"'; } ?> ><?php _e('French (Canada)'); ?> </option> <option value="fr_FR" <?php if ($cff_locale_val == "fr_FR") { echo 'selected="selected"'; } ?> ><?php _e('French (France)'); ?> </option> <option value="fy_NL" <?php if ($cff_locale_val == "fy_NL") { echo 'selected="selected"'; } ?> ><?php _e('Frisian'); ?> </option> <option value="ga_IE" <?php if ($cff_locale_val == "ga_IE") { echo 'selected="selected"'; } ?> ><?php _e('Irish'); ?> </option> <option value="gl_ES" <?php if ($cff_locale_val == "gl_ES") { echo 'selected="selected"'; } ?> ><?php _e('Galician'); ?> </option> <option value="he_IL" <?php if ($cff_locale_val == "he_IL") { echo 'selected="selected"'; } ?> ><?php _e('Hebrew'); ?> </option> <option value="hi_IN" <?php if ($cff_locale_val == "hi_IN") { echo 'selected="selected"'; } ?> ><?php _e('Hindi'); ?> </option> <option value="hr_HR" <?php if ($cff_locale_val == "hr_HR") { echo 'selected="selected"'; } ?> ><?php _e('Croatian'); ?> </option> <option value="hu_HU" <?php if ($cff_locale_val == "hu_HU") { echo 'selected="selected"'; } ?> ><?php _e('Hungarian'); ?> </option> <option value="hy_AM" <?php if ($cff_locale_val == "hy_AM") { echo 'selected="selected"'; } ?> ><?php _e('Armenian'); ?> </option> <option value="id_ID" <?php if ($cff_locale_val == "id_ID") { echo 'selected="selected"'; } ?> ><?php _e('Indonesian'); ?> </option> <option value="is_IS" <?php if ($cff_locale_val == "is_IS") { echo 'selected="selected"'; } ?> ><?php _e('Icelandic'); ?> </option> <option value="it_IT" <?php if ($cff_locale_val == "it_IT") { echo 'selected="selected"'; } ?> ><?php _e('Italian'); ?> </option> <option value="ja_JP" <?php if ($cff_locale_val == "ja_JP") { echo 'selected="selected"'; } ?> ><?php _e('Japanese'); ?> </option> <option value="ka_GE" <?php if ($cff_locale_val == "ka_GE") { echo 'selected="selected"'; } ?> ><?php _e('Georgian'); ?> </option> <option value="km_KH" <?php if ($cff_locale_val == "km_KH") { echo 'selected="selected"'; } ?> ><?php _e('Khmer'); ?> </option> <option value="ko_KR" <?php if ($cff_locale_val == "ko_KR") { echo 'selected="selected"'; } ?> ><?php _e('Korean'); ?> </option> <option value="ku_TR" <?php if ($cff_locale_val == "ku_TR") { echo 'selected="selected"'; } ?> ><?php _e('Kurdish'); ?> </option> <option value="la_VA" <?php if ($cff_locale_val == "la_VA") { echo 'selected="selected"'; } ?> ><?php _e('Latin'); ?> </option> <option value="lt_LT" <?php if ($cff_locale_val == "lt_LT") { echo 'selected="selected"'; } ?> ><?php _e('Lithuanian'); ?> </option> <option value="lv_LV" <?php if ($cff_locale_val == "lv_LV") { echo 'selected="selected"'; } ?> ><?php _e('Latvian'); ?> </option> <option value="mk_MK" <?php if ($cff_locale_val == "mk_MK") { echo 'selected="selected"'; } ?> ><?php _e('Macedonian'); ?> </option> <option value="ml_IN" <?php if ($cff_locale_val == "ml_IN") { echo 'selected="selected"'; } ?> ><?php _e('Malayalam'); ?> </option> <option value="ms_MY" <?php if ($cff_locale_val == "ms_MY") { echo 'selected="selected"'; } ?> ><?php _e('Malay'); ?> </option> <option value="nb_NO" <?php if ($cff_locale_val == "nb_NO") { echo 'selected="selected"'; } ?> ><?php _e('Norwegian (bokmal)'); ?> </option> <option value="ne_NP" <?php if ($cff_locale_val == "ne_NP") { echo 'selected="selected"'; } ?> ><?php _e('Nepali'); ?> </option> <option value="nl_NL" <?php if ($cff_locale_val == "nl_NL") { echo 'selected="selected"'; } ?> ><?php _e('Dutch'); ?> </option> <option value="nn_NO" <?php if ($cff_locale_val == "nn_NO") { echo 'selected="selected"'; } ?> ><?php _e('Norwegian (nynorsk)'); ?> </option> <option value="pa_IN" <?php if ($cff_locale_val == "pa_IN") { echo 'selected="selected"'; } ?> ><?php _e('Punjabi'); ?> </option> <option value="pl_PL" <?php if ($cff_locale_val == "pl_PL") { echo 'selected="selected"'; } ?> ><?php _e('Polish'); ?> </option> <option value="ps_AF" <?php if ($cff_locale_val == "ps_AF") { echo 'selected="selected"'; } ?> ><?php _e('Pashto'); ?> </option> <option value="pt_BR" <?php if ($cff_locale_val == "pt_BR") { echo 'selected="selected"'; } ?> ><?php _e('Portuguese (Brazil)'); ?> </option> <option value="pt_PT" <?php if ($cff_locale_val == "pt_PT") { echo 'selected="selected"'; } ?> ><?php _e('Portuguese (Portugal)'); ?> </option> <option value="ro_RO" <?php if ($cff_locale_val == "ro_RO") { echo 'selected="selected"'; } ?> ><?php _e('Romanian'); ?> </option> <option value="ru_RU" <?php if ($cff_locale_val == "ru_RU") { echo 'selected="selected"'; } ?> ><?php _e('Russian'); ?> </option> <option value="sk_SK" <?php if ($cff_locale_val == "sk_SK") { echo 'selected="selected"'; } ?> ><?php _e('Slovak'); ?> </option> <option value="sl_SI" <?php if ($cff_locale_val == "sl_SI") { echo 'selected="selected"'; } ?> ><?php _e('Slovenian'); ?> </option> <option value="sq_AL" <?php if ($cff_locale_val == "sq_AL") { echo 'selected="selected"'; } ?> ><?php _e('Albanian'); ?> </option> <option value="sr_RS" <?php if ($cff_locale_val == "sr_RS") { echo 'selected="selected"'; } ?> ><?php _e('Serbian'); ?> </option> <option value="sv_SE" <?php if ($cff_locale_val == "sv_SE") { echo 'selected="selected"'; } ?> ><?php _e('Swedish'); ?> </option> <option value="sw_KE" <?php if ($cff_locale_val == "sw_KE") { echo 'selected="selected"'; } ?> ><?php _e('Swahili'); ?> </option> <option value="ta_IN" <?php if ($cff_locale_val == "ta_IN") { echo 'selected="selected"'; } ?> ><?php _e('Tamil'); ?> </option> <option value="te_IN" <?php if ($cff_locale_val == "te_IN") { echo 'selected="selected"'; } ?> ><?php _e('Telugu'); ?> </option> <option value="th_TH" <?php if ($cff_locale_val == "th_TH") { echo 'selected="selected"'; } ?> ><?php _e('Thai'); ?> </option> <option value="tl_PH" <?php if ($cff_locale_val == "tl_PH") { echo 'selected="selected"'; } ?> ><?php _e('Filipino'); ?> </option> <option value="tr_TR" <?php if ($cff_locale_val == "tr_TR") { echo 'selected="selected"'; } ?> ><?php _e('Turkish'); ?> </option> <option value="uk_UA" <?php if ($cff_locale_val == "uk_UA") { echo 'selected="selected"'; } ?> ><?php _e('Ukrainian'); ?> </option> <option value="vi_VN" <?php if ($cff_locale_val == "vi_VN") { echo 'selected="selected"'; } ?> ><?php _e('Vietnamese'); ?> </option> <option value="zh_CN" <?php if ($cff_locale_val == "zh_CN") { echo 'selected="selected"'; } ?> ><?php _e('Simplified Chinese (China)'); ?> </option> <option value="zh_HK" <?php if ($cff_locale_val == "zh_HK") { echo 'selected="selected"'; } ?> ><?php _e('Traditional Chinese (Hong Kong)'); ?> </option> <option value="zh_TW" <?php if ($cff_locale_val == "zh_TW") { echo 'selected="selected"'; } ?> ><?php _e('Traditional Chinese (Taiwan)'); ?> </option> </select> <i style="color: #666; font-size: 11px;"><?php _e('Select a language'); ?> </i> </td> </tr> </tbody> </table> <?php submit_button(); ?> <p>Having trouble using the plugin? Check out the <a href='admin.php?page=cff-top&tab=support'>Support</a> tab.</p> </form> <hr /> <h3><?php _e('Displaying your Feed'); ?> </h3> <p><?php _e("Copy and paste this shortcode directly into the page, post or widget where you'd like the feed to show up:"); ?> </p> <input type="text" value="[custom-facebook-feed]" size="22" readonly="readonly" onclick="this.focus();this.select()" title="<?php _e('To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac).'); ?> " /> <hr /> <h3><?php _e('Customizing your Feed'); ?> </h3> <p><?php _e("Use the <a href='admin.php?page=cff-style'>Customize</a> page to customize your feed. If you're displaying multiple feeds then you can override your settings and customizations by using options directly in the shortcode, like so:"); ?> </p> <p>[custom-facebook-feed id=some-other-page-id num=3 height=500px]</p> <p><a href="https://smashballoon.com/custom-facebook-feed/docs/shortcodes/" target="_blank"><?php _e('See a full list of shortcode options'); ?> </a></p> <br /> <a href="https://smashballoon.com/custom-facebook-feed/demo" target="_blank"><img src="<?php echo plugins_url('img/pro.png', __FILE__); ?> " /></a> <hr /> <h3><?php _e('Like the plugin? Help spread the word!'); ?> </h3> <!-- TWITTER --> <a href="https://twitter.com/share" class="twitter-share-button" data-url="https://wordpress.org/plugins/custom-facebook-feed/" data-text="Display your Facebook posts on your site your way using the Custom Facebook Feed WordPress plugin!" data-via="smashballoon" data-dnt="true">Tweet</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> <style type="text/css"> #twitter-widget-0{ float: left; width: 100px !important; } .IN-widget{ margin-right: 20px; } </style> <!-- FACEBOOK --> <div id="fb-root" style="display: none;"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&appId=640861236031365&version=v2.0"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <div class="fb-like" data-href="https://wordpress.org/plugins/custom-facebook-feed/" data-layout="button_count" data-action="like" data-show-faces="false" data-share="true" style="display: block; float: left; margin-right: 20px;"></div> <!-- LINKEDIN --> <script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US </script> <script type="IN/Share" data-url="https://wordpress.org/plugins/custom-facebook-feed/"></script> <!-- GOOGLE + --> <script src="https://apis.google.com/js/platform.js" async defer></script> <div class="g-plusone" data-size="medium" data-href="https://wordpress.org/plugins/custom-facebook-feed/"></div> <?php } //End config tab ?> <?php if ($active_tab == 'support') { //Start Support tab ?> <br /> <h3><?php _e('FAQs and Troubleshooting'); ?> </h3> <p>Having trouble getting the plugin to work? Try the links below:</p> <ul> <li>- <?php _e('<a href="https://smashballoon.com/custom-facebook-feed/faq/general/" target="_blank">General Questions</a>'); ?> </li> <li>- <?php _e('<a href="https://smashballoon.com/custom-facebook-feed/faq/setup/" target="_blank">Setting Up & Displaying your Feed</a>'); ?> </li> <li>- <?php _e('<a href="https://smashballoon.com/custom-facebook-feed/faq/troubleshooting/" target="_blank">Troubleshooting & Common Support Questions</a>'); ?> </li> </ul> <br /> <h3>Documentation</h3> <p>Need help setting up, configuring or customizing the plugin? Check out the links below:</p> <ul> <li>- <?php _e('<a href="https://smashballoon.com/custom-facebook-feed/docs/wordpress/" target="_blank">Installation and Configuration</a>'); ?> </li> <li>- <?php _e('<a href="https://smashballoon.com/custom-facebook-feed/docs/shortcodes/" target="_blank">Shortcode Reference</a>'); ?> </li> <li>- <?php _e('<a href="https://smashballoon.com/custom-facebook-feed/docs/snippets/" target="_blank">Custom CSS and JavaScript Snippets</a>'); ?> </li> </ul> <br /> <p><?php _e('Still need help? <a href="http://smashballoon.com/custom-facebook-feed/support/" target="_blank">Request support</a>. Please include your <b>System Info</b> below with all support requests.'); ?> </p> <br /> <h3><?php _e('System Info <i style="color: #666; font-size: 11px; font-weight: normal;">Click the text below to select all</i>'); ?> </h3> <?php $access_token = get_option($access_token); if ($access_token == '' || empty($access_token)) { $access_token = '611606915581035|RdRHbHtrHseQw4C7SDUBFWIrJLA'; } ?> <?php $posts_json = cff_fetchUrl("https://graph.facebook.com/" . get_option(trim($page_id)) . "/feed?access_token=" . trim($access_token) . "&limit=1"); ?> <textarea readonly="readonly" onclick="this.focus();this.select()" title="To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac)." style="width: 70%; height: 500px; white-space: pre; font-family: Menlo,Monaco,monospace;"> ## SITE/SERVER INFO: ## Site URL: <?php echo site_url() . "\n"; ?> Home URL: <?php echo home_url() . "\n"; ?> WordPress Version: <?php echo get_bloginfo('version') . "\n"; ?> PHP Version: <?php echo PHP_VERSION . "\n"; ?> Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?> PHP allow_url_fopen: <?php echo ini_get('allow_url_fopen') ? "Yes" . "\n" : "No" . "\n"; ?> PHP cURL: <?php echo is_callable('curl_init') ? "Yes" . "\n" : "No" . "\n"; ?> JSON: <?php echo function_exists("json_decode") ? "Yes" . "\n" : "No" . "\n"; ?> SSL Stream: <?php echo in_array('https', stream_get_wrappers()) ? "Yes" . "\n" : "No" . "\n"; ?> ## ACTIVE PLUGINS: ## <?php $plugins = get_plugins(); $active_plugins = get_option('active_plugins', array()); foreach ($plugins as $plugin_path => $plugin) { // If the plugin isn't active, don't show it. if (!in_array($plugin_path, $active_plugins)) { continue; } echo $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; } ?> ## PLUGIN SETTINGS: ## Use own Access Token: <?php echo get_option('cff_show_access_token') . "\n"; ?> Access Token: <?php echo get_option('cff_access_token') . "\n"; ?> Page ID: <?php echo get_option('cff_page_id') . "\n"; ?> Page Type: <?php echo get_option('cff_page_type') . "\n"; ?> Number of Posts: <?php echo get_option('cff_num_show') . "\n"; ?> Post Limit: <?php echo get_option('cff_post_limit') . "\n"; ?> Show Posts by: <?php echo get_option('cff_show_others') . "\n"; ?> Cache Time: <?php echo get_option('cff_cache_time') . "\n"; ?> Cache Unit: <?php echo get_option('cff_cache_time_unit') . "\n"; ?> Locale: <?php echo get_option('cff_locale') . "\n"; ?> Timezone: <?php $options = get_option('cff_style_settings', array()); echo $options['cff_timezone'] . "\n"; ?> ## EXTENSIONS: ## Extensions Plugin: <?php echo get_option('cff_extensions_status') . "\n"; ?> Date Range From: <?php echo get_option('cff_date_from') . "\n"; ?> Date Range Until: <?php echo get_option('cff_date_until') . "\n"; ?> Featured Post: <?php echo get_option('cff_featured_post_id') . "\n"; ?> Lightbox: <?php echo get_option('cff_lightbox') . "\n"; ?> ## CUSTOMIZE: ## <?php while (list($key, $val) = each($options)) { echo "{$key} => {$val}\n"; } ?> ## FACEBOOK API RESPONSE: ## <?php echo $posts_json; ?> </textarea> <?php } ?> <?php }
function cff_settings_page() { //Declare variables for fields $hidden_field_name = 'cff_submit_hidden'; $show_access_token = 'cff_show_access_token'; $access_token = 'cff_access_token'; $page_id = 'cff_page_id'; $cff_page_type = 'cff_page_type'; $num_show = 'cff_num_show'; $cff_post_limit = 'cff_post_limit'; $cff_show_others = 'cff_show_others'; $cff_cache_time = 'cff_cache_time'; $cff_cache_time_unit = 'cff_cache_time_unit'; $cff_locale = 'cff_locale'; // Read in existing option value from database $show_access_token_val = get_option($show_access_token); $access_token_val = get_option($access_token); $page_id_val = get_option($page_id); $cff_page_type_val = get_option($cff_page_type, 'page'); $num_show_val = get_option($num_show, '5'); $cff_post_limit_val = get_option($cff_post_limit); $cff_show_others_val = get_option($cff_show_others); $cff_cache_time_val = get_option($cff_cache_time, '1'); $cff_cache_time_unit_val = get_option($cff_cache_time_unit, 'hours'); $cff_locale_val = get_option($cff_locale, 'en_US'); //Timezone $defaults = array('cff_timezone' => 'America/Chicago'); $options = wp_parse_args(get_option('cff_style_settings'), $defaults); $cff_timezone = $options['cff_timezone']; // See if the user has posted us some information. If they did, this hidden field will be set to 'Y'. if (isset($_POST[$hidden_field_name]) && $_POST[$hidden_field_name] == 'Y') { // Read their posted value isset($_POST[$show_access_token]) ? $show_access_token_val = $_POST[$show_access_token] : ($show_access_token_val = ''); isset($_POST[$access_token]) ? $access_token_val = $_POST[$access_token] : ($access_token_val = ''); isset($_POST[$page_id]) ? $page_id_val = $_POST[$page_id] : ($page_id_val = ''); isset($_POST[$cff_page_type]) ? $cff_page_type_val = $_POST[$cff_page_type] : ($cff_page_type_val = ''); isset($_POST[$num_show]) ? $num_show_val = $_POST[$num_show] : ($num_show_val = ''); isset($_POST[$cff_post_limit]) ? $cff_post_limit_val = $_POST[$cff_post_limit] : ($cff_post_limit_val = ''); isset($_POST[$cff_show_others]) ? $cff_show_others_val = $_POST[$cff_show_others] : ($cff_show_others_val = ''); isset($_POST[$cff_cache_time]) ? $cff_cache_time_val = $_POST[$cff_cache_time] : ($cff_cache_time_val = ''); isset($_POST[$cff_cache_time_unit]) ? $cff_cache_time_unit_val = $_POST[$cff_cache_time_unit] : ($cff_cache_time_unit_val = ''); isset($_POST[$cff_locale]) ? $cff_locale_val = $_POST[$cff_locale] : ($cff_locale_val = ''); if (isset($_POST['cff_timezone'])) { $cff_timezone = $_POST['cff_timezone']; } // Save the posted value in the database update_option($show_access_token, $show_access_token_val); update_option($access_token, $access_token_val); update_option($page_id, $page_id_val); update_option($cff_page_type, $cff_page_type_val); update_option($num_show, $num_show_val); update_option($cff_post_limit, $cff_post_limit_val); update_option($cff_show_others, $cff_show_others_val); update_option($cff_cache_time, $cff_cache_time_val); update_option($cff_cache_time_unit, $cff_cache_time_unit_val); update_option($cff_locale, $cff_locale_val); $options['cff_timezone'] = $cff_timezone; update_option('cff_style_settings', $options); //Delete ALL transients global $wpdb; $table_name = $wpdb->prefix . "options"; $wpdb->query("\n DELETE\n FROM {$table_name}\n WHERE `option_name` LIKE ('%\\_transient\\_cff\\_%')\n "); $wpdb->query("\n DELETE\n FROM {$table_name}\n WHERE `option_name` LIKE ('%\\_transient\\_cff\\_tle\\_%')\n "); $wpdb->query("\n DELETE\n FROM {$table_name}\n WHERE `option_name` LIKE ('%\\_transient\\_timeout\\_cff\\_%')\n "); // Put an settings updated message on the screen ?> <div class="updated"><p><strong><?php _e('Settings saved.', 'custom-facebook-feed'); ?> </strong></p></div> <?php } ?> <div id="cff-admin" class="wrap"> <div id="header"> <h2><?php _e('Custom Facebook Feed Settings'); ?> </h2> </div> <?php $active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'configuration'; ?> <h2 class="nav-tab-wrapper"> <a href="?page=cff-top&tab=configuration" class="nav-tab <?php echo $active_tab == 'configuration' ? 'nav-tab-active' : ''; ?> "><?php _e('Configuration'); ?> </a> <a href="?page=cff-style" class="nav-tab <?php echo $active_tab == 'customize' ? 'nav-tab-active' : ''; ?> "><?php _e('Customize'); ?> </a> <a href="?page=cff-top&tab=support" class="nav-tab <?php echo $active_tab == 'support' ? 'nav-tab-active' : ''; ?> "><?php _e('Support'); ?> </a> </h2> <?php if ($active_tab == 'configuration') { //Start Extensions tab ?> <form name="form1" method="post" action=""> <input type="hidden" name="<?php echo $hidden_field_name; ?> " value="Y"> <br /> <h3><?php _e('Configuration'); ?> </h3> <table class="form-table"> <tbody> <tr valign="top"> <th scope="row"><?php _e('Facebook Page ID<br /><i style="font-weight: normal; font-size: 12px;">ID of your Facebook Page or Group</i>'); ?> </th> <td> <input name="cff_page_id" id="cff_page_id" type="text" value="<?php esc_attr_e($page_id_val); ?> " size="45" /> <a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e('What\'s my Page ID?'); ?> </a> <br /><i style="color: #666; font-size: 11px;">Eg. 1234567890123 or smashballoon</i> <div class="cff-tooltip cff-more-info"> <ul> <li><?php _e('If you have a Facebook <b>page</b> with a URL like this: <code>https://www.facebook.com/your_page_name</code> then the Page ID is just <b>your_page_name</b>. If your page URL is structured like this: <code>https://www.facebook.com/pages/your_page_name/123654123654123</code> then the Page ID is actually the number at the end, so in this case <b>123654123654123</b>.</li>'); ?> <li><?php _e('If you have a Facebook <b>group</b> then use <a href="http://lookup-id.com/" target="_blank" title="Find my ID">this tool</a> to find your ID.'); ?> </li> <li><?php _e('You can copy and paste your ID into the <a href="https://smashballoon.com/custom-facebook-feed/demo/" target="_blank">demo</a> to test it.'); ?> </li> </ul> </div> </td> </tr> <tr valign="top"> <th scope="row" style="padding-bottom: 10px;"><?php _e('Enter my own Access Token <i style="font-weight: normal; font-size: 12px;">This is Recommended</i>'); ?> </th> <td> <input name="cff_show_access_token" type="checkbox" id="cff_show_access_token" <?php if ($show_access_token_val == true) { echo "checked"; } ?> /> <a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e("What is this?"); ?> </a> <p class="cff-tooltip cff-more-info"><?php _e("A Facebook Access Token is not required to use this plugin, but we recommend it so that you're not reliant on the token built into the plugin. If you have your own token then you can check this box and enter it here. To get your own Access Token you can follow these <a href='https://smashballoon.com/custom-facebook-feed/access-token/' target='_blank'>step-by-step instructions</a>"); ?> .</p> </td> </tr> <tr valign="top" class="cff-access-token-hidden"> <th scope="row" style="padding-bottom: 10px;"><?php _e('Facebook Access Token'); ?> </th> <td> <input name="cff_access_token" id="cff_access_token" type="text" value="<?php esc_attr_e($access_token_val); ?> " size="45" /> <div class="cff-notice cff-profile-error cff-access-token"> <?php _e("<p>This doesn't appear to be an Access Token. Please be sure that you didn't enter your App Secret instead of your Access Token.<br />Your App ID and App Secret are used to obtain your Access Token; simply paste them into the fields in the last step of the <a href='https://smashballoon.com/custom-facebook-feed/access-token/' target='_blank'>Access Token instructions</a> and click '<b>Get my Access Token</b>'.</p>"); ?> </div> </td> </tr> </tbody> </table> <hr /> <table class="form-table"> <tbody> <h3><?php _e('Settings'); ?> </h3> <tr valign="top" class="cff-page-type"> <th scope="row"><?php _e('Is this a page, group or profile?'); ?> </th> <td> <select name="cff_page_type"> <option value="page" <?php if ($cff_page_type_val == "page") { echo 'selected="selected"'; } ?> ><?php _e('Page'); ?> </option> <option value="group" <?php if ($cff_page_type_val == "group") { echo 'selected="selected"'; } ?> ><?php _e('Group'); ?> </option> <option value="profile" <?php if ($cff_page_type_val == "profile") { echo 'selected="selected"'; } ?> ><?php _e('Profile'); ?> </option> </select> <div class="cff-notice cff-profile-error cff-page-type"> <?php _e("<p>Due to Facebook's privacy policy you're not able to display posts from a personal profile, only from a public page or group.</p><p>If you're using a profile to represent a business, organization, product, public figure or the like, then Facebook recommends <a href='http://www.facebook.com/help/175644189234902/' target='_blank'>converting your profile to a page</a>. There are many advantages to using pages over profiles, and once you've converted then the plugin will be able to successfully retrieve and display all of your posts.</p>"); ?> </div> </td> </tr> <tr valign="top" class="cff-page-options"> <th scope="row"><?php _e('Show posts on my page by:'); ?> </th> <td> <select name="cff_show_others" id="cff_show_others" style="width: 250px;"> <option value="me" <?php if ($cff_show_others_val == 'me') { echo 'selected="selected"'; } ?> ><?php _e('Only the page owner (me)'); ?> </option> <option value="others" <?php if ($cff_show_others_val == 'others' || $cff_show_others_val == 'on') { echo 'selected="selected"'; } ?> ><?php _e('Page owner + other people'); ?> </option> <option value="onlyothers" <?php if ($cff_show_others_val == 'onlyothers') { echo 'selected="selected"'; } ?> ><?php _e('Only other people'); ?> </option> </select> <p id="cff-others-only" style="font-size: 12px;"><b>Note:</b> Only displaying posts by other people works by retrieving your posts from Facebook and then filtering out the posts by the page owner. If this option doesn't display many posts then you can retrieve more by setting the post limit option (below) to a higher number (a number 15-20 greater than the number of posts you want to display).</p> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Number of posts to display'); ?> </th> <td> <input name="cff_num_show" type="text" value="<?php esc_attr_e($num_show_val); ?> " size="4" /> <i style="color: #666; font-size: 11px;">Eg. 5</i> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Change the post limit'); ?> </th> <td> <input name="cff_post_limit" type="text" value="<?php esc_attr_e($cff_post_limit_val); ?> " size="4" /> <i style="color: #666; font-size: 11px;">Eg. 50</i> <a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e('What does this mean?'); ?> </a> <p class="cff-tooltip cff-more-info"><?php _e("Most users don't need to change the post lmit. The 'limit' is the number of posts retrieved from the Facebook API. By default the plugin retrieves 7 posts more from the Facebook API than you specify in the 'Number of posts to display' field above, as some posts are filtered out. You can alter how many posts are retrieved by manually setting this value. If you choose to retrieve a high number of posts then it will take longer for Facebook to return the posts when the plugin checks for new ones."); ?> </p> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Check for new Facebook posts every'); ?> </th> <td> <input name="cff_cache_time" type="text" value="<?php esc_attr_e($cff_cache_time_val); ?> " size="4" /> <select name="cff_cache_time_unit"> <option value="minutes" <?php if ($cff_cache_time_unit_val == "minutes") { echo 'selected="selected"'; } ?> ><?php _e('Minutes'); ?> </option> <option value="hours" <?php if ($cff_cache_time_unit_val == "hours") { echo 'selected="selected"'; } ?> ><?php _e('Hours'); ?> </option> <option value="days" <?php if ($cff_cache_time_unit_val == "days") { echo 'selected="selected"'; } ?> ><?php _e('Days'); ?> </option> </select> <a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e('What does this mean?'); ?> </a> <p class="cff-tooltip cff-more-info"><?php _e('Your Facebook posts and comments data is temporarily cached by the plugin in your WordPress database. You can choose how long this data should be cached for. If you set the time to 60 minutes then the plugin will clear the cached data after that length of time, and the next time the page is viewed it will check for new data.'); ?> </p> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Localization'); ?> </th> <td> <select name="cff_locale"> <option value="af_ZA" <?php if ($cff_locale_val == "af_ZA") { echo 'selected="selected"'; } ?> ><?php _e('Afrikaans'); ?> </option> <option value="ar_AR" <?php if ($cff_locale_val == "ar_AR") { echo 'selected="selected"'; } ?> ><?php _e('Arabic'); ?> </option> <option value="az_AZ" <?php if ($cff_locale_val == "az_AZ") { echo 'selected="selected"'; } ?> ><?php _e('Azerbaijani'); ?> </option> <option value="be_BY" <?php if ($cff_locale_val == "be_BY") { echo 'selected="selected"'; } ?> ><?php _e('Belarusian'); ?> </option> <option value="bg_BG" <?php if ($cff_locale_val == "bg_BG") { echo 'selected="selected"'; } ?> ><?php _e('Bulgarian'); ?> </option> <option value="bn_IN" <?php if ($cff_locale_val == "bn_IN") { echo 'selected="selected"'; } ?> ><?php _e('Bengali'); ?> </option> <option value="bs_BA" <?php if ($cff_locale_val == "bs_BA") { echo 'selected="selected"'; } ?> ><?php _e('Bosnian'); ?> </option> <option value="ca_ES" <?php if ($cff_locale_val == "ca_ES") { echo 'selected="selected"'; } ?> ><?php _e('Catalan'); ?> </option> <option value="cs_CZ" <?php if ($cff_locale_val == "cs_CZ") { echo 'selected="selected"'; } ?> ><?php _e('Czech'); ?> </option> <option value="cy_GB" <?php if ($cff_locale_val == "cy_GB") { echo 'selected="selected"'; } ?> ><?php _e('Welsh'); ?> </option> <option value="da_DK" <?php if ($cff_locale_val == "da_DK") { echo 'selected="selected"'; } ?> ><?php _e('Danish'); ?> </option> <option value="de_DE" <?php if ($cff_locale_val == "de_DE") { echo 'selected="selected"'; } ?> ><?php _e('German'); ?> </option> <option value="el_GR" <?php if ($cff_locale_val == "el_GR") { echo 'selected="selected"'; } ?> ><?php _e('Greek'); ?> </option> <option value="en_GB" <?php if ($cff_locale_val == "en_GB") { echo 'selected="selected"'; } ?> ><?php _e('English (UK)'); ?> </option> <option value="en_PI" <?php if ($cff_locale_val == "en_PI") { echo 'selected="selected"'; } ?> ><?php _e('English (Pirate)'); ?> </option> <option value="en_UD" <?php if ($cff_locale_val == "en_UD") { echo 'selected="selected"'; } ?> ><?php _e('English (Upside Down)'); ?> </option> <option value="en_US" <?php if ($cff_locale_val == "en_US") { echo 'selected="selected"'; } ?> ><?php _e('English (US)'); ?> </option> <option value="eo_EO" <?php if ($cff_locale_val == "eo_EO") { echo 'selected="selected"'; } ?> ><?php _e('Esperanto'); ?> </option> <option value="es_ES" <?php if ($cff_locale_val == "es_ES") { echo 'selected="selected"'; } ?> ><?php _e('Spanish (Spain)'); ?> </option> <option value="es_LA" <?php if ($cff_locale_val == "es_LA") { echo 'selected="selected"'; } ?> ><?php _e('Spanish'); ?> </option> <option value="et_EE" <?php if ($cff_locale_val == "et_EE") { echo 'selected="selected"'; } ?> ><?php _e('Estonian'); ?> </option> <option value="eu_ES" <?php if ($cff_locale_val == "eu_ES") { echo 'selected="selected"'; } ?> ><?php _e('Basque'); ?> </option> <option value="fa_IR" <?php if ($cff_locale_val == "fa_IR") { echo 'selected="selected"'; } ?> ><?php _e('Persian'); ?> </option> <option value="fb_LT" <?php if ($cff_locale_val == "fb_LT") { echo 'selected="selected"'; } ?> ><?php _e('Leet Speak'); ?> </option> <option value="fi_FI" <?php if ($cff_locale_val == "fi_FI") { echo 'selected="selected"'; } ?> ><?php _e('Finnish'); ?> </option> <option value="fo_FO" <?php if ($cff_locale_val == "fo_FO") { echo 'selected="selected"'; } ?> ><?php _e('Faroese'); ?> </option> <option value="fr_CA" <?php if ($cff_locale_val == "fr_CA") { echo 'selected="selected"'; } ?> ><?php _e('French (Canada)'); ?> </option> <option value="fr_FR" <?php if ($cff_locale_val == "fr_FR") { echo 'selected="selected"'; } ?> ><?php _e('French (France)'); ?> </option> <option value="fy_NL" <?php if ($cff_locale_val == "fy_NL") { echo 'selected="selected"'; } ?> ><?php _e('Frisian'); ?> </option> <option value="ga_IE" <?php if ($cff_locale_val == "ga_IE") { echo 'selected="selected"'; } ?> ><?php _e('Irish'); ?> </option> <option value="gl_ES" <?php if ($cff_locale_val == "gl_ES") { echo 'selected="selected"'; } ?> ><?php _e('Galician'); ?> </option> <option value="he_IL" <?php if ($cff_locale_val == "he_IL") { echo 'selected="selected"'; } ?> ><?php _e('Hebrew'); ?> </option> <option value="hi_IN" <?php if ($cff_locale_val == "hi_IN") { echo 'selected="selected"'; } ?> ><?php _e('Hindi'); ?> </option> <option value="hr_HR" <?php if ($cff_locale_val == "hr_HR") { echo 'selected="selected"'; } ?> ><?php _e('Croatian'); ?> </option> <option value="hu_HU" <?php if ($cff_locale_val == "hu_HU") { echo 'selected="selected"'; } ?> ><?php _e('Hungarian'); ?> </option> <option value="hy_AM" <?php if ($cff_locale_val == "hy_AM") { echo 'selected="selected"'; } ?> ><?php _e('Armenian'); ?> </option> <option value="id_ID" <?php if ($cff_locale_val == "id_ID") { echo 'selected="selected"'; } ?> ><?php _e('Indonesian'); ?> </option> <option value="is_IS" <?php if ($cff_locale_val == "is_IS") { echo 'selected="selected"'; } ?> ><?php _e('Icelandic'); ?> </option> <option value="it_IT" <?php if ($cff_locale_val == "it_IT") { echo 'selected="selected"'; } ?> ><?php _e('Italian'); ?> </option> <option value="ja_JP" <?php if ($cff_locale_val == "ja_JP") { echo 'selected="selected"'; } ?> ><?php _e('Japanese'); ?> </option> <option value="ka_GE" <?php if ($cff_locale_val == "ka_GE") { echo 'selected="selected"'; } ?> ><?php _e('Georgian'); ?> </option> <option value="km_KH" <?php if ($cff_locale_val == "km_KH") { echo 'selected="selected"'; } ?> ><?php _e('Khmer'); ?> </option> <option value="ko_KR" <?php if ($cff_locale_val == "ko_KR") { echo 'selected="selected"'; } ?> ><?php _e('Korean'); ?> </option> <option value="ku_TR" <?php if ($cff_locale_val == "ku_TR") { echo 'selected="selected"'; } ?> ><?php _e('Kurdish'); ?> </option> <option value="la_VA" <?php if ($cff_locale_val == "la_VA") { echo 'selected="selected"'; } ?> ><?php _e('Latin'); ?> </option> <option value="lt_LT" <?php if ($cff_locale_val == "lt_LT") { echo 'selected="selected"'; } ?> ><?php _e('Lithuanian'); ?> </option> <option value="lv_LV" <?php if ($cff_locale_val == "lv_LV") { echo 'selected="selected"'; } ?> ><?php _e('Latvian'); ?> </option> <option value="mk_MK" <?php if ($cff_locale_val == "mk_MK") { echo 'selected="selected"'; } ?> ><?php _e('Macedonian'); ?> </option> <option value="ml_IN" <?php if ($cff_locale_val == "ml_IN") { echo 'selected="selected"'; } ?> ><?php _e('Malayalam'); ?> </option> <option value="ms_MY" <?php if ($cff_locale_val == "ms_MY") { echo 'selected="selected"'; } ?> ><?php _e('Malay'); ?> </option> <option value="nb_NO" <?php if ($cff_locale_val == "nb_NO") { echo 'selected="selected"'; } ?> ><?php _e('Norwegian (bokmal)'); ?> </option> <option value="ne_NP" <?php if ($cff_locale_val == "ne_NP") { echo 'selected="selected"'; } ?> ><?php _e('Nepali'); ?> </option> <option value="nl_NL" <?php if ($cff_locale_val == "nl_NL") { echo 'selected="selected"'; } ?> ><?php _e('Dutch'); ?> </option> <option value="nn_NO" <?php if ($cff_locale_val == "nn_NO") { echo 'selected="selected"'; } ?> ><?php _e('Norwegian (nynorsk)'); ?> </option> <option value="pa_IN" <?php if ($cff_locale_val == "pa_IN") { echo 'selected="selected"'; } ?> ><?php _e('Punjabi'); ?> </option> <option value="pl_PL" <?php if ($cff_locale_val == "pl_PL") { echo 'selected="selected"'; } ?> ><?php _e('Polish'); ?> </option> <option value="ps_AF" <?php if ($cff_locale_val == "ps_AF") { echo 'selected="selected"'; } ?> ><?php _e('Pashto'); ?> </option> <option value="pt_BR" <?php if ($cff_locale_val == "pt_BR") { echo 'selected="selected"'; } ?> ><?php _e('Portuguese (Brazil)'); ?> </option> <option value="pt_PT" <?php if ($cff_locale_val == "pt_PT") { echo 'selected="selected"'; } ?> ><?php _e('Portuguese (Portugal)'); ?> </option> <option value="ro_RO" <?php if ($cff_locale_val == "ro_RO") { echo 'selected="selected"'; } ?> ><?php _e('Romanian'); ?> </option> <option value="ru_RU" <?php if ($cff_locale_val == "ru_RU") { echo 'selected="selected"'; } ?> ><?php _e('Russian'); ?> </option> <option value="sk_SK" <?php if ($cff_locale_val == "sk_SK") { echo 'selected="selected"'; } ?> ><?php _e('Slovak'); ?> </option> <option value="sl_SI" <?php if ($cff_locale_val == "sl_SI") { echo 'selected="selected"'; } ?> ><?php _e('Slovenian'); ?> </option> <option value="sq_AL" <?php if ($cff_locale_val == "sq_AL") { echo 'selected="selected"'; } ?> ><?php _e('Albanian'); ?> </option> <option value="sr_RS" <?php if ($cff_locale_val == "sr_RS") { echo 'selected="selected"'; } ?> ><?php _e('Serbian'); ?> </option> <option value="sv_SE" <?php if ($cff_locale_val == "sv_SE") { echo 'selected="selected"'; } ?> ><?php _e('Swedish'); ?> </option> <option value="sw_KE" <?php if ($cff_locale_val == "sw_KE") { echo 'selected="selected"'; } ?> ><?php _e('Swahili'); ?> </option> <option value="ta_IN" <?php if ($cff_locale_val == "ta_IN") { echo 'selected="selected"'; } ?> ><?php _e('Tamil'); ?> </option> <option value="te_IN" <?php if ($cff_locale_val == "te_IN") { echo 'selected="selected"'; } ?> ><?php _e('Telugu'); ?> </option> <option value="th_TH" <?php if ($cff_locale_val == "th_TH") { echo 'selected="selected"'; } ?> ><?php _e('Thai'); ?> </option> <option value="tl_PH" <?php if ($cff_locale_val == "tl_PH") { echo 'selected="selected"'; } ?> ><?php _e('Filipino'); ?> </option> <option value="tr_TR" <?php if ($cff_locale_val == "tr_TR") { echo 'selected="selected"'; } ?> ><?php _e('Turkish'); ?> </option> <option value="uk_UA" <?php if ($cff_locale_val == "uk_UA") { echo 'selected="selected"'; } ?> ><?php _e('Ukrainian'); ?> </option> <option value="vi_VN" <?php if ($cff_locale_val == "vi_VN") { echo 'selected="selected"'; } ?> ><?php _e('Vietnamese'); ?> </option> <option value="zh_CN" <?php if ($cff_locale_val == "zh_CN") { echo 'selected="selected"'; } ?> ><?php _e('Simplified Chinese (China)'); ?> </option> <option value="zh_HK" <?php if ($cff_locale_val == "zh_HK") { echo 'selected="selected"'; } ?> ><?php _e('Traditional Chinese (Hong Kong)'); ?> </option> <option value="zh_TW" <?php if ($cff_locale_val == "zh_TW") { echo 'selected="selected"'; } ?> ><?php _e('Traditional Chinese (Taiwan)'); ?> </option> </select> <i style="color: #666; font-size: 11px;"><?php _e('Select a language'); ?> </i> </td> </tr> <tr> <th><label for="cff_timezone" class="bump-left"><?php _e('Timezone'); ?> </label></th> <td> <select name="cff_timezone" style="width: 300px;"> <option value="Pacific/Midway" <?php if ($cff_timezone == "Pacific/Midway") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-11:00) Midway Island, Samoa'); ?> </option> <option value="America/Adak" <?php if ($cff_timezone == "America/Adak") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-10:00) Hawaii-Aleutian'); ?> </option> <option value="Etc/GMT+10" <?php if ($cff_timezone == "Etc/GMT+10") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-10:00) Hawaii'); ?> </option> <option value="Pacific/Marquesas" <?php if ($cff_timezone == "Pacific/Marquesas") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-09:30) Marquesas Islands'); ?> </option> <option value="Pacific/Gambier" <?php if ($cff_timezone == "Pacific/Gambier") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-09:00) Gambier Islands'); ?> </option> <option value="America/Anchorage" <?php if ($cff_timezone == "America/Anchorage") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-09:00) Alaska'); ?> </option> <option value="America/Ensenada" <?php if ($cff_timezone == "America/Ensenada") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-08:00) Tijuana, Baja California'); ?> </option> <option value="Etc/GMT+8" <?php if ($cff_timezone == "Etc/GMT+8") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-08:00) Pitcairn Islands'); ?> </option> <option value="America/Los_Angeles" <?php if ($cff_timezone == "America/Los_Angeles") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-08:00) Pacific Time (US & Canada)'); ?> </option> <option value="America/Denver" <?php if ($cff_timezone == "America/Denver") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-07:00) Mountain Time (US & Canada)'); ?> </option> <option value="America/Chihuahua" <?php if ($cff_timezone == "America/Chihuahua") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-07:00) Chihuahua, La Paz, Mazatlan'); ?> </option> <option value="America/Dawson_Creek" <?php if ($cff_timezone == "America/Dawson_Creek") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-07:00) Arizona'); ?> </option> <option value="America/Belize" <?php if ($cff_timezone == "America/Belize") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-06:00) Saskatchewan, Central America'); ?> </option> <option value="America/Cancun" <?php if ($cff_timezone == "America/Cancun") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-06:00) Guadalajara, Mexico City, Monterrey'); ?> </option> <option value="Chile/EasterIsland" <?php if ($cff_timezone == "Chile/EasterIsland") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-06:00) Easter Island'); ?> </option> <option value="America/Chicago" <?php if ($cff_timezone == "America/Chicago") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-06:00) Central Time (US & Canada)'); ?> </option> <option value="America/New_York" <?php if ($cff_timezone == "America/New_York") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-05:00) Eastern Time (US & Canada)'); ?> </option> <option value="America/Havana" <?php if ($cff_timezone == "America/Havana") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-05:00) Cuba'); ?> </option> <option value="America/Bogota" <?php if ($cff_timezone == "America/Bogota") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-05:00) Bogota, Lima, Quito, Rio Branco'); ?> </option> <option value="America/Caracas" <?php if ($cff_timezone == "America/Caracas") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-04:30) Caracas'); ?> </option> <option value="America/Santiago" <?php if ($cff_timezone == "America/Santiago") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-04:00) Santiago'); ?> </option> <option value="America/La_Paz" <?php if ($cff_timezone == "America/La_Paz") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-04:00) La Paz'); ?> </option> <option value="Atlantic/Stanley" <?php if ($cff_timezone == "Atlantic/Stanley") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-04:00) Faukland Islands'); ?> </option> <option value="America/Campo_Grande" <?php if ($cff_timezone == "America/Campo_Grande") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-04:00) Brazil'); ?> </option> <option value="America/Goose_Bay" <?php if ($cff_timezone == "America/Goose_Bay") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-04:00) Atlantic Time (Goose Bay)'); ?> </option> <option value="America/Glace_Bay" <?php if ($cff_timezone == "America/Glace_Bay") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-04:00) Atlantic Time (Canada)'); ?> </option> <option value="America/St_Johns" <?php if ($cff_timezone == "America/St_Johns") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-03:30) Newfoundland'); ?> </option> <option value="America/Araguaina" <?php if ($cff_timezone == "America/Araguaina") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-03:00) UTC-3'); ?> </option> <option value="America/Montevideo" <?php if ($cff_timezone == "America/Montevideo") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-03:00) Montevideo'); ?> </option> <option value="America/Miquelon" <?php if ($cff_timezone == "America/Miquelon") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-03:00) Miquelon, St. Pierre'); ?> </option> <option value="America/Godthab" <?php if ($cff_timezone == "America/Godthab") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-03:00) Greenland'); ?> </option> <option value="America/Argentina/Buenos_Aires" <?php if ($cff_timezone == "America/Argentina/Buenos_Aires") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-03:00) Buenos Aires'); ?> </option> <option value="America/Sao_Paulo" <?php if ($cff_timezone == "America/Sao_Paulo") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-03:00) Brasilia'); ?> </option> <option value="America/Noronha" <?php if ($cff_timezone == "America/Noronha") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-02:00) Mid-Atlantic'); ?> </option> <option value="Atlantic/Cape_Verde" <?php if ($cff_timezone == "Atlantic/Cape_Verde") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-01:00) Cape Verde Is.'); ?> </option> <option value="Atlantic/Azores" <?php if ($cff_timezone == "Atlantic/Azores") { echo 'selected="selected"'; } ?> ><?php _e('(GMT-01:00) Azores'); ?> </option> <option value="Europe/Belfast" <?php if ($cff_timezone == "Europe/Belfast") { echo 'selected="selected"'; } ?> ><?php _e('(GMT) Greenwich Mean Time : Belfast'); ?> </option> <option value="Europe/Dublin" <?php if ($cff_timezone == "Europe/Dublin") { echo 'selected="selected"'; } ?> ><?php _e('(GMT) Greenwich Mean Time : Dublin'); ?> </option> <option value="Europe/Lisbon" <?php if ($cff_timezone == "Europe/Lisbon") { echo 'selected="selected"'; } ?> ><?php _e('(GMT) Greenwich Mean Time : Lisbon'); ?> </option> <option value="Europe/London" <?php if ($cff_timezone == "Europe/London") { echo 'selected="selected"'; } ?> ><?php _e('(GMT) Greenwich Mean Time : London'); ?> </option> <option value="Africa/Abidjan" <?php if ($cff_timezone == "Africa/Abidjan") { echo 'selected="selected"'; } ?> ><?php _e('(GMT) Monrovia, Reykjavik'); ?> </option> <option value="Europe/Amsterdam" <?php if ($cff_timezone == "Europe/Amsterdam") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna'); ?> </option> <option value="Europe/Belgrade" <?php if ($cff_timezone == "Europe/Belgrade") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague'); ?> </option> <option value="Europe/Brussels" <?php if ($cff_timezone == "Europe/Brussels") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+01:00) Brussels, Copenhagen, Madrid, Paris'); ?> </option> <option value="Africa/Algiers" <?php if ($cff_timezone == "Africa/Algiers") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+01:00) West Central Africa'); ?> </option> <option value="Africa/Windhoek" <?php if ($cff_timezone == "Africa/Windhoek") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+01:00) Windhoek'); ?> </option> <option value="Asia/Beirut" <?php if ($cff_timezone == "Asia/Beirut") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+02:00) Beirut'); ?> </option> <option value="Africa/Cairo" <?php if ($cff_timezone == "Africa/Cairo") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+02:00) Cairo'); ?> </option> <option value="Asia/Gaza" <?php if ($cff_timezone == "Asia/Gaza") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+02:00) Gaza'); ?> </option> <option value="Africa/Blantyre" <?php if ($cff_timezone == "Africa/Blantyre") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+02:00) Harare, Pretoria'); ?> </option> <option value="Asia/Jerusalem" <?php if ($cff_timezone == "Asia/Jerusalem") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+02:00) Jerusalem'); ?> </option> <option value="Europe/Minsk" <?php if ($cff_timezone == "Europe/Minsk") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+02:00) Minsk'); ?> </option> <option value="Asia/Damascus" <?php if ($cff_timezone == "Asia/Damascus") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+02:00) Syria'); ?> </option> <option value="Europe/Moscow" <?php if ($cff_timezone == "Europe/Moscow") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+03:00) Moscow, St. Petersburg, Volgograd'); ?> </option> <option value="Africa/Addis_Ababa" <?php if ($cff_timezone == "Africa/Addis_Ababa") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+03:00) Nairobi'); ?> </option> <option value="Asia/Tehran" <?php if ($cff_timezone == "Asia/Tehran") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+03:30) Tehran'); ?> </option> <option value="Asia/Dubai" <?php if ($cff_timezone == "Asia/Dubai") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+04:00) Abu Dhabi, Muscat'); ?> </option> <option value="Asia/Yerevan" <?php if ($cff_timezone == "Asia/Yerevan") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+04:00) Yerevan'); ?> </option> <option value="Asia/Kabul" <?php if ($cff_timezone == "Asia/Kabul") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+04:30) Kabul'); ?> </option> <option value="Asia/Yekaterinburg" <?php if ($cff_timezone == "Asia/Yekaterinburg") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+05:00) Ekaterinburg'); ?> </option> <option value="Asia/Tashkent" <?php if ($cff_timezone == "Asia/Tashkent") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+05:00) Tashkent'); ?> </option> <option value="Asia/Kolkata" <?php if ($cff_timezone == "Asia/Kolkata") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi'); ?> </option> <option value="Asia/Katmandu" <?php if ($cff_timezone == "Asia/Katmandu") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+05:45) Kathmandu'); ?> </option> <option value="Asia/Dhaka" <?php if ($cff_timezone == "Asia/Dhaka") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+06:00) Astana, Dhaka'); ?> </option> <option value="Asia/Novosibirsk" <?php if ($cff_timezone == "Asia/Novosibirsk") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+06:00) Novosibirsk'); ?> </option> <option value="Asia/Rangoon" <?php if ($cff_timezone == "Asia/Rangoon") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+06:30) Yangon (Rangoon)'); ?> </option> <option value="Asia/Bangkok" <?php if ($cff_timezone == "Asia/Bangkok") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+07:00) Bangkok, Hanoi, Jakarta'); ?> </option> <option value="Asia/Krasnoyarsk" <?php if ($cff_timezone == "Asia/Krasnoyarsk") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+07:00) Krasnoyarsk'); ?> </option> <option value="Asia/Hong_Kong" <?php if ($cff_timezone == "Asia/Hong_Kong") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi'); ?> </option> <option value="Asia/Irkutsk" <?php if ($cff_timezone == "Asia/Irkutsk") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+08:00) Irkutsk, Ulaan Bataar'); ?> </option> <option value="Australia/Perth" <?php if ($cff_timezone == "Australia/Perth") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+08:00) Perth'); ?> </option> <option value="Australia/Eucla" <?php if ($cff_timezone == "Australia/Eucla") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+08:45) Eucla'); ?> </option> <option value="Asia/Tokyo" <?php if ($cff_timezone == "Asia/Tokyo") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+09:00) Osaka, Sapporo, Tokyo'); ?> </option> <option value="Asia/Seoul" <?php if ($cff_timezone == "Asia/Seoul") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+09:00) Seoul'); ?> </option> <option value="Asia/Yakutsk" <?php if ($cff_timezone == "Asia/Yakutsk") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+09:00) Yakutsk'); ?> </option> <option value="Australia/Adelaide" <?php if ($cff_timezone == "Australia/Adelaide") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+09:30) Adelaide'); ?> </option> <option value="Australia/Darwin" <?php if ($cff_timezone == "Australia/Darwin") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+09:30) Darwin'); ?> </option> <option value="Australia/Brisbane" <?php if ($cff_timezone == "Australia/Brisbane") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+10:00) Brisbane'); ?> </option> <option value="Australia/Hobart" <?php if ($cff_timezone == "Australia/Hobart") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+10:00) Hobart'); ?> </option> <option value="Asia/Vladivostok" <?php if ($cff_timezone == "Asia/Vladivostok") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+10:00) Vladivostok'); ?> </option> <option value="Australia/Lord_Howe" <?php if ($cff_timezone == "Australia/Lord_Howe") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+10:30) Lord Howe Island'); ?> </option> <option value="Etc/GMT-11" <?php if ($cff_timezone == "Etc/GMT-11") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+11:00) Solomon Is., New Caledonia'); ?> </option> <option value="Asia/Magadan" <?php if ($cff_timezone == "Asia/Magadan") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+11:00) Magadan'); ?> </option> <option value="Pacific/Norfolk" <?php if ($cff_timezone == "Pacific/Norfolk") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+11:30) Norfolk Island'); ?> </option> <option value="Asia/Anadyr" <?php if ($cff_timezone == "Asia/Anadyr") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+12:00) Anadyr, Kamchatka'); ?> </option> <option value="Pacific/Auckland" <?php if ($cff_timezone == "Pacific/Auckland") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+12:00) Auckland, Wellington'); ?> </option> <option value="Etc/GMT-12" <?php if ($cff_timezone == "Etc/GMT-12") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+12:00) Fiji, Kamchatka, Marshall Is.'); ?> </option> <option value="Pacific/Chatham" <?php if ($cff_timezone == "Pacific/Chatham") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+12:45) Chatham Islands'); ?> </option> <option value="Pacific/Tongatapu" <?php if ($cff_timezone == "Pacific/Tongatapu") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+13:00) Nuku\'alofa'); ?> </option> <option value="Pacific/Kiritimati" <?php if ($cff_timezone == "Pacific/Kiritimati") { echo 'selected="selected"'; } ?> ><?php _e('(GMT+14:00) Kiritimati'); ?> </option> </select> </td> </tr> </tbody> </table> <?php submit_button(); ?> <p>Having trouble using the plugin? Check out the <a href='admin.php?page=cff-top&tab=support'>Support</a> tab.</p> </form> <hr /> <h3><?php _e('Displaying your Feed'); ?> </h3> <p><?php _e("Copy and paste this shortcode directly into the page, post or widget where you'd like the feed to show up:"); ?> </p> <input type="text" value="[custom-facebook-feed]" size="22" readonly="readonly" onclick="this.focus();this.select()" title="<?php _e('To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac).'); ?> " /> <hr /> <h3><?php _e('Customizing your Feed'); ?> </h3> <p><?php _e("Use the <a href='admin.php?page=cff-style'>Customize</a> page to customize your feed. If you're displaying multiple feeds then you can override your settings and customizations by using options directly in the shortcode, like so:"); ?> </p> <p>[custom-facebook-feed id=some-other-page-id num=3 height=500px]</p> <p><a href="https://smashballoon.com/custom-facebook-feed/docs/shortcodes/" target="_blank"><?php _e('See a full list of shortcode options'); ?> </a></p> <br /> <a href="https://smashballoon.com/custom-facebook-feed/demo" target="_blank"><img src="<?php echo plugins_url('img/pro.png', __FILE__); ?> " /></a> <hr /> <h3><?php _e('Like the plugin? Help spread the word!'); ?> </h3> <!-- TWITTER --> <a href="https://twitter.com/share" class="twitter-share-button" data-url="https://wordpress.org/plugins/custom-facebook-feed/" data-text="Display your Facebook posts on your site your way using the Custom Facebook Feed WordPress plugin!" data-via="smashballoon" data-dnt="true">Tweet</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> <style type="text/css"> #twitter-widget-0{ float: left; width: 100px !important; } .IN-widget{ margin-right: 20px; } </style> <!-- FACEBOOK --> <div id="fb-root" style="display: none;"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&appId=640861236031365&version=v2.0"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <div class="fb-like" data-href="https://wordpress.org/plugins/custom-facebook-feed/" data-layout="button_count" data-action="like" data-show-faces="false" data-share="true" style="display: block; float: left; margin-right: 20px;"></div> <!-- LINKEDIN --> <script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US </script> <script type="IN/Share" data-url="https://wordpress.org/plugins/custom-facebook-feed/"></script> <!-- GOOGLE + --> <script src="https://apis.google.com/js/platform.js" async defer></script> <div class="g-plusone" data-size="medium" data-href="https://wordpress.org/plugins/custom-facebook-feed/"></div> <?php } //End config tab ?> <?php if ($active_tab == 'support') { //Start Support tab ?> <br /> <h3><?php _e('FAQs and Troubleshooting'); ?> </h3> <p>Having trouble getting the plugin to work? Try the links below:</p> <ul> <li>- <?php _e('<a href="https://smashballoon.com/custom-facebook-feed/faq/general/" target="_blank">General Questions</a>'); ?> </li> <li>- <?php _e('<a href="https://smashballoon.com/custom-facebook-feed/faq/setup/" target="_blank">Setting Up & Displaying your Feed</a>'); ?> </li> <li>- <?php _e('<a href="https://smashballoon.com/custom-facebook-feed/faq/troubleshooting/" target="_blank">Troubleshooting & Common Support Questions</a>'); ?> </li> </ul> <br /> <h3>Documentation</h3> <p>Need help setting up, configuring or customizing the plugin? Check out the links below:</p> <ul> <li>- <?php _e('<a href="https://smashballoon.com/custom-facebook-feed/docs/wordpress/" target="_blank">Installation and Configuration</a>'); ?> </li> <li>- <?php _e('<a href="https://smashballoon.com/custom-facebook-feed/docs/shortcodes/" target="_blank">Shortcode Reference</a>'); ?> </li> <li>- <?php _e('<a href="https://smashballoon.com/custom-facebook-feed/docs/snippets/" target="_blank">Custom CSS and JavaScript Snippets</a>'); ?> </li> </ul> <br /> <p><?php _e('Still need help? <a href="http://smashballoon.com/custom-facebook-feed/support/" target="_blank">Request support</a>. Please include your <b>System Info</b> below with all support requests.'); ?> </p> <br /> <h3><?php _e('System Info <i style="color: #666; font-size: 11px; font-weight: normal;">Click the text below to select all</i>'); ?> </h3> <?php $access_token = get_option($access_token); if ($access_token == '' || empty($access_token)) { $access_token = '611606915581035|RdRHbHtrHseQw4C7SDUBFWIrJLA'; } ?> <?php $posts_json = cff_fetchUrl("https://graph.facebook.com/" . get_option(trim($page_id)) . "/feed?access_token=" . trim($access_token) . "&limit=1"); ?> <textarea readonly="readonly" onclick="this.focus();this.select()" title="To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac)." style="width: 70%; height: 500px; white-space: pre; font-family: Menlo,Monaco,monospace;"> ## SITE/SERVER INFO: ## Site URL: <?php echo site_url() . "\n"; ?> Home URL: <?php echo home_url() . "\n"; ?> WordPress Version: <?php echo get_bloginfo('version') . "\n"; ?> PHP Version: <?php echo PHP_VERSION . "\n"; ?> Web Server Info: <?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?> PHP allow_url_fopen: <?php echo ini_get('allow_url_fopen') ? "Yes" . "\n" : "No" . "\n"; ?> PHP cURL: <?php echo is_callable('curl_init') ? "Yes" . "\n" : "No" . "\n"; ?> JSON: <?php echo function_exists("json_decode") ? "Yes" . "\n" : "No" . "\n"; ?> SSL Stream: <?php echo in_array('https', stream_get_wrappers()) ? "Yes" . "\n" : "No" . "\n"; ?> ## ACTIVE PLUGINS: ## <?php $plugins = get_plugins(); $active_plugins = get_option('active_plugins', array()); foreach ($plugins as $plugin_path => $plugin) { // If the plugin isn't active, don't show it. if (!in_array($plugin_path, $active_plugins)) { continue; } echo $plugin['Name'] . ': ' . $plugin['Version'] . "\n"; } ?> ## PLUGIN SETTINGS: ## Use own Access Token: <?php echo get_option('cff_show_access_token') . "\n"; ?> Access Token: <?php echo get_option('cff_access_token') . "\n"; ?> Page ID: <?php echo get_option('cff_page_id') . "\n"; ?> Page Type: <?php echo get_option('cff_page_type') . "\n"; ?> Number of Posts: <?php echo get_option('cff_num_show') . "\n"; ?> Post Limit: <?php echo get_option('cff_post_limit') . "\n"; ?> Show Posts by: <?php echo get_option('cff_show_others') . "\n"; ?> Cache Time: <?php echo get_option('cff_cache_time') . "\n"; ?> Cache Unit: <?php echo get_option('cff_cache_time_unit') . "\n"; ?> Locale: <?php echo get_option('cff_locale') . "\n"; ?> Timezone: <?php $options = get_option('cff_style_settings', array()); echo $options['cff_timezone'] . "\n"; ?> ## CUSTOMIZE: ## cff_ajax => <?php echo get_option('cff_ajax') . "\n"; ?> cff_preserve_settings => <?php echo get_option('cff_preserve_settings') . "\n"; ?> cff_title_length => <?php echo get_option('cff_title_length') . "\n"; ?> cff_body_length => <?php echo get_option('cff_body_length') . "\n"; while (list($key, $val) = each($options)) { echo "{$key} => {$val}\n"; } ?> ## FACEBOOK API RESPONSE: ## <?php echo $posts_json; ?> </textarea> <?php } ?> <?php }
function display_cff($atts, $content = null) { //Which extensions are active? include_once ABSPATH . 'wp-admin/includes/plugin.php'; $cff_ext_options = get_option('cff_extensions_status'); //Set extensions in extensions plugin all to false by default $cff_ext_multifeed_active_check = false; $cff_ext_date_range_active_check = false; $cff_ext_featured_post_active_check = false; $cff_ext_album_active_check = false; if (WPW_SL_ITEM_NAME == 'Custom Facebook Feed WordPress Plugin Smash') { //Set page variables if (isset($cff_ext_options['cff_extensions_multifeed_active'])) { $cff_ext_multifeed_active_check = $cff_ext_options['cff_extensions_multifeed_active']; } if (isset($cff_ext_options['cff_extensions_date_range_active'])) { $cff_ext_date_range_active_check = $cff_ext_options['cff_extensions_date_range_active']; } if (isset($cff_ext_options['cff_extensions_featured_post_active'])) { $cff_ext_featured_post_active_check = $cff_ext_options['cff_extensions_featured_post_active']; } if (isset($cff_ext_options['cff_extensions_album_active'])) { $cff_ext_album_active_check = $cff_ext_options['cff_extensions_album_active']; } } is_plugin_active('cff-multifeed/cff-multifeed.php') || $cff_ext_multifeed_active_check ? $cff_ext_multifeed_active = true : ($cff_ext_multifeed_active = false); is_plugin_active('cff-date-range/cff-date-range.php') || $cff_ext_date_range_active_check ? $cff_ext_date_active = true : ($cff_ext_date_active = false); is_plugin_active('cff-featured-post/cff-featured-post.php') || $cff_ext_featured_post_active_check ? $cff_featured_post_active = true : ($cff_featured_post_active = false); is_plugin_active('cff-album/cff-album.php') || $cff_ext_album_active_check ? $cff_album_active = true : ($cff_album_active = false); //Style options $options = get_option('cff_style_settings'); //Create the types string to set as shortcode default $type_string = ''; if ($options['cff_show_links_type']) { $type_string .= 'links,'; } if ($options['cff_show_event_type']) { $type_string .= 'events,'; } if ($options['cff_show_video_type']) { $type_string .= 'videos,'; } if ($options['cff_show_photos_type']) { $type_string .= 'photos,'; } if ($options['cff_show_albums_type']) { $type_string .= 'albums,'; } //If the album option hasn't been set yet in the $options array (ie. plugin has been updated but the option hasn't been saved) then set albums to display by default if (!array_key_exists('cff_show_albums_type', $options)) { $type_string .= 'albums,'; } if ($options['cff_show_status_type']) { $type_string .= 'statuses,'; } //Create the includes string to set as shortcode default $include_string = ''; if ($options['cff_show_author']) { $include_string .= 'author,'; } if ($options['cff_show_text']) { $include_string .= 'text,'; } if ($options['cff_show_desc']) { $include_string .= 'desc,'; } if ($options['cff_show_shared_links']) { $include_string .= 'sharedlinks,'; } if ($options['cff_show_date']) { $include_string .= 'date,'; } if ($options['cff_show_media']) { $include_string .= 'media,'; } if ($options['cff_show_event_title']) { $include_string .= 'eventtitle,'; } if ($options['cff_show_event_details']) { $include_string .= 'eventdetails,'; } if ($options['cff_show_meta']) { $include_string .= 'social,'; } if ($options['cff_show_link']) { $include_string .= 'link,'; } if ($options['cff_show_like_box']) { $include_string .= 'likebox,'; } //Pass in shortcode attrbutes $atts = shortcode_atts(array('accesstoken' => get_option('cff_access_token'), 'id' => get_option('cff_page_id'), 'pagetype' => get_option('cff_page_type'), 'num' => get_option('cff_num_show'), 'limit' => get_option('cff_post_limit'), 'others' => '', 'showpostsby' => get_option('cff_show_others'), 'cachetime' => get_option('cff_cache_time'), 'cacheunit' => get_option('cff_cache_time_unit'), 'locale' => get_option('cff_locale'), 'ajax' => get_option('cff_ajax'), 'width' => $options['cff_feed_width'], 'height' => $options['cff_feed_height'], 'padding' => $options['cff_feed_padding'], 'bgcolor' => $options['cff_bg_color'], 'showauthor' => '', 'showauthornew' => $options['cff_show_author'], 'class' => $options['cff_class'], 'type' => $type_string, 'eventsource' => $options['cff_events_source'], 'eventoffset' => $options['cff_event_offset'], 'eventimage' => $options['cff_event_image_size'], 'pastevents' => 'false', 'albumsource' => $options['cff_albums_source'], 'showalbumtitle' => $options['cff_show_album_title'], 'showalbumnum' => $options['cff_show_album_number'], 'albumcols' => $options['cff_album_cols'], 'photosource' => $options['cff_photos_source'], 'photocols' => $options['cff_photos_cols'], 'filter' => $options['cff_filter_string'], 'exfilter' => $options['cff_exclude_string'], 'layout' => $options['cff_preset_layout'], 'enablenarrow' => $options['cff_enable_narrow'], 'mediaposition' => $options['cff_media_position'], 'include' => $include_string, 'exclude' => '', 'postbgcolor' => isset($options['cff_post_bg_color']) ? $options['cff_post_bg_color'] : '', 'postcorners' => isset($options['cff_post_rounded']) ? $options['cff_post_rounded'] : '', 'textformat' => $options['cff_title_format'], 'textsize' => $options['cff_title_size'], 'textweight' => $options['cff_title_weight'], 'textcolor' => $options['cff_title_color'], 'textlinkcolor' => $options['cff_posttext_link_color'], 'textlink' => $options['cff_title_link'], 'posttags' => $options['cff_post_tags'], 'linkhashtags' => $options['cff_link_hashtags'], 'authorsize' => $options['cff_author_size'], 'authorcolor' => $options['cff_author_color'], 'descsize' => $options['cff_body_size'], 'descweight' => $options['cff_body_weight'], 'desccolor' => $options['cff_body_color'], 'linktitleformat' => $options['cff_link_title_format'], 'linktitlesize' => $options['cff_link_title_size'], 'linktitlecolor' => $options['cff_link_title_color'], 'linkurlcolor' => $options['cff_link_url_color'], 'linkbgcolor' => $options['cff_link_bg_color'], 'linkbordercolor' => $options['cff_link_border_color'], 'disablelinkbox' => $options['cff_disable_link_box'], 'eventtitleformat' => $options['cff_event_title_format'], 'eventtitlesize' => $options['cff_event_title_size'], 'eventtitleweight' => $options['cff_event_title_weight'], 'eventtitlecolor' => $options['cff_event_title_color'], 'eventtitlelink' => $options['cff_event_title_link'], 'eventdatesize' => $options['cff_event_date_size'], 'eventdateweight' => $options['cff_event_date_weight'], 'eventdatecolor' => $options['cff_event_date_color'], 'eventdatepos' => $options['cff_event_date_position'], 'eventdateformat' => $options['cff_event_date_formatting'], 'eventdatecustom' => $options['cff_event_date_custom'], 'eventdetailssize' => $options['cff_event_details_size'], 'eventdetailsweight' => $options['cff_event_details_weight'], 'eventdetailscolor' => $options['cff_event_details_color'], 'eventlinkcolor' => $options['cff_event_link_color'], 'datepos' => $options['cff_date_position'], 'datesize' => $options['cff_date_size'], 'dateweight' => $options['cff_date_weight'], 'datecolor' => $options['cff_date_color'], 'dateformat' => $options['cff_date_formatting'], 'datecustom' => $options['cff_date_custom'], 'timezone' => isset($options['cff_timezone']) ? $options['cff_timezone'] : 'America/Chicago', 'linksize' => $options['cff_link_size'], 'linkweight' => $options['cff_link_weight'], 'linkcolor' => $options['cff_link_color'], 'viewlinktext' => $options['cff_view_link_text'], 'linktotimeline' => $options['cff_link_to_timeline'], 'iconstyle' => $options['cff_icon_style'], 'socialtextcolor' => $options['cff_meta_text_color'], 'sociallinkcolor' => $options['cff_meta_link_color'], 'socialbgcolor' => $options['cff_meta_bg_color'], 'expandcomments' => $options['cff_expand_comments'], 'commentsnum' => $options['cff_comments_num'], 'hidecommentimages' => $options['cff_hide_comment_avatars'], 'textlength' => get_option('cff_title_length'), 'desclength' => get_option('cff_body_length'), 'likeboxpos' => $options['cff_like_box_position'], 'likeboxoutside' => $options['cff_like_box_outside'], 'likeboxcolor' => $options['cff_likebox_bg_color'], 'likeboxtextcolor' => $options['cff_like_box_text_color'], 'likeboxwidth' => $options['cff_likebox_width'], 'likeboxheight' => $options['cff_likebox_height'], 'likeboxfaces' => $options['cff_like_box_faces'], 'likeboxborder' => $options['cff_like_box_border'], 'showheader' => $options['cff_show_header'], 'headeroutside' => $options['cff_header_outside'], 'headertext' => $options['cff_header_text'], 'headerbg' => $options['cff_header_bg_color'], 'headerpadding' => $options['cff_header_padding'], 'headertextsize' => $options['cff_header_text_size'], 'headertextweight' => $options['cff_header_text_weight'], 'headertextcolor' => $options['cff_header_text_color'], 'headericon' => $options['cff_header_icon'], 'headericoncolor' => $options['cff_header_icon_color'], 'headericonsize' => $options['cff_header_icon_size'], 'videoheight' => $options['cff_video_height'], 'videoaction' => $options['cff_video_action'], 'sepcolor' => $options['cff_sep_color'], 'sepsize' => $options['cff_sep_size'], 'seemoretext' => $options['cff_see_more_text'], 'seelesstext' => $options['cff_see_less_text'], 'buyticketstext' => $options['cff_buy_tickets_text'], 'maptext' => $options['cff_map_text'], 'facebooklinktext' => $options['cff_facebook_link_text'], 'previouscommentstext' => $options['cff_translate_view_previous_comments_text'], 'commentonfacebooktext' => $options['cff_translate_comment_on_facebook_text'], 'photostext' => $options['cff_translate_photos_text'], 'likesthistext' => $options['cff_translate_likes_this_text'], 'likethistext' => $options['cff_translate_like_this_text'], 'andtext' => $options['cff_translate_and_text'], 'othertext' => $options['cff_translate_other_text'], 'otherstext' => $options['cff_translate_others_text'], 'from' => get_option('cff_date_from'), 'until' => get_option('cff_date_until'), 'featuredpost' => get_option('cff_featured_post_id'), 'album' => '', 'lightbox' => get_option('cff_lightbox')), $atts); /********** GENERAL **********/ $cff_page_type = $atts['pagetype']; $cff_is_group = false; if ($cff_page_type == 'group') { $cff_is_group = true; } $cff_feed_width = $atts['width']; $cff_feed_height = $atts['height']; $cff_feed_padding = $atts['padding']; $cff_bg_color = $atts['bgcolor']; $cff_show_author = $atts['showauthornew']; $cff_cache_time = $atts['cachetime']; $cff_locale = $atts['locale']; if (empty($cff_locale) || !isset($cff_locale) || $cff_locale == '') { $cff_locale = 'en_US'; } if (!isset($cff_cache_time)) { $cff_cache_time = 0; } $cff_cache_time_unit = $atts['cacheunit']; $cff_class = $atts['class']; //Compile feed styles $cff_feed_styles = 'style="'; if (!empty($cff_feed_width)) { $cff_feed_styles .= 'width:' . $cff_feed_width . '; '; } if (!empty($cff_feed_height)) { $cff_feed_styles .= 'height:' . $cff_feed_height . '; '; } if (!empty($cff_feed_padding)) { $cff_feed_styles .= 'padding:' . $cff_feed_padding . '; '; } if (!empty($cff_bg_color)) { $cff_feed_styles .= 'background-color:#' . str_replace('#', '', $cff_bg_color) . '; '; } $cff_feed_styles .= '"'; //Like box $cff_like_box_position = $atts['likeboxpos']; $cff_like_box_outside = $atts['likeboxoutside']; //Open links in new window? $target = 'target="_blank"'; /********** POST TYPES **********/ $cff_types = $atts['type']; //Look for non-plural version of string in the types string in case user specifies singular in shortcode $cff_show_links_type = false; $cff_show_event_type = false; $cff_show_video_type = false; $cff_show_photos_type = false; $cff_show_status_type = false; $cff_show_albums_type = false; if (stripos($cff_types, 'link') !== false) { $cff_show_links_type = true; } if (stripos($cff_types, 'event') !== false) { $cff_show_event_type = true; } if (stripos($cff_types, 'video') !== false) { $cff_show_video_type = true; } if (stripos($cff_types, 'photo') !== false) { $cff_show_photos_type = true; } if (stripos($cff_types, 'album') !== false) { $cff_show_albums_type = true; } if (stripos($cff_types, 'status') !== false) { $cff_show_status_type = true; } //Only events $cff_events_source = $atts['eventsource']; if (empty($cff_events_source) || !isset($cff_events_source)) { $cff_events_source = 'eventspage'; } $cff_event_offset = $atts['eventoffset']; if (empty($cff_event_offset) || !isset($cff_event_offset)) { $cff_event_offset = '6'; } $cff_events_only = false; if ($cff_show_event_type && !$cff_show_links_type && !$cff_show_video_type && !$cff_show_photos_type && !$cff_show_status_type && !$cff_show_albums_type) { $cff_events_only = true; } //Only albums $cff_albums_source = $atts['albumsource']; $cff_show_album_title = $atts['showalbumtitle']; $cff_show_album_title == 'on' || $cff_show_album_title == 'true' || $cff_show_album_title == true ? $cff_show_album_title = true : ($cff_show_album_title = false); if ($atts['showalbumtitle'] == 'false') { $cff_show_album_title = false; } $cff_show_album_number = $atts['showalbumnum']; $cff_show_album_number == 'on' || $cff_show_album_number == 'true' || $cff_show_album_number == true ? $cff_show_album_number = true : ($cff_show_album_number = false); if ($atts['showalbumnum'] == 'false') { $cff_show_album_number = false; } $cff_album_cols = $atts['albumcols']; $cff_albums_only = false; if ($cff_show_albums_type && !$cff_show_links_type && !$cff_show_video_type && !$cff_show_photos_type && !$cff_show_status_type && !$cff_show_event_type) { $cff_albums_only = true; } //PHOTOS ONLY $cff_photos_source = $atts['photosource']; isset($atts['photocols']) ? $cff_photos_cols = $atts['photocols'] : ($cff_photos_cols = '1'); $cff_photos_only = false; if ($cff_show_photos_type && $cff_photos_source == 'photospage' && !$cff_show_links_type && !$cff_show_video_type && !$cff_show_event_type && !$cff_show_status_type && !$cff_show_albums_type) { $cff_photos_only = true; } if ($cff_featured_post_active && !empty($atts['featuredpost'])) { $cff_photos_only = false; } /********** LAYOUT **********/ //Include string $cff_includes = $atts['include']; //Look for non-plural version of string in the types string in case user specifies singular in shortcode $cff_show_author = false; $cff_show_text = false; $cff_show_desc = false; $cff_show_shared_links = false; $cff_show_date = false; $cff_show_media = false; $cff_show_event_title = false; $cff_show_event_details = false; $cff_show_meta = false; $cff_show_link = false; $cff_show_like_box = false; if (stripos($cff_includes, 'author') !== false) { $cff_show_author = true; } if (stripos($cff_includes, 'text') !== false) { $cff_show_text = true; } if (stripos($cff_includes, 'desc') !== false) { $cff_show_desc = true; } if (stripos($cff_includes, 'sharedlink') !== false) { $cff_show_shared_links = true; } if (stripos($cff_includes, 'date') !== false) { $cff_show_date = true; } if (stripos($cff_includes, 'media') !== false) { $cff_show_media = true; } if (stripos($cff_includes, 'eventtitle') !== false) { $cff_show_event_title = true; } if (stripos($cff_includes, 'eventdetail') !== false) { $cff_show_event_details = true; } if (stripos($cff_includes, 'social') !== false) { $cff_show_meta = true; } if (stripos($cff_includes, ',link') !== false) { $cff_show_link = true; } //comma used to separate it from 'sharedlinks' - which also contains 'link' string if (stripos($cff_includes, 'like') !== false) { $cff_show_like_box = true; } //Exclude string $cff_excludes = $atts['exclude']; //Look for non-plural version of string in the types string in case user specifies singular in shortcode if (stripos($cff_excludes, 'author') !== false) { $cff_show_author = false; } if (stripos($cff_excludes, 'text') !== false) { $cff_show_text = false; } if (stripos($cff_excludes, 'desc') !== false) { $cff_show_desc = false; } if (stripos($cff_excludes, 'sharedlink') !== false) { $cff_show_shared_links = false; } if (stripos($cff_excludes, 'date') !== false) { $cff_show_date = false; } if (stripos($cff_excludes, 'media') !== false) { $cff_show_media = false; } if (stripos($cff_excludes, 'eventtitle') !== false) { $cff_show_event_title = false; } if (stripos($cff_excludes, 'eventdetail') !== false) { $cff_show_event_details = false; } if (stripos($cff_excludes, 'social') !== false) { $cff_show_meta = false; } if (stripos($cff_excludes, ',link') !== false) { $cff_show_link = false; } //comma used to separate it from 'sharedlinks' - which also contains 'link' string if (stripos($cff_excludes, 'like') !== false) { $cff_show_like_box = false; } $cff_preset_layout = $atts['layout']; //Default is thumbnail layout $cff_thumb_layout = false; $cff_half_layout = false; $cff_full_layout = true; if (($cff_preset_layout == 'thumb' || empty($cff_preset_layout)) && $cff_show_media) { $cff_thumb_layout = true; } else { if ($cff_preset_layout == 'half' && $cff_show_media) { $cff_half_layout = true; } else { $cff_full_layout = true; } } //Get the media position $cff_media_position = $atts['mediaposition']; if ($cff_thumb_layout || $cff_half_layout) { $cff_media_position = 'below'; } //If the old shortcode option 'showauthor' is being used then apply it $cff_show_author_old = $atts['showauthor']; if ($cff_show_author_old == 'false') { $cff_show_author = false; } if ($cff_show_author_old == 'true') { $cff_show_author = true; } /********** META **********/ $cff_icon_style = $atts['iconstyle']; $cff_meta_text_color = $atts['socialtextcolor']; $cff_meta_bg_color = $atts['socialbgcolor']; $cff_expand_comments = $atts['expandcomments']; if ($cff_expand_comments == 'false') { $cff_expand_comments = false; } !isset($atts['commentsnum']) ? $cff_comments_num = '4' : ($cff_comments_num = $atts['commentsnum']); $cff_hide_comment_avatars = $atts['hidecommentimages']; if ($cff_hide_comment_avatars == 'false') { $cff_hide_comment_avatars = false; } $cff_meta_styles = 'style="'; if (!empty($cff_meta_text_color)) { $cff_meta_styles .= 'color:#' . str_replace('#', '', $cff_meta_text_color) . ';'; } if (!empty($cff_meta_bg_color)) { $cff_meta_styles .= 'background-color:#' . str_replace('#', '', $cff_meta_bg_color) . ';'; } $cff_meta_styles .= '"'; $cff_meta_link_color = 'style="color:#' . str_replace('#', '', $atts['sociallinkcolor']) . ';"'; // $cff_nocomments_text = $options[ 'cff_nocomments_text' ]; // $cff_hide_comments = $options[ 'cff_hide_comments' ]; // if (!isset($cff_nocomments_text) || empty($cff_nocomments_text)) $cff_hide_comments = true; /********** TYPOGRAPHY **********/ //See More text $cff_see_more_text = $atts['seemoretext']; $cff_see_less_text = $atts['seelesstext']; //See Less text //Title $cff_title_format = $atts['textformat']; if (empty($cff_title_format)) { $cff_title_format = 'p'; } $cff_title_size = $atts['textsize']; $cff_title_weight = $atts['textweight']; $cff_title_color = $atts['textcolor']; $cff_title_styles = 'style="'; if (!empty($cff_title_size) && $cff_title_size != 'inherit') { $cff_title_styles .= 'font-size:' . $cff_title_size . 'px; '; } if (!empty($cff_title_weight) && $cff_title_weight != 'inherit') { $cff_title_styles .= 'font-weight:' . $cff_title_weight . '; '; } if (!empty($cff_title_color)) { $cff_title_styles .= 'color:#' . str_replace('#', '', $cff_title_color) . ';'; } $cff_title_styles .= '"'; $cff_title_link = $atts['textlink']; $cff_title_link == 'on' || $cff_title_link == 'true' || $cff_title_link == true ? $cff_title_link = true : ($cff_title_link = false); if ($atts['textlink'] == 'false') { $cff_title_link = false; } //Author $cff_author_size = $atts['authorsize']; $cff_author_color = $atts['authorcolor']; $cff_author_styles = 'style="'; if (!empty($cff_author_size) && $cff_author_size != 'inherit') { $cff_author_styles .= 'font-size:' . $cff_author_size . 'px; '; } if (!empty($cff_author_color)) { $cff_author_styles .= 'color:#' . str_replace('#', '', $cff_author_color) . ';'; } $cff_author_styles .= '"'; //Description $cff_body_size = $atts['descsize']; $cff_body_weight = $atts['descweight']; $cff_body_color = $atts['desccolor']; $cff_body_styles = 'style="'; if (!empty($cff_body_size) && $cff_body_size != 'inherit') { $cff_body_styles .= 'font-size:' . $cff_body_size . 'px; '; } if (!empty($cff_body_weight) && $cff_body_weight != 'inherit') { $cff_body_styles .= 'font-weight:' . $cff_body_weight . '; '; } if (!empty($cff_body_color)) { $cff_body_styles .= 'color:#' . str_replace('#', '', $cff_body_color) . ';'; } $cff_body_styles .= '"'; //Shared link title $cff_link_title_format = $atts['linktitleformat']; if (empty($cff_link_title_format)) { $cff_link_title_format = 'p'; } $cff_link_title_size = $atts['linktitlesize']; $cff_link_title_color = $atts['linktitlecolor']; $cff_link_url_color = $atts['linkurlcolor']; $cff_link_title_styles = 'style="'; if (!empty($cff_link_title_size) && $cff_link_title_size != 'inherit') { $cff_link_title_styles .= 'font-size:' . $cff_link_title_size . 'px;'; } $cff_link_title_styles .= '"'; //Shared link box $cff_link_bg_color = $atts['linkbgcolor']; $cff_link_border_color = $atts['linkbordercolor']; $cff_disable_link_box = $atts['disablelinkbox']; $cff_disable_link_box == 'true' || $cff_disable_link_box == 'on' ? $cff_disable_link_box = true : ($cff_disable_link_box = false); $cff_link_box_styles = 'style="'; if (!empty($cff_link_border_color)) { $cff_link_box_styles .= 'border: 1px solid #' . str_replace('#', '', $cff_link_border_color) . '; '; } if (!empty($cff_link_bg_color)) { $cff_link_box_styles .= 'background-color: #' . str_replace('#', '', $cff_link_bg_color) . ';'; } $cff_link_box_styles .= '"'; //Event Title $cff_event_title_format = $atts['eventtitleformat']; if (empty($cff_event_title_format)) { $cff_event_title_format = 'p'; } $cff_event_title_size = $atts['eventtitlesize']; $cff_event_title_weight = $atts['eventtitleweight']; $cff_event_title_color = $atts['eventtitlecolor']; $cff_event_title_styles = 'style="'; if (!empty($cff_event_title_size) && $cff_event_title_size != 'inherit') { $cff_event_title_styles .= 'font-size:' . $cff_event_title_size . 'px; '; } if (!empty($cff_event_title_weight) && $cff_event_title_weight != 'inherit') { $cff_event_title_styles .= 'font-weight:' . $cff_event_title_weight . '; '; } if (!empty($cff_event_title_color)) { $cff_event_title_styles .= 'color:#' . str_replace('#', '', $cff_event_title_color) . ';'; } $cff_event_title_styles .= '"'; $cff_event_title_link = $atts['eventtitlelink']; //Event Date $cff_event_date_size = $atts['eventdatesize']; $cff_event_date_weight = $atts['eventdateweight']; $cff_event_date_color = $atts['eventdatecolor']; $cff_event_date_position = $atts['eventdatepos']; $cff_event_date_formatting = $atts['eventdateformat']; $cff_event_date_custom = $atts['eventdatecustom']; $cff_event_date_styles = 'style="'; if (!empty($cff_event_date_size) && $cff_event_date_size != 'inherit') { $cff_event_date_styles .= 'font-size:' . $cff_event_date_size . 'px; '; } if (!empty($cff_event_date_weight) && $cff_event_date_weight != 'inherit') { $cff_event_date_styles .= 'font-weight:' . $cff_event_date_weight . '; '; } if (!empty($cff_event_date_color)) { $cff_event_date_styles .= 'color:#' . str_replace('#', '', $cff_event_date_color) . ';'; } $cff_event_date_styles .= '"'; //Event Details $cff_event_details_size = $atts['eventdetailssize']; $cff_event_details_weight = $atts['eventdetailsweight']; $cff_event_details_color = $atts['eventdetailscolor']; $cff_event_link_color = $atts['eventlinkcolor']; $cff_event_details_styles = 'style="'; if (!empty($cff_event_details_size) && $cff_event_details_size != 'inherit') { $cff_event_details_styles .= 'font-size:' . $cff_event_details_size . 'px; '; } if (!empty($cff_event_details_weight) && $cff_event_details_weight != 'inherit') { $cff_event_details_styles .= 'font-weight:' . $cff_event_details_weight . '; '; } if (!empty($cff_event_details_color)) { $cff_event_details_styles .= 'color:#' . str_replace('#', '', $cff_event_details_color) . ';'; } $cff_event_details_styles .= '"'; //Date $cff_date_position = $atts['datepos']; if (!isset($cff_date_position)) { $cff_date_position = 'below'; } $cff_date_size = $atts['datesize']; $cff_date_weight = $atts['dateweight']; $cff_date_color = $atts['datecolor']; $cff_date_styles = 'style="'; if (!empty($cff_date_size) && $cff_date_size != 'inherit') { $cff_date_styles .= 'font-size:' . $cff_date_size . 'px; '; } if (!empty($cff_date_weight) && $cff_date_weight != 'inherit') { $cff_date_styles .= 'font-weight:' . $cff_date_weight . '; '; } if (!empty($cff_date_color)) { $cff_date_styles .= 'color:#' . str_replace('#', '', $cff_date_color) . ';'; } $cff_date_styles .= '"'; $cff_date_before = $options['cff_date_before']; $cff_date_after = $options['cff_date_after']; //Set user's timezone based on setting $cff_timezone = $atts['timezone']; $cff_orig_timezone = date_default_timezone_get(); date_default_timezone_set($cff_timezone); //Link to Facebook $cff_link_size = $atts['linksize']; $cff_link_weight = $atts['linkweight']; $cff_link_color = $atts['linkcolor']; $cff_link_styles = 'style="'; if (!empty($cff_link_size) && $cff_link_size != 'inherit') { $cff_link_styles .= 'font-size:' . $cff_link_size . 'px; '; } if (!empty($cff_link_weight) && $cff_link_weight != 'inherit') { $cff_link_styles .= 'font-weight:' . $cff_link_weight . '; '; } if (!empty($cff_link_color)) { $cff_link_styles .= 'color:#' . str_replace('#', '', $cff_link_color) . ';'; } $cff_link_styles .= '"'; $cff_facebook_link_text = $atts['facebooklinktext']; $cff_view_link_text = $atts['viewlinktext']; $cff_link_to_timeline = $atts['linktotimeline']; /********** MISC **********/ //Like Box styles $cff_likebox_bg_color = $atts['likeboxcolor']; $cff_like_box_text_color = $atts['likeboxtextcolor']; $cff_like_box_colorscheme = 'light'; if ($cff_like_box_text_color == 'white') { $cff_like_box_colorscheme = 'dark'; } $cff_likebox_width = $atts['likeboxwidth']; $cff_likebox_height = $atts['likeboxheight']; $cff_likebox_height = preg_replace('/px$/', '', $cff_likebox_height); if (!isset($cff_likebox_width) || empty($cff_likebox_width) || $cff_likebox_width == '') { $cff_likebox_width = '100%'; } $cff_like_box_faces = $atts['likeboxfaces']; if (!isset($cff_like_box_faces) || empty($cff_like_box_faces)) { $cff_like_box_faces = 'false'; } $cff_like_box_border = $atts['likeboxborder']; if ($cff_like_box_border) { $cff_like_box_border = 'true'; } else { $cff_like_box_border = 'false'; } //Compile Like box styles $cff_likebox_styles = 'style="width: ' . $cff_likebox_width . ';'; if (!empty($cff_likebox_bg_color)) { $cff_likebox_styles .= ' background-color: #' . str_replace('#', '', $cff_likebox_bg_color) . ';'; } //Set the left margin on the like box based on how it's being displayed if (!empty($cff_likebox_bg_color) && $cff_likebox_bg_color != '#' || ($cff_like_box_faces == 'true' || $cff_like_box_faces == 'on')) { $cff_likebox_styles .= ' margin-left: 0px;'; } $cff_likebox_styles .= '"'; //Get feed header settings $cff_header_bg_color = $atts['headerbg']; $cff_header_padding = $atts['headerpadding']; $cff_header_text_size = $atts['headertextsize']; $cff_header_text_weight = $atts['headertextweight']; $cff_header_text_color = $atts['headertextcolor']; //Compile feed header styles $cff_header_styles = 'style="'; if (!empty($cff_header_bg_color)) { $cff_header_styles .= 'background-color: #' . str_replace('#', '', $cff_header_bg_color) . ';'; } if (!empty($cff_header_padding)) { $cff_header_styles .= ' padding: ' . $cff_header_padding . ';'; } if (!empty($cff_header_text_size)) { $cff_header_styles .= ' font-size: ' . $cff_header_text_size . 'px;'; } if (!empty($cff_header_text_weight)) { $cff_header_styles .= ' font-weight: ' . $cff_header_text_weight . ';'; } if (!empty($cff_header_text_color)) { $cff_header_styles .= ' color: #' . str_replace('#', '', $cff_header_text_color) . ';'; } $cff_header_styles .= '"'; //Video //Dimensions $cff_video_height = $atts['videoheight']; //Action $cff_video_action = $atts['videoaction']; //Separating Line $cff_sep_color = $atts['sepcolor']; if (empty($cff_sep_color)) { $cff_sep_color = 'ddd'; } $cff_sep_size = $atts['sepsize']; //If empty then set a 0px border if (empty($cff_sep_size) || $cff_sep_size == '') { $cff_sep_size = 0; //Need to set a color otherwise the CSS is invalid $cff_sep_color = 'fff'; } $cff_post_bg_color = $atts['postbgcolor']; $cff_post_rounded = $atts['postcorners']; $cff_post_bg_color !== '#' && $cff_post_bg_color !== '' ? $cff_post_bg_color_check = true : ($cff_post_bg_color_check = false); $cff_sep_color !== '#' && $cff_sep_color !== '' ? $cff_sep_color_check = true : ($cff_sep_color_check = false); //CFF item styles $cff_item_styles = ''; if ($cff_sep_color_check || $cff_post_bg_color_check) { $cff_item_styles = 'style="'; if ($cff_sep_color_check && !$cff_post_bg_color_check) { $cff_item_styles .= 'border-bottom: ' . $cff_sep_size . 'px solid #' . str_replace('#', '', $cff_sep_color) . '; '; } if ($cff_post_bg_color_check) { $cff_item_styles .= 'background-color: ' . $cff_post_bg_color . '; '; } if (isset($cff_post_rounded)) { $cff_item_styles .= '-webkit-border-radius: ' . $cff_post_rounded . 'px; -moz-border-radius: ' . $cff_post_rounded . 'px; border-radius: ' . $cff_post_rounded . 'px; '; } $cff_item_styles .= '"'; } //Text limits $title_limit = $atts['textlength']; if (!isset($title_limit)) { $title_limit = 9999; } $body_limit = $atts['desclength']; //Assign the Access Token and Page ID variables $access_token = trim($atts['accesstoken']); $page_id = trim($atts['id']); //If user pastes their full URL into the Page ID field then strip it out $cff_facebook_string = 'facebook.com'; stripos($page_id, $cff_facebook_string) !== false ? $cff_page_id_url_check = true : ($cff_page_id_url_check = false); if ($cff_page_id_url_check === true) { //Remove trailing slash if exists $page_id = preg_replace('{/$}', '', $page_id); //Get last part of url $page_id = substr($page_id, strrpos($page_id, '/') + 1); } //If the Page ID contains a query string at the end then remove it if (stripos($page_id, '?') !== false) { $page_id = substr($page_id, 0, strrpos($page_id, '?')); } //Get show posts attribute. If not set then default to 25 $show_posts = $atts['num']; if (empty($show_posts)) { $show_posts = 25; } if ($show_posts == 0 || $show_posts == 'undefined') { $show_posts = 25; } //If the 'Enter my own Access Token' box is unchecked then don't use the user's access token, even if there's one in the field get_option('cff_show_access_token') ? $cff_show_access_token = true : ($cff_show_access_token = false); //Check whether the Access Token is present and valid if ($access_token == '' || !$cff_show_access_token) { $access_token = '611606915581035|RdRHbHtrHseQw4C7SDUBFWIrJLA'; } //Check whether a Page ID has been defined if ($page_id == '') { 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=YOUR_PAGE_ID_HERE].<br /><br />"; return false; } //Is it SSL? $cff_ssl = ''; if (is_ssl()) { $cff_ssl = '&return_ssl_resources=true'; } //Use posts? or feed? $show_others = $atts['others']; $show_posts_by = $atts['showpostsby']; $graph_query = 'posts'; $cff_show_only_others = false; //If 'others' shortcode option is used then it overrides any other option if ($show_others) { //Show posts by everyone if ($show_others == 'on' || $show_others == 'true' || $show_others == true || $cff_is_group) { $graph_query = 'feed'; } //Only show posts by me if ($show_others == 'false') { $graph_query = 'posts'; } } else { //Else use the settings page option or the 'showpostsby' shortcode option //Only show posts by me if ($show_posts_by == 'me') { $graph_query = 'posts'; } //Show posts by everyone if ($show_posts_by == 'others' || $cff_is_group) { $graph_query = 'feed'; } //Show posts ONLY by others if ($show_posts_by == 'onlyothers' && !$cff_is_group) { $graph_query = 'feed'; $cff_show_only_others = true; } } //If the limit isn't set then set it to be 5 more than the number of posts defined if (isset($atts['limit']) && $atts['limit'] !== '') { $cff_post_limit = $atts['limit']; } else { $cff_post_limit = intval(intval($show_posts) + 7); } //Calculate the cache time in seconds if ($cff_cache_time_unit == 'minutes') { $cff_cache_time_unit = 60; } if ($cff_cache_time_unit == 'hours') { $cff_cache_time_unit = 60 * 60; } if ($cff_cache_time_unit == 'days') { $cff_cache_time_unit = 60 * 60 * 24; } $cache_seconds = $cff_cache_time * $cff_cache_time_unit; //Set like box variable //If there are more than one page id then use the first one isset($options['cff_app_id']) ? $cff_app_id = $options['cff_app_id'] : ($cff_app_id = ''); isset($cff_app_id) && !empty($cff_app_id) ? $cff_like_box_params = '&appId=' . $cff_app_id : ($cff_like_box_params = ''); $like_box_page_id = explode(",", str_replace(' ', '', $page_id)); $like_box = '<div class="cff-likebox'; if ($cff_like_box_outside) { $like_box .= ' cff-outside'; } $like_box .= $cff_like_box_position == 'top' ? ' top' : ' bottom'; $like_box .= '" ' . $cff_likebox_styles . '><script src="https://connect.facebook.net/' . $cff_locale . '/all.js#xfbml=1' . $cff_like_box_params . '"></script><fb:like-box href="http://www.facebook.com/' . $like_box_page_id[0] . '" show_faces="' . $cff_like_box_faces . '" stream="false" header="false" colorscheme="' . $cff_like_box_colorscheme . '" show_border="' . $cff_like_box_border . '" data-height="' . $cff_likebox_height . '"></fb:like-box><div id="fb-root"></div></div>'; //Don't show like box if it's a group if ($cff_is_group) { $like_box = ''; } //Feed header $cff_show_header = $atts['showheader']; $cff_show_header == 'true' || $cff_show_header == 'on' ? $cff_show_header = true : ($cff_show_header = false); $cff_header_outside = $atts['headeroutside']; $cff_header_outside == 'true' || $cff_header_outside == 'on' ? $cff_header_outside = true : ($cff_header_outside = false); $cff_header_text = $atts['headertext']; $cff_header_icon = $atts['headericon']; $cff_header_icon_color = $atts['headericoncolor']; $cff_header_icon_size = $atts['headericonsize']; $cff_header = '<h3 class="cff-header'; if ($cff_header_outside) { $cff_header .= ' cff-outside'; } $cff_header .= '"' . $cff_header_styles . '>'; $cff_header .= '<i class="fa fa-' . $cff_header_icon . '"'; if (!empty($cff_header_icon_color) || !empty($cff_header_icon_size)) { $cff_header .= ' style="'; } if (!empty($cff_header_icon_color)) { $cff_header .= 'color: #' . str_replace('#', '', $cff_header_icon_color) . ';'; } if (!empty($cff_header_icon_size)) { $cff_header .= ' font-size: ' . $cff_header_icon_size . 'px;'; } if (!empty($cff_header_icon_color) || !empty($cff_header_icon_size)) { $cff_header .= '"'; } $cff_header .= '></i>'; $cff_header .= '<span class="cff-header-text" style="height: ' . $cff_header_icon_size . 'px;">' . $cff_header_text . '</span>'; $cff_header .= '</h3>'; //Misc Settings //Narrow styles $cff_enable_narrow = $atts['enablenarrow']; $cff_enable_narrow == 'true' || $cff_enable_narrow == 'on' ? $cff_enable_narrow = true : ($cff_enable_narrow = false); //***START FEED*** $cff_content = ''; //Add the page header to the outside of the top of feed if ($cff_show_header && $cff_header_outside) { $cff_content .= $cff_header; } //Add like box to the outside of the top of feed if ($cff_like_box_position == 'top' && $cff_show_like_box && $cff_like_box_outside) { $cff_content .= $like_box; } //Create CFF container HTML $cff_content .= '<div class="cff-wrapper">'; $cff_content .= '<div id="cff" '; if (!empty($title_limit)) { $cff_content .= 'rel="' . $title_limit . '" '; } $cff_content .= 'class="'; if (!empty($cff_class)) { $cff_content .= $cff_class . ' '; } if (!empty($cff_feed_height)) { $cff_content .= 'cff-fixed-height '; } if ($cff_thumb_layout) { $cff_content .= 'cff-thumb-layout '; } if ($cff_half_layout) { $cff_content .= 'cff-half-layout '; } if (!$cff_enable_narrow) { $cff_content .= 'cff-disable-narrow'; } //Lightbox extension if ($atts['lightbox'] == 'true' || $atts['lightbox'] == 'on') { $cff_content .= 'cff-lightbox'; } $cff_content .= '" ' . $cff_feed_styles . '>'; //Add the page header to the inside of the top of feed if ($cff_show_header && !$cff_header_outside) { $cff_content .= $cff_header; } //Add like box to the inside of the top of feed if ($cff_like_box_position == 'top' && $cff_show_like_box && !$cff_like_box_outside) { $cff_content .= $like_box; } //Limit var $i = 0; //Multifeed extension $cff_ext_multifeed_active ? $page_ids = cff_multifeed_ids($page_id) : ($page_ids = array($page_id)); //Define array for post items $cff_posts_array = array(); //LOOP THROUGH PAGE IDs foreach ($page_ids as $page_id) { //EVENTS ONLY if ($cff_events_only && $cff_events_source == 'eventspage') { //Get the user's ID $get_page_info = cff_fetchUrl('https://graph.facebook.com/' . $page_id . '?access_token=' . $access_token); $page_info = json_decode($get_page_info); //Get user ID $u_id = $page_info->id; //Add 6 hours to the current time. This means events will still be shown for 6 hours after their start time has passed. $cff_event_offset_time = '-' . $cff_event_offset . ' hours'; $curtimeplus = strtotime($cff_event_offset_time, time()); //Start time string $cff_start_time_string = "start_time>=" . $curtimeplus; //Date range extension if ($cff_ext_date_active && (!empty($atts['from']) || !empty($atts['until']))) { !empty($atts['from']) ? $cff_date_from = strtotime($atts['from']) : ($cff_date_from = $curtimeplus); !empty($atts['until']) ? $cff_date_until = strtotime($atts['until']) : ($cff_date_until = $curtimeplus); $cff_start_time_string = cff_ext_date_events($cff_date_from, $cff_date_until); } //Set the query URL $fql = "SELECT%20eid,name,attending_count,pic_big,pic_cover,start_time,end_time,timezone,venue,location,description,ticket_uri%20FROM%20event%20WHERE%20eid%20IN%20(SELECT%20eid%20FROM%20event_member%20WHERE%20uid='" . $u_id . "')%20AND%20" . $cff_start_time_string . "%20ORDER%20BY%20start_time%20&access_token=" . $access_token . '&format=json-strings' . $cff_ssl; //Featured Post extension if ($cff_featured_post_active && !empty($atts['featuredpost'])) { $fql = cff_featured_event_id(trim($atts['featuredpost']), $access_token); } // Get any existing copy of our transient data $cff_events_json_url = "https://graph.facebook.com/fql?q=" . $fql; //Past events if ($atts['pastevents'] !== 'false') { $cff_past_events = true; } //Get past events. Limit must be set high to get all past events and be able to show the newest ones first if ($cff_past_events) { $cff_events_json_url = 'https://graph.facebook.com/' . $u_id . '/events?fields=name,id,description,start_time,end_time,timezone,location,venue,ticket_uri,cover&limit=200&until=' . date('Y-m-d') . '&access_token=' . $access_token; } //Featured Post extension if ($cff_featured_post_active && !empty($atts['featuredpost'])) { $fql = cff_featured_event_id(trim($atts['featuredpost']), $access_token); } if ($cff_cache_time != 0) { $transient_name = 'cff_events_json_' . $page_id . '_' . strtotime($atts['from']) . strtotime($atts['until']) . $atts['featuredpost'] . $cff_past_events; if (false === ($events_json = get_transient($transient_name)) || $events_json === null) { //Get the contents of the events page $events_json = cff_fetchUrl($cff_events_json_url); //Cache the JSON set_transient($transient_name, $events_json, $cache_seconds); } else { $events_json = get_transient($transient_name); //If we can't find the transient then fall back to just getting the json from the api if ($events_json == false) { $events_json = cff_fetchUrl($cff_events_json_url); } } } else { $events_json = cff_fetchUrl($cff_events_json_url); } //Interpret data with JSON //Convert eid integer to a string otherwise json_decode returns it as a float $events_json = preg_replace('/"eid":(\\d+)/', '"eid":"$1"', $events_json); $events_json = preg_replace('/"id":(\\d+)/', '"id":"$1"', $events_json); $event_data = json_decode($events_json); //EVENTS LOOP foreach ($event_data->data as $event) { //Only create posts for the amount of posts specified // if ( $i == $show_posts ) break; $i++; //Past events if ($cff_past_events) { isset($event->id) ? $id = $event->id : ($id = ''); } else { isset($event->eid) ? $id = $event->eid : ($id = ''); } isset($event->name) ? $event_name = $event->name : ($event_name = ''); isset($event->attending_count) ? $attending_count = $event->attending_count : ($attending_count = ''); //Picture source if ($cff_past_events) { isset($event->cover) ? $pic_big = $event->cover->source : ($pic_big = plugins_url('/img/event-image.png', __FILE__)); } else { $atts['eventimage'] == 'cropped' ? $crop_event_pic = true : ($crop_event_pic = false); isset($event->pic_cover) && !$crop_event_pic ? $pic_big = $event->pic_cover->source : ($pic_big = $event->pic_big); } isset($event->start_time) ? $start_time = $event->start_time : ($start_time = ''); isset($event->end_time) ? $end_time = $event->end_time : ($end_time = ''); isset($event->timezone) ? $timezone = $event->timezone : ($timezone = ''); //Venue isset($event->venue->latitude) ? $venue_latitude = $event->venue->latitude : ($venue_latitude = ''); isset($event->venue->longitude) ? $venue_longitude = $event->venue->longitude : ($venue_longitude = ''); isset($event->venue->city) ? $venue_city = $event->venue->city : ($venue_city = ''); isset($event->venue->state) ? $venue_state = $event->venue->state : ($venue_state = ''); isset($event->venue->country) ? $venue_country = $event->venue->country : ($venue_country = ''); isset($event->venue->id) ? $venue_id = $event->venue->id : ($venue_id = ''); $venue_link = 'https://facebook.com/' . $venue_id; isset($event->venue->street) ? $venue_street = $event->venue->street : ($venue_street = ''); isset($event->venue->zip) ? $venue_zip = $event->venue->zip : ($venue_zip = ''); isset($event->location) ? $location = $event->location : ($location = ''); isset($event->description) ? $description = $event->description : ($description = ''); $event_link = 'https://facebook.com/events/' . $id; isset($event->ticket_uri) ? $ticket_uri = $event->ticket_uri : ($ticket_uri = ''); //Event date $event_time = $start_time; //If timezone migration is enabled then remove last 5 characters if (strlen($event_time) == 24) { $event_time = substr($event_time, 0, -5); } if (!empty($start_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); } if (isset($event->end_time)) { $cff_event_date .= ' - ' . cff_eventdate(strtotime($end_time), $cff_event_date_formatting, $cff_event_date_custom); } $cff_event_date .= '</p>'; //Event title $cff_event_title = ''; if ($cff_event_title_link) { $cff_event_title .= '<a href="' . $event_link . '" ' . $target . '>'; } $cff_event_title .= '<' . $cff_event_title_format . ' ' . $cff_event_title_styles . '>' . $event_name . '</' . $cff_event_title_format . '>'; if ($cff_event_title_link) { $cff_event_title .= '</a>'; } //***************************// //***CREATE THE EVENT HTML***// //***************************// $cff_post_item = '<div class="cff-item cff-event author-' . cff_to_slug($page_id) . '" ' . $cff_item_styles . '>'; //Picture if ($cff_show_media) { $cff_post_item .= '<a title="' . $cff_facebook_link_text . '" class="cff-photo" href="' . $event_link . '" ' . $target . '><img src="' . $pic_big . '" border="0" /></a>'; } //Start text wrapper if ($cff_thumb_layout || $cff_half_layout) { $cff_post_item .= '<div class="cff-details">'; } //show event date above title if ($cff_show_date && $cff_event_date_position == 'above') { $cff_post_item .= $cff_event_date; } //Show event title if ($cff_show_event_title && !empty($event_name)) { $cff_post_item .= $cff_event_title; } //show event date below title if ($cff_show_date && $cff_event_date_position !== 'above') { $cff_post_item .= $cff_event_date; } //Show event details if ($cff_show_event_details) { if (!empty($location)) { $cff_post_item .= '<p class="cff-location" ' . $cff_event_details_styles . '>'; } if (!empty($venue_id)) { $cff_post_item .= '<a href="' . $venue_link . '" ' . $target . ' style="color:#' . str_replace('#', '', $cff_event_link_color) . ';">'; } if (!empty($location)) { $cff_post_item .= '<b>' . $location . '</b>'; } if (!empty($venue_id)) { $cff_post_item .= '</a>'; } if (!empty($venue_street)) { $cff_post_item .= '<br />' . $venue_street; } if (!empty($venue_city)) { $cff_post_item .= '<br />' . $venue_city . ', ' . $venue_state . ' ' . $venue_zip; } $cff_map_text = $atts['maptext']; if (!empty($venue_latitude)) { $cff_post_item .= ' <a href="https://maps.google.com/maps?q=' . $venue_latitude . ',+' . $venue_longitude . '" ' . $target . ' style="color:#' . str_replace('#', '', $cff_event_link_color) . ';">' . $cff_map_text . '</a>'; } if (!empty($location)) { $cff_post_item .= '</p>'; } if (!empty($description)) { if (!empty($body_limit)) { if (strlen($description) > $body_limit) { $description = substr($description, 0, $body_limit) . '...'; } } $cff_post_item .= '<p class="cff-desc" ' . $cff_event_details_styles . '>' . cff_autolink($description, $link_color = str_replace('#', '', $cff_event_link_color)) . '</p>'; } } //End details if ($cff_thumb_layout || $cff_half_layout) { $cff_post_item .= '</div>'; } $cff_post_item .= '<div class="cff-meta-links">'; if ($cff_facebook_link_text == '') { $cff_facebook_link_text = 'View on Facebook'; } $cff_buy_tickets_text = $atts['buyticketstext']; if ($cff_show_link) { $cff_post_item .= '<a class="cff-viewpost" href="' . $event_link . '" ' . $target . ' ' . $cff_link_styles . '>' . $cff_facebook_link_text . '</a>'; } if ($ticket_uri) { $cff_post_item .= '<a class="cff-viewpost" href="' . $ticket_uri . '" ' . $target . ' ' . $cff_link_styles . '>' . $cff_buy_tickets_text . '</a>'; } $cff_post_item .= '</div></div><div class="cff-clear"></div>'; //Get the filter string $cff_filter_string = $atts['filter']; //Create a string from the event title, location and address to use in the filter check below $cff_event_address_string = $cff_event_title . $location . $venue_street . $venue_city . $venue_state . $venue_zip; $cff_show_post = true; if ($cff_filter_string != '') { //Explode it into multiples $cff_filter_strings_array = explode(',', $cff_filter_string); //Hide the post if both the post text and description don't contain the string $string_in_address = true; $string_in_desc = true; if (cff_stripos_arr($cff_event_address_string, $cff_filter_strings_array) === false) { $string_in_address = false; } if (cff_stripos_arr($description, $cff_filter_strings_array) === false) { $string_in_desc = false; } if ($string_in_address == false && $string_in_desc == false) { $cff_show_post = false; } } $cff_exclude_string = $atts['exfilter']; if ($cff_exclude_string != '') { //Explode it into multiples $cff_exclude_strings_array = explode(',', $cff_exclude_string); //Hide the post if both the post text and description don't contain the string $string_in_address = false; $string_in_desc = false; if (cff_stripos_arr($cff_event_address_string, $cff_exclude_strings_array) !== false) { $string_in_address = true; } if (cff_stripos_arr($description, $cff_exclude_strings_array) !== false) { $string_in_desc = true; } if ($string_in_address == true || $string_in_desc == true) { $cff_show_post = false; } } //PUSH TO ARRAY if the post should be shown if ($cff_show_post !== false) { $cff_posts_array = cff_array_push_assoc($cff_posts_array, strtotime($event_time), $cff_post_item); } } // End the loop //Sort all of the events by all page IDs to show the most recent upcoming events first if (!$cff_past_events) { ksort($cff_posts_array); } } //End EVENTS ONLY //ALL POSTS if (!$cff_events_only || $cff_events_only && $cff_events_source == 'timeline') { //Create date range using the Date Range extension $cff_ext_date_active ? $cff_date_range = cff_ext_date(strtotime($atts['from']), strtotime($atts['until'])) : ($cff_date_range = ''); $cff_posts_json_url = 'https://graph.facebook.com/' . $page_id . '/' . $graph_query . '?access_token=' . $access_token . '&limit=' . $cff_post_limit . '&locale=' . $cff_locale . $cff_ssl . $cff_date_range; //PHOTOS ONLY if ($cff_photos_only) { //Get the user's ID $get_page_info = cff_fetchUrl('https://graph.facebook.com/' . $page_id . '?access_token=' . $access_token); $page_info = json_decode($get_page_info); //Get user ID $u_id = $page_info->id; //PHOTOS ONLY if ($cff_is_group) { //For groups $cff_posts_json_url = "https://graph.facebook.com/fql?q=SELECT%20pid,created,src_big,link%20FROM%20photo%20WHERE%20pid%20IN%20(SELECT%20pid%20FROM%20photo_tag%20WHERE%20subject='" . $u_id . "')%20OR%20pid%20IN%20(SELECT%20pid%20FROM%20photo%20WHERE%20aid%20IN%20(SELECT%20aid%20FROM%20album%20WHERE%20owner='" . $u_id . "'%20AND%20type!='profile'))%20LIMIT%20" . $cff_post_limit; } else { //For pages $cff_posts_json_url = "https://graph.facebook.com/fql?q=SELECT%20pid,created,src_big,link%20FROM%20photo%20WHERE%20pid%20IN%20(SELECT%20pid%20FROM%20photo%20WHERE%20owner='" . $u_id . "')%20LIMIT%20" . $cff_post_limit; } } //ALBUMS ONLY if ($cff_albums_only && $cff_albums_source == 'photospage') { $cff_posts_json_url = 'https://graph.facebook.com/' . $page_id . '/albums?access_token=' . $access_token . '&limit=' . $cff_post_limit; } //Featured Post extension if ($cff_featured_post_active && !empty($atts['featuredpost'])) { $cff_posts_json_url = cff_featured_post_id(trim($atts['featuredpost']), $access_token); } //ALBUM EMBED $cff_album_id = $atts['album']; if ($cff_album_active && !empty($cff_album_id)) { //Get the JSON back from the Album extension $cff_album_json_url = cff_album_id(trim($cff_album_id), $access_token, $cff_post_limit); //Don't use caching if the cache time is set to zero if ($cff_cache_time != 0) { // Get any existing copy of our transient data $transient_name = 'cff_album_json_' . $cff_album_id; if (false === ($album_json = get_transient($transient_name)) || $album_json === null) { //Get the contents of the Facebook page $album_json = cff_fetchUrl($cff_album_json_url); //Cache the JSON set_transient($transient_name, $album_json, $cache_seconds); } else { $album_json = get_transient($transient_name); //If we can't find the transient then fall back to just getting the json from the api if ($album_json == false) { $album_json = cff_fetchUrl($cff_album_json_url); } } } else { $album_json = cff_fetchUrl($cff_album_json_url); } } //Don't use caching if the cache time is set to zero if ($cff_cache_time != 0) { // Get any existing copy of our transient data $transient_name = 'cff_' . $graph_query . '_json_' . $page_id . '_' . strtotime($atts['from']) . strtotime($atts['until']) . $atts['featuredpost'] . $cff_albums_only . $cff_albums_source . $cff_photos_only; if (false === ($posts_json = get_transient($transient_name)) || $posts_json === null) { //Get the contents of the Facebook page $posts_json = cff_fetchUrl($cff_posts_json_url); //Check whether any data is returned from the API. If it isn't then don't cache the error response and instead keep checking the API on every page load until data is returned. $FBdata = json_decode($posts_json); if (!empty($FBdata->data)) { //Cache the JSON set_transient($transient_name, $posts_json, $cache_seconds); } } else { $posts_json = get_transient($transient_name); //If we can't find the transient then fall back to just getting the json from the api if ($posts_json == false) { $posts_json = cff_fetchUrl($cff_posts_json_url); } } } else { $posts_json = cff_fetchUrl($cff_posts_json_url); } if ($cff_show_only_others) { //Get the numeric ID of the page so can compare it to the author of each post $page_object = cff_fetchUrl('https://graph.facebook.com/' . $page_id); $page_object = json_decode($page_object); $numeric_page_id = $page_object->id; } //Interpret data with JSON $FBdata = json_decode($posts_json); //If there's no data then show a pretty error message if (empty($FBdata->data) && (!$cff_featured_post_active || empty($atts['featuredpost']))) { $cff_content .= '<div class="cff-error-msg"><p>Unable to display Facebook posts.<br/><a href="javascript:void(0);" id="cff-show-error" onclick="cffShowError()">Show error</a>'; $cff_content .= '<script type="text/javascript">function cffShowError() { document.getElementById("cff-error-reason").style.display = "block"; document.getElementById("cff-show-error").style.display = "none"; }</script>'; $cff_content .= '</p><div id="cff-error-reason">'; if (isset($FBdata->error->message)) { $cff_content .= 'Error: ' . $FBdata->error->message; } if (isset($FBdata->error->type)) { $cff_content .= '<br />Type: ' . $FBdata->error->type; } if (isset($FBdata->error->code)) { $cff_content .= '<br />Code: ' . $FBdata->error->code; } if (isset($FBdata->error->error_subcode)) { $cff_content .= '<br />Subcode: ' . $FBdata->error->error_subcode; } if (isset($FBdata->error_msg)) { $cff_content .= 'Error: ' . $FBdata->error_msg; } if (isset($FBdata->error_code)) { $cff_content .= '<br />Code: ' . $FBdata->error_code; } if ($FBdata == null) { $cff_content .= 'Error: Server configuration issue'; } if (empty($FBdata->error) && empty($FBdata->error_msg) && $FBdata !== null) { $cff_content .= 'Error: No posts available for this Facebook ID'; } $cff_content .= '<br />Please refer to our <a href="https://smashballoon.com/custom-facebook-feed/docs/errors/" target="_blank">Error Message Reference</a>.</div>'; return $cff_content; } //ALBUM EMBED if ($cff_album_active && !empty($cff_album_id)) { $FBdata = json_decode($album_json); } //***STARTS POSTS LOOP*** //If the Featured Post extension is active then adjust the loop as there is no 'data' $cff_featured_post_active && !empty($atts['featuredpost']) ? $fbdata_string = $FBdata : ($fbdata_string = $FBdata->data); foreach ($fbdata_string as $news) { if ($cff_featured_post_active && !empty($atts['featuredpost'])) { $news = $FBdata; } $cff_post_item = ''; //Explode News and Page ID's into 2 values isset($news->id) ? $PostID = explode("_", $news->id) : ($PostID = ''); //Check the post type isset($news->type) ? $cff_post_type = $news->type : ($cff_post_type = ''); if ($cff_post_type == 'link') { isset($news->story) ? $story = $news->story : ($story = ''); //Check whether it's an event $event_link_check = "facebook.com/events/"; $event_link_check = stripos($news->link, $event_link_check); if ($event_link_check) { $cff_post_type = 'event'; } } //Set the post link isset($news->link) ? $link = htmlspecialchars($news->link) : ($link = ''); //If there's no link provided then link to the individual post if (empty($news->link)) { //Link to individual post if (isset($PostID[1])) { $link = "https://www.facebook.com/" . $page_id . "/posts/" . $PostID[1]; } } //Is it an album? $cff_album = false; $album_string = 'relevant_count='; $relevant_count = stripos($link, $album_string); if ($relevant_count) { //If relevant_count is larger than 1 then there are multiple photos $relevant_count = explode('relevant_count=', $link); $num_photos = intval($relevant_count[1]); if ($num_photos > 1) { $cff_album = true; //Link to the album instead of the photo $album_link = str_replace('photo.php?', 'media/set/?', $link); $link = "https://www.facebook.com/" . $page_id . "/posts/" . $PostID[1]; //If the album link is a new format then link it to the post $album_link_check = 'media/set/?'; if (stripos($album_link, $album_link_check) !== true) { $album_link = $link; } } } //Should we show this post or not? $cff_show_post = false; switch ($cff_post_type) { case 'link': if ($cff_show_links_type) { $cff_show_post = true; } break; case 'event': if ($cff_show_event_type) { $cff_show_post = true; } break; case 'video': if ($cff_show_video_type) { $cff_show_post = true; } break; case 'swf': if ($cff_show_video_type) { $cff_show_post = true; } break; case 'photo': if ($cff_show_photos_type && !$cff_album) { $cff_show_post = true; } if ($cff_show_albums_type && $cff_album) { $cff_show_post = true; } break; case 'offer': //Show offer posts if links are shown if ($cff_show_links_type) { $cff_show_post = true; } break; case 'music': //Show music posts if statuses are shown if ($cff_show_status_type) { $cff_show_post = true; } break; case 'status': //Check whether it's a status (author comment or like) if ($cff_show_status_type && !empty($news->message)) { $cff_show_post = true; } break; } //Featured Post extension if ($cff_featured_post_active && !empty($atts['featuredpost'])) { //Always show the post if using the Featured Post extension $cff_show_post = true; if ($cff_show_links_type) { $cff_post_type = 'link'; } if ($cff_show_event_type) { $cff_post_type = 'event'; } if ($cff_show_video_type) { $cff_post_type = 'video'; } if ($cff_show_photos_type) { $cff_post_type = 'photo'; } if ($cff_show_albums_type) { $cff_post_type = 'album'; } if ($cff_show_status_type) { $cff_post_type = 'status'; } //If it's a status then use full-width layout by default if ($cff_post_type == 'status') { $cff_thumb_layout = false; $cff_half_layout = false; } } //ONLY show posts by others if ($cff_show_only_others) { //If the post author's ID is the same as the page ID then don't show the post if ($numeric_page_id == $news->from->id) { $cff_show_post = false; } } //Only show posts containing specified string //Get post text $post_text = ''; if (!empty($news->story)) { $post_text = $news->story; } if (!empty($news->message)) { $post_text = $news->message; } if (!empty($news->name) && empty($news->story) && empty($news->message)) { $post_text = $news->name; } //Get description text if (isset($news->description)) { $description_text = $news->description; } else { isset($news->caption) ? $description_text = $news->caption : ($description_text = ''); } //Get the filter string $cff_filter_string = $atts['filter']; if ($cff_filter_string != '') { //Explode it into multiples $cff_filter_strings_array = explode(',', $cff_filter_string); //Hide the post if both the post text and description don't contain the string $string_in_post_text = true; $string_in_desc = true; if (cff_stripos_arr($post_text, $cff_filter_strings_array) === false) { $string_in_post_text = false; } if (cff_stripos_arr($description_text, $cff_filter_strings_array) === false) { $string_in_desc = false; } if ($string_in_post_text == false && $string_in_desc == false) { $cff_show_post = false; } } $cff_exclude_string = $atts['exfilter']; if ($cff_exclude_string != '') { //Explode it into multiples $cff_exclude_strings_array = explode(',', $cff_exclude_string); //Hide the post if both the post text and description don't contain the string $string_in_post_text = false; $string_in_desc = false; if (cff_stripos_arr($post_text, $cff_exclude_strings_array) !== false) { $string_in_post_text = true; } if (cff_stripos_arr($description_text, $cff_exclude_strings_array) !== false) { $string_in_desc = true; } if ($string_in_post_text == true || $string_in_desc == true) { $cff_show_post = false; } } //Is it a duplicate post? if (!isset($prev_post_message)) { $prev_post_message = ''; } if (!isset($prev_post_link)) { $prev_post_link = ''; } if (!isset($prev_post_description)) { $prev_post_description = ''; } isset($news->message) ? $pm = $news->message : ($pm = ''); isset($news->link) ? $pl = $news->link : ($pl = ''); isset($news->description) ? $pd = $news->description : ($pd = ''); if ($prev_post_message == $pm && $prev_post_link == $pl && $prev_post_description == $pd) { $cff_show_post = false; } //ALBUMS ONLY if ($cff_albums_only && $cff_albums_source == 'photospage') { $cff_show_post = true; } //ALBUM EMBED if ($cff_album_active && !empty($cff_album_id)) { $cff_show_post = true; } //PHOTOS ONLY if ($cff_photos_only) { $cff_show_post = true; } //Check post type and display post if selected if ($cff_show_post) { //If it isn't then create the post //Only create posts for the amount of posts specified // if ( $i == $show_posts ) break; $i++; //********************************// //***COMPILE SECTION VARIABLES***// //********************************// //Change image size based on layout if (!empty($news->picture) && !empty($news->object_id)) { $object_id = $news->object_id; $picture = 'https://graph.facebook.com/' . $object_id . '/picture?type=normal&width=9999&height=9999'; } //DATE $cff_date_formatting = $atts['dateformat']; $cff_date_custom = $atts['datecustom']; isset($news->created_time) ? $post_time = $news->created_time : ($post_time = ''); $cff_date = '<p class="cff-date" ' . $cff_date_styles . '>' . $cff_date_before . ' ' . cff_getdate(strtotime($post_time), $cff_date_formatting, $cff_date_custom) . ' ' . $cff_date_after; $cff_date .= '</p>'; //Only run if NOT only showing photos from the photos page, or albums, or an album embed if (!$cff_photos_only && !($cff_albums_only && $cff_albums_source == 'photospage') && empty($cff_album_id)) { //POST AUTHOR $cff_author = '<div class="cff-author">'; //Author text $cff_author .= '<a href="https://facebook.com/' . $news->from->id . '" ' . $target . ' title="' . $news->from->name . ' on Facebook" ' . $cff_author_styles . '><div class="cff-author-text">'; if ($cff_show_date && $cff_date_position !== 'above' && $cff_date_position !== 'below') { $cff_author .= '<p class="cff-page-name cff-author-date">' . $news->from->name . '</p>'; $cff_author .= $cff_date; } else { $cff_author .= '<span class="cff-page-name">' . $news->from->name . '</span>'; } $cff_author .= '</div>'; //Author image //Set the author image as a variable. If it already exists then don't query the api for it again. $cff_author_img_var = '$cff_author_img_' . $news->from->id; if (!isset(${$cff_author_img_var})) { ${$cff_author_img_var} = 'https://graph.facebook.com/' . $news->from->id . '/picture?type=square'; } $cff_author .= '<div class="cff-author-img"><img src="' . ${$cff_author_img_var} . '" title="' . $news->from->name . '" alt="' . $news->from->name . '" width=40 height=40></div>'; $cff_author .= '</a></div>'; //End .cff-author //POST TEXT $cff_translate_photos_text = $atts['photostext']; if (!isset($cff_translate_photos_text) || empty($cff_translate_photos_text)) { $cff_translate_photos_text = 'photos'; } $cff_post_text = '<' . $cff_title_format . ' class="cff-post-text" ' . $cff_title_styles . '>'; //__ shared __'s photo // if ($news->type == 'photo' && !empty($news->story) ) $cff_post_text .= '<span class="cff-byline" '.$cff_body_styles.'>' . $news->story . '</span>'; // $cff_post_text = '<div class="cff-post-text" ' . $cff_title_styles . '>'; $cff_post_text .= '<span class="cff-text" rel="' . str_replace('#', '', $atts['textlinkcolor']) . '">'; if ($cff_title_link) { $cff_post_text .= '<a class="cff-post-text-link" ' . $cff_title_styles . ' href="' . $link . '" ' . $target . '>'; } //Which content should we use? $cff_post_text_type = ''; //Use the story if (!empty($news->story)) { $post_text = htmlspecialchars($news->story); $cff_post_text_type = 'story'; } //Use the message if (!empty($news->message)) { $post_text = htmlspecialchars($news->message); $cff_post_text_type = 'message'; } //Use the name if (!empty($news->name) && empty($news->story) && empty($news->message)) { $post_text = htmlspecialchars($news->name); $cff_post_text_type = 'name'; } if ($cff_album) { if (!empty($news->name)) { $post_text = htmlspecialchars($news->name); $cff_post_text_type = 'name'; } if (!empty($news->message) && empty($news->name)) { $post_text = htmlspecialchars($news->message); $cff_post_text_type = 'message'; } $post_text .= ' (' . $num_photos . ' ' . $cff_translate_photos_text . ')'; } //OFFER TEXT if ($cff_post_type == 'offer') { isset($news->story) ? $post_text = htmlspecialchars($news->story) . '<br /><br />' : ($post_text = ''); $post_text .= htmlspecialchars($news->name); $cff_post_text_type = 'story'; } //MESSAGE TAGS $cff_post_tags = $atts['posttags']; //If the post tags option doesn't exist yet (ie. on plugin update) then set them as true if (!array_key_exists('cff_post_tags', $options)) { $cff_post_tags = true; } //Add message and story tags if there are any and the post text is the message or the story if ($cff_post_tags && (isset($news->message_tags) || isset($news->story_tags)) && ($cff_post_text_type == 'message' || $cff_post_text_type == 'story') && !$cff_title_link) { //Use message_tags or story_tags? isset($news->message_tags) ? $text_tags = $news->message_tags : ($text_tags = $news->story_tags); //If message tags and message is being used as the post text, or same with story. This stops story tags being used to replace the message inadvertently. if ($cff_post_text_type == 'message' && isset($news->message_tags) || $cff_post_text_type == 'story' && !isset($news->message_tags)) { //Does the Post Text contain any html tags? - the & symbol is the best indicator of this $cff_html_check_array = array('<', '’', '“', '"', '&'); //always use the text replace method if (cff_stripos_arr($post_text, $cff_html_check_array) !== false) { //Loop through the tags foreach ($text_tags as $message_tag) { $tag_name = $message_tag[0]->name; $tag_link = '<a href="http://facebook.com/' . $message_tag[0]->id . '" style="color: #' . str_replace('#', '', $atts['textlinkcolor']) . ';" ' . $target . '>' . $message_tag[0]->name . '</a>'; $post_text = str_replace($tag_name, $tag_link, $post_text); } } else { //If it doesn't contain HTMl tags then use the offset to replace message tags $message_tags_arr = array(); $i = 0; foreach ($text_tags as $message_tag) { $i++; $message_tags_arr = cff_array_push_assoc($message_tags_arr, $i, array('id' => $message_tag[0]->id, 'name' => $message_tag[0]->name, 'type' => $message_tag[0]->type, 'offset' => $message_tag[0]->offset, 'length' => $message_tag[0]->length)); } for ($i = count($message_tags_arr); $i >= 1; $i--) { $b = '<a href="http://facebook.com/' . $message_tags_arr[$i]['id'] . '" style="color: #' . str_replace('#', '', $atts['textlinkcolor']) . ';" ' . $target . '>' . $message_tags_arr[$i]['name'] . '</a>'; $c = $message_tags_arr[$i]['offset']; $d = $message_tags_arr[$i]['length']; $post_text = cff_mb_substr_replace($post_text, $b, $c, $d); } } // end if/else } // end message check } //END MESSAGE TAGS //Check to see whether it's an embedded video so that we can show the name above the post text if necessary $cff_is_video_embed = false; if ($news->type == 'video') { $url = $news->source; //Embeddable video strings $youtube = 'youtube'; $youtu = 'youtu'; $vimeo = 'vimeo'; $youtubeembed = 'youtube.com/embed'; //Check whether it's a youtube video $youtube = stripos($url, $youtube); $youtu = stripos($url, $youtu); $youtubeembed = stripos($url, $youtubeembed); //Check whether it's a youtube video if ($youtube || $youtu || $youtubeembed || stripos($url, $vimeo) !== false) { $cff_is_video_embed = true; } //If the name exists and it's a non-embedded video then show the name at the top of the post text if (isset($news->name) && !$cff_is_video_embed) { if (!$cff_title_link) { $cff_post_text .= '<a href="' . $link . '" ' . $target . ' style="color: #' . str_replace('#', '', $atts['textlinkcolor']) . '">'; } $cff_post_text .= htmlspecialchars($news->name); if (!$cff_title_link) { $cff_post_text .= '</a>'; } $cff_post_text .= '<br />'; } } //Replace line breaks in text (needed for IE8) $post_text = preg_replace("/\r\n|\r|\n/", '<br/>', $post_text); //If the text is wrapped in a link then don't hyperlink any text within if ($cff_title_link) { //Wrap links in a span so we can break the text if it's too long $cff_post_text .= cff_wrap_span($post_text) . ' '; } else { //Don't use htmlspecialchars for post_text as it's added above so that it doesn't mess up the message_tag offsets $cff_post_text .= cff_autolink($post_text, $link_color = str_replace('#', '', $atts['textlinkcolor'])) . ' '; } if ($cff_title_link) { $cff_post_text .= '</a>'; } $cff_post_text .= '</span>'; //'See More' link $cff_post_text .= '<span class="cff-expand">... <a href="#" style="color: #' . str_replace('#', '', $atts['textlinkcolor']) . '"><span class="cff-more">' . $cff_see_more_text . '</span><span class="cff-less">' . $cff_see_less_text . '</span></a></span>'; $cff_post_text .= '</' . $cff_title_format . '>'; // $cff_post_text .= '</div>'; //DESCRIPTION $cff_description = ''; if (!empty($news->description) || !empty($news->caption)) { $description_text = ''; if (!empty($news->description)) { $description_text = $news->description; } else { $description_text = $news->caption; } if (!empty($body_limit)) { if (strlen($description_text) > $body_limit) { $description_text = substr($description_text, 0, $body_limit) . '...'; } } $cff_description .= '<p class="cff-post-desc" ' . $cff_body_styles . '><span>' . cff_autolink(htmlspecialchars($description_text)) . '</span></p>'; } //LINK $cff_shared_link = ''; //Display shared link if ($cff_post_type == 'link') { $cff_shared_link .= '<div class="cff-shared-link'; if ($cff_disable_link_box) { $cff_shared_link .= ' cff-no-styles"'; } if (!$cff_disable_link_box) { $cff_shared_link .= '" ' . $cff_link_box_styles; } $cff_shared_link .= '>'; if (isset($news->picture)) { if (!empty($news->picture)) { $picture = $news->picture; /*If the image doesn't have a _b version then the URL looks like this: http://photos-h.ak.fbcdn.net/hphotos-ak-prn1/v/1600273_348160658659104_383135394_s.jpg?oh=23124db338cd899962fa7fb2d7285306&oe=52D5F9BE&__gda__=1389770591_64da0df3e725ca2d1fd026b0e922c58b So check for this kind of string below and don't replace _s. with _b. */ $bigjpg = '_s.jpg?'; $bigpng = '_s.png?'; $biggif = '_s.gif?'; $bigbmp = '_s.bmp?'; $bigtjpg = '_t.jpg?'; $bigtpng = '_t.png?'; $bigtgif = '_t.gif?'; $bigtbmp = '_t.bmp?'; $imagecheck1 = stripos($picture, $bigjpg); $imagecheck2 = stripos($picture, $bigpng); $imagecheck3 = stripos($picture, $biggif); $imagecheck4 = stripos($picture, $bigbmp); $imagecheck5 = stripos($picture, $bigtjpg); $imagecheck6 = stripos($picture, $bigtpng); $imagecheck7 = stripos($picture, $bigtgif); $imagecheck8 = stripos($picture, $bigtbmp); if (!($imagecheck1 || $imagecheck2 || $imagecheck3 || $imagecheck4 || $imagecheck5 || $imagecheck6 || $imagecheck7 || $imagecheck8)) { //Show larger image $picture = str_replace('_s.', '_b.', $picture); $picture = str_replace('_q.', '_b.', $picture); $picture = str_replace('_t.', '_b.', $picture); } } //Check whether the image is a 1x1 placeholder $cff_link_image = true; $cff_one_x_one = '1x1.'; if (stripos($news->picture, $cff_one_x_one) == true || empty($news->picture)) { $cff_link_image = false; } //If there's a picture accompanying the link then display it if ($cff_link_image && $cff_show_media) { $cff_shared_link .= '<a class="cff-link" href="' . $link . '" ' . $target . '>'; $cff_shared_link .= '<img src="' . $picture . '" border="0" />'; $cff_shared_link .= '</a>'; } } //Display link name and description // if (!empty($news->description)) { $cff_shared_link .= '<div class="cff-text-link '; if (!$cff_link_image) { $cff_shared_link .= 'cff-no-image'; } //The link title: $cff_shared_link .= '"><' . $cff_link_title_format . ' class="cff-link-title" ' . $cff_link_title_styles . '><a href="' . $link . '" ' . $target . ' style="color:#' . str_replace('#', '', $cff_link_title_color) . ';">' . $news->name . '</a></' . $cff_link_title_format . '>'; //The link source: if (!empty($news->caption)) { $cff_shared_link .= '<p class="cff-link-caption" style="color:#' . str_replace('#', '', $cff_link_url_color) . ';">' . $news->caption . '</p>'; } if ($cff_show_desc) { $cff_shared_link .= $cff_description; } $cff_shared_link .= '</div>'; // } $cff_shared_link .= '</div>'; } //EVENT $cff_event = ''; if ($cff_show_event_title || $cff_show_event_details) { //Check for media if ($cff_post_type == 'event') { //Get the event id from the event URL. eg: http://www.facebook.com/events/123451234512345/ $event_url = parse_url($link); $url_parts = explode('/', $event_url['path']); //Get the id from the parts $eventID = $url_parts[count($url_parts) - 2]; //Get the contents of the event $event_json_url = 'https://graph.facebook.com/' . $eventID . '?access_token=' . $access_token . $cff_ssl; //Don't use caching if the cache time is set to zero if ($cff_cache_time != 0) { // Get any existing copy of our transient data $transient_name = 'cff_timeline_event_json_' . $eventID; if (false === ($event_json = get_transient($transient_name)) || $event_json === null) { //Get the contents of the Facebook page $event_json = cff_fetchUrl($event_json_url); //Cache the JSON set_transient($transient_name, $event_json, $cache_seconds); } else { $event_json = get_transient($transient_name); //If we can't find the transient then fall back to just getting the json from the api if ($event_json == false) { $event_json = cff_fetchUrl($event_json_url); } } } else { $event_json = cff_fetchUrl($event_json_url); } //Interpret data with JSON $event_object = json_decode($event_json); //Picture if ($cff_show_media) { $cff_event .= '<a title="' . $cff_facebook_link_text . '" class="cff-event-thumb" href="' . $link . '" ' . $target . '><img border="0" src="https://graph.facebook.com/' . $eventID . '/picture?width=200&height=200" /></a>'; } //Event date $event_time = $event_object->start_time; isset($event_object->end_time) ? $event_end_time = ' - ' . cff_eventdate(strtotime($event_object->end_time), $cff_event_date_formatting, $cff_event_date_custom) : ($event_end_time = ''); //If timezone migration is enabled then remove last 5 characters if (strlen($event_time) == 24) { $event_time = substr($event_time, 0, -5); } 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) . $event_end_time . '</p>'; } //EVENT //Display the event details $cff_event .= '<div class="cff-details">'; //show event date above title if ($cff_event_date_position == 'above') { $cff_event .= $cff_event_date; } //Show event title if ($cff_show_event_title && !empty($event_object->name)) { if ($cff_event_title_link) { $cff_event .= '<a href="' . $link . '" ' . $target . '>'; } $cff_event .= '<' . $cff_event_title_format . ' ' . $cff_event_title_styles . '>' . $event_object->name . '</' . $cff_event_title_format . '>'; if ($cff_event_title_link) { $cff_event .= '</a>'; } } //show event date below title if ($cff_event_date_position !== 'above') { $cff_event .= $cff_event_date; } //Show event details if ($cff_show_event_details) { //Location if (!empty($event_object->location)) { $cff_event .= '<p class="cff-where" ' . $cff_event_details_styles . '>' . $event_object->location . '</p>'; } //Description if (!empty($event_object->description)) { $description = $event_object->description; if (!empty($body_limit)) { if (strlen($description) > $body_limit) { $description = substr($description, 0, $body_limit) . '...'; } } $cff_event .= '<p class="cff-info" ' . $cff_event_details_styles . '>' . cff_autolink($description, $link_color = str_replace('#', '', $cff_event_link_color)) . '</p>'; } } $cff_event .= '</div>'; } } //MEDIA $cff_media = ''; //If it's a photo or a Featured post which is an image if ($news->type == 'photo' || $news->type == 'offer' || $cff_featured_post_active && !empty($atts['featuredpost']) && isset($news->images)) { if ($cff_post_type == 'offer' && !empty($news->picture)) { $picture = $news->picture; /*If the image doesn't have a _b version then the URL looks like this: http://photos-h.ak.fbcdn.net/hphotos-ak-prn1/v/1600273_348160658659104_383135394_s.jpg?oh=23124db338cd899962fa7fb2d7285306&oe=52D5F9BE&__gda__=1389770591_64da0df3e725ca2d1fd026b0e922c58b So check for this kind of string below and don't replace _s. with _b. */ $bigjpg = '_s.jpg?'; $bigpng = '_s.png?'; $biggif = '_s.gif?'; $bigbmp = '_s.bmp?'; $bigtjpg = '_t.jpg?'; $bigtpng = '_t.png?'; $bigtgif = '_t.gif?'; $bigtbmp = '_t.bmp?'; $imagecheck1 = stripos($picture, $bigjpg); $imagecheck2 = stripos($picture, $bigpng); $imagecheck3 = stripos($picture, $biggif); $imagecheck4 = stripos($picture, $bigbmp); $imagecheck5 = stripos($picture, $bigtjpg); $imagecheck6 = stripos($picture, $bigtpng); $imagecheck7 = stripos($picture, $bigtgif); $imagecheck8 = stripos($picture, $bigtbmp); if (!($imagecheck1 || $imagecheck2 || $imagecheck3 || $imagecheck4 || $imagecheck5 || $imagecheck6 || $imagecheck7 || $imagecheck8)) { //Show larger image $picture = str_replace('_s.', '_b.', $picture); $picture = str_replace('_q.', '_b.', $picture); $picture = str_replace('_t.', '_b.', $picture); } } if ($cff_facebook_link_text == '') { $cff_facebook_link_text = 'View on Facebook'; } $link_text = $cff_facebook_link_text; $cff_media = '<a title="' . $link_text . '" class="cff-photo'; if ($cff_media_position == 'above') { $cff_media .= ' cff-media-above'; } $cff_media .= '" href="'; //If it's an album then link the photo to the album if ($cff_album) { $cff_media .= $album_link; } else { $cff_media .= $link; } $cff_media .= '" ' . $target . '>'; //Alt text isset($news->caption) ? $cff_alt_text = $news->caption : ($cff_alt_text = $cff_facebook_link_text); if ($cff_album) { $cff_media .= '<div class="cff-album-icon">' . $num_photos . '</div>'; } $cff_media .= '<img src="' . $picture . '" border="0" alt="' . $cff_alt_text . '" />'; $cff_media .= '</a>'; } if ($news->type == 'swf') { if (!empty($news->picture)) { $picture = $news->picture; /*If the image doesn't have a _b version then the URL looks like this: http://photos-h.ak.fbcdn.net/hphotos-ak-prn1/v/1600273_348160658659104_383135394_s.jpg?oh=23124db338cd899962fa7fb2d7285306&oe=52D5F9BE&__gda__=1389770591_64da0df3e725ca2d1fd026b0e922c58b So check for this kind of string below and don't replace _s. with _b. */ $bigjpg = '_s.jpg?'; $bigpng = '_s.png?'; $biggif = '_s.gif?'; $bigbmp = '_s.bmp?'; $bigtjpg = '_t.jpg?'; $bigtpng = '_t.png?'; $bigtgif = '_t.gif?'; $bigtbmp = '_t.bmp?'; $imagecheck1 = stripos($picture, $bigjpg); $imagecheck2 = stripos($picture, $bigpng); $imagecheck3 = stripos($picture, $biggif); $imagecheck4 = stripos($picture, $bigbmp); $imagecheck5 = stripos($picture, $bigtjpg); $imagecheck6 = stripos($picture, $bigtpng); $imagecheck7 = stripos($picture, $bigtgif); $imagecheck8 = stripos($picture, $bigtbmp); if (!($imagecheck1 || $imagecheck2 || $imagecheck3 || $imagecheck4 || $imagecheck5 || $imagecheck6 || $imagecheck7 || $imagecheck8)) { //Show larger image $picture = str_replace('_s.', '_b.', $picture); $picture = str_replace('_q.', '_b.', $picture); $picture = str_replace('_t.', '_b.', $picture); } } $cff_swf_url = 'http://www.facebook.com/permalink.php?story_fbid=' . $PostID["1"] . '&id=' . $PostID['0']; $cff_media = '<a href="' . $cff_swf_url . '" class="cff-photo'; if ($cff_media_position == 'above') { $cff_media .= ' cff-media-above'; } $cff_media .= '" ' . $target . '><img src="' . $picture . '" border="0" /></a>'; } if ($news->type == 'video') { if (!empty($news->picture)) { $picture = $news->picture; /*If the image doesn't have a _b version then the URL looks like this: http://photos-h.ak.fbcdn.net/hphotos-ak-prn1/v/1600273_348160658659104_383135394_s.jpg?oh=23124db338cd899962fa7fb2d7285306&oe=52D5F9BE&__gda__=1389770591_64da0df3e725ca2d1fd026b0e922c58b So check for this kind of string below and don't replace _s. with _b. */ $bigjpg = '_s.jpg?'; $bigpng = '_s.png?'; $biggif = '_s.gif?'; $bigbmp = '_s.bmp?'; $bigtjpg = '_t.jpg?'; $bigtpng = '_t.png?'; $bigtgif = '_t.gif?'; $bigtbmp = '_t.bmp?'; $imagecheck1 = stripos($picture, $bigjpg); $imagecheck2 = stripos($picture, $bigpng); $imagecheck3 = stripos($picture, $biggif); $imagecheck4 = stripos($picture, $bigbmp); $imagecheck5 = stripos($picture, $bigtjpg); $imagecheck6 = stripos($picture, $bigtpng); $imagecheck7 = stripos($picture, $bigtgif); $imagecheck8 = stripos($picture, $bigtbmp); if (!($imagecheck1 || $imagecheck2 || $imagecheck3 || $imagecheck4 || $imagecheck5 || $imagecheck6 || $imagecheck7 || $imagecheck8)) { //Show larger image $picture = str_replace('_s.', '_b.', $picture); $picture = str_replace('_q.', '_b.', $picture); $picture = str_replace('_t.', '_b.', $picture); } } // url of video $url = $news->source; //Check whether it's a youtube video if ($youtube || $youtu || $youtubeembed) { //Get the unique video id from the url by matching the pattern if ($youtube || $youtubeembed) { if (preg_match("/v=([^&]+)/i", $url, $matches)) { $id = $matches[1]; } elseif (preg_match("/\\/v\\/([^&]+)/i", $url, $matches)) { $id = $matches[1]; } elseif (preg_match("/\\/embed\\/([^&]+)/i", $url, $matches)) { $id = $matches[1]; } } elseif ($youtu) { $id = end(explode('/', $url)); } $id = substr($id, 0, strrpos($id, '?')); // this is your template for generating embed codes $code = '<iframe class="youtube-player" type="text/html" src="https://www.youtube.com/embed/{id}" allowfullscreen frameborder="0"></iframe>'; // we replace each {id} with the actual ID of the video to get embed code for this particular video $code = str_replace('{id}', $id, $code); $cff_media = '<div class="cff-iframe-wrap"'; if (!empty($cff_video_height)) { $cff_media .= 'style="height: ' . $cff_video_height . '"'; } $cff_media .= '>' . $code . '</div>'; //Check whether it's a vimeo } else { if (stripos($url, $vimeo) !== false) { if (isset($news->source)) { //http://vimeo.com/moogaloop.swf?clip_id=101557016&autoplay=1 $query = parse_url($news->source, PHP_URL_QUERY); parse_str($query, $params); $clip_id = $params['clip_id']; $cff_media = '<div class="cff-iframe-wrap"'; if (!empty($cff_video_height)) { $cff_media .= 'style="height: ' . $cff_video_height . '"'; } $cff_media .= '><iframe src="https://player.vimeo.com/video/' . $clip_id . '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>'; } //Else link to the video file } else { //Show play button over video thumbnail $vid_link = $news->source; //Check whether the video source contains an mp4, as the HTML5 video player can't play any other type $cff_mp4_check = stripos($vid_link, '.mp4'); if ($cff_video_action == 'facebook') { $vid_link = $link; } //Title & alt text isset($news->name) ? $vid_title = $news->name : ($vid_title = $cff_facebook_link_text); if (empty($picture)) { $cff_is_video_embed = true; $cff_media = '<a class="cff-playbtn-solo" title="' . $vid_title . '" href="' . $vid_link . '" target="_blank"><i class="fa fa-play cff-playbtn no-poster"></i></a>'; } //If the video action is file then add the HTML5 video tags if ($cff_video_action !== 'facebook' && $cff_mp4_check) { $cff_media = '<div class="cff-html5-video"><a href="javascript:void(0);" class="cff-html5-play"><i class="fa fa-play cff-playbtn"></i></a><video src="' . $vid_link . '" poster="' . $picture . '" >'; } $cff_media .= '<a title="' . $vid_title . '" class="cff-vidLink" href="' . $link . '" ' . $target . '><i class="fa fa-play cff-playbtn"></i><img class="cff-poster" src="' . $picture . '" alt="' . $vid_title . '" /></a>'; if ($cff_video_action !== 'facebook' && $cff_mp4_check) { $cff_media .= '</video></div>'; } } } //Add the name to the description if it's a video embed if ($cff_is_video_embed) { $cff_description = '<div class="cff-desc-wrap '; if (empty($picture)) { $cff_description .= 'cff-no-image'; } $cff_description .= '"><' . $cff_link_title_format . ' class="cff-link-title" ' . $cff_link_title_styles . '><a href="' . $link . '" ' . $target . ' style="color:#' . str_replace('#', '', $cff_link_title_color) . ';">' . $news->name . '</a></' . $cff_link_title_format . '>'; if (!empty($body_limit)) { if (strlen($description_text) > $body_limit) { $description_text = substr($description_text, 0, $body_limit) . '...'; } } $cff_description .= '<p class="cff-post-desc" ' . $cff_body_styles . '><span>' . cff_autolink(htmlspecialchars($description_text)) . '</span></p></div>'; } } //META //how many comments are there? $comment_count = 0; $comment_count_display = '0'; if (!empty($news->comments)) { $comment_count = count($news->comments->data); $comment_count_display = $comment_count; if ($comment_count > 20) { $comment_count_display = '<div class="cff-loader fa-spin"></div><span class="cff-replace">20+</span>'; } } $cff_meta_total = '<div class="cff-meta-wrap">'; //Check for likes $cff_meta = ''; $cff_meta .= '<a href="javaScript:void(0);" class="cff-view-comments" ' . $cff_meta_styles . '><ul class="cff-meta '; $cff_meta .= $cff_icon_style; $cff_meta .= '"><li class="cff-likes"><span class="cff-icon">Likes:</span> <span class="cff-count">'; //How many likes are there? if (!empty($news->likes)) { $like_count = count($news->likes->data); } else { $like_count = '0'; } //If there is no likes then display zero if ($like_count == 0) { $cff_meta .= '0'; } else { if ($like_count < 25) { $cff_meta .= $like_count; } else { $cff_meta .= '<div class="cff-loader fa-spin"></div>'; $cff_meta .= '<span class="cff-replace">' . $like_count . '+</span>'; } } //Check for shares $cff_meta .= '</span></li><li class="cff-shares"><span class="cff-icon">Shares:</span> <span class="cff-count">'; if (empty($news->shares->count)) { $cff_meta .= '0'; } else { $cff_meta .= $news->shares->count; } //Check for comments $cff_meta .= '</span></li><li class="cff-comments"><span class="cff-icon">Comments:</span> <span class="cff-count">'; //How many comments are there? $cff_meta .= $comment_count_display; $cff_meta .= '</span></li></ul></a>'; //Display the link to the Facebook post or external link $cff_link = ''; //Default link $cff_viewpost_class = 'cff-viewpost-facebook'; if ($cff_facebook_link_text == '') { $cff_facebook_link_text = 'View on Facebook'; } $link_text = $cff_facebook_link_text; //Link to the Facebook post if it's a link or a video if ($cff_post_type == 'link' || $cff_post_type == 'video') { $link = "https://www.facebook.com/" . $page_id . "/posts/" . $PostID[1]; } //If Featured Post extension then change the $link var based on whether a full or half post ID is used if ($cff_featured_post_active && !empty($atts['featuredpost'])) { //If the post type is a link or a video (other link types have the link included in the JSON) if ($cff_post_type == 'link' || $cff_post_type == 'video') { if (stripos($news->id, '_') !== false) { //If using the full post ID with an underscore then create the link like this: $link = "https://www.facebook.com/" . $PostID[0] . "/posts/" . $PostID[1]; } else { //If just using the short ID then create the link like this: $link = "https://www.facebook.com/" . $news->id; } } } if ($cff_post_type == 'offer') { $link_text = 'View Offer'; } $cff_link = '<a class="' . $cff_viewpost_class . '" href="' . $link . '" title="' . $link_text . '" ' . $target . ' ' . $cff_link_styles . '>' . $link_text . '</a>'; //Compile the meta and link if included if ($cff_show_link) { $cff_meta_total .= $cff_link; } if ($cff_show_meta) { $cff_meta_total .= $cff_meta; } $cff_meta_total .= '</div>'; $cff_comments = ''; //Get custom text strings $cff_translate_view_previous_comments_text = $atts['previouscommentstext']; $cff_translate_comment_on_facebook_text = $atts['commentonfacebooktext']; $cff_translate_likes_this_text = $atts['likesthistext']; $cff_translate_like_this_text = $atts['likethistext']; $cff_translate_and_text = $atts['andtext']; $cff_translate_other_text = $atts['othertext']; $cff_translate_others_text = $atts['otherstext']; if (!isset($cff_translate_view_previous_comments_text) || empty($cff_translate_view_previous_comments_text)) { $cff_translate_view_previous_comments_text = 'View previous comments'; } if (!isset($cff_translate_comment_on_facebook_text) || empty($cff_translate_comment_on_facebook_text)) { $cff_translate_comment_on_facebook_text = 'Comment on Facebook'; } if (!isset($cff_translate_likes_this_text) || empty($cff_translate_likes_this_text)) { $cff_translate_likes_this_text = 'likes this'; } if (!isset($cff_translate_like_this_text) || empty($cff_translate_like_this_text)) { $cff_translate_like_this_text = 'like this'; } if (!isset($cff_translate_and_text) || empty($cff_translate_and_text)) { $cff_translate_and_text = 'and'; } if (!isset($cff_translate_other_text) || empty($cff_translate_other_text)) { $cff_translate_other_text = 'other'; } if (!isset($cff_translate_others_text) || empty($cff_translate_others_text)) { $cff_translate_others_text = 'others'; } //Create the comments box $cff_comments .= '<div class="cff-comments-box ' . $cff_icon_style; if ($comment_count == 0 || $cff_comments_num == 0) { $cff_comments .= ' cff-no-comments'; } $cff_comments .= '"'; //Expand comments box initially if ($cff_expand_comments) { $cff_comments .= ' style="display: block;"'; } //Number of comments to show initially $cff_comments .= ' rel="' . $cff_comments_num . '"'; $cff_comments .= '>'; //Get the likes if (!empty($news->likes->data)) { $liker_one = ''; $liker_two = ''; if ($news->likes->data[0]) { $liker_one = '<a href="https://facebook.com/' . $news->likes->data[0]->id . '" ' . $cff_meta_link_color . ' ' . $target . '>' . $news->likes->data[0]->name . '</a>'; } if ($like_count > 1) { $liker_two = '<a href="https://facebook.com/' . $news->likes->data[1]->id . '" ' . $cff_meta_link_color . ' ' . $target . '>' . $news->likes->data[1]->name . '</a>'; } if ($like_count > 0) { $cff_comments .= '<p class="cff-comment-likes cff-likes" ' . $cff_meta_styles . '><span class="cff-icon"></span>'; } if ($like_count == 1) { $cff_comments .= $liker_one . ' ' . $cff_translate_likes_this_text; } else { if ($like_count == 2) { $cff_comments .= $liker_one . ' ' . $cff_translate_and_text . ' ' . $liker_two . ' ' . $cff_translate_like_this_text; } else { if ($like_count == 3) { $cff_comments .= $liker_one . ', ' . $liker_two . ' ' . $cff_translate_and_text . ' 1 ' . $cff_translate_other_text . ' ' . $cff_translate_like_this_text; } else { $cff_comments .= $liker_one . ', ' . $liker_two . ' ' . $cff_translate_and_text . ' '; if ($like_count == 25) { $cff_comments .= '<span class="cff-comment-likes-count">'; } $cff_comments .= intval($like_count) - 2; if ($like_count == 25) { $cff_comments .= '</span>'; } $cff_comments .= ' ' . $cff_translate_others_text . ' ' . $cff_translate_like_this_text; } } } if ($like_count > 0) { $cff_comments .= '</p>'; } } //Show more comments if ($comment_count > $cff_comments_num) { $cff_comments .= '<p class="cff-comments cff-show-more-comments" ' . $cff_meta_styles . '><a href="javascript:void(0);" ' . $cff_meta_link_color . '><span class="cff-icon"></span>' . $cff_translate_view_previous_comments_text . '</a></p>'; } //Get the comments if (!empty($news->comments->data)) { //Give the comment an index so we know which one it is $comment_index = 0; //Loop through comments foreach ($news->comments->data as $comment_item) { $comment_likes = $comment_item->like_count; $comment = htmlspecialchars($comment_item->message); //MESSAGE TAGS if ($cff_post_tags && isset($comment_item->message_tags)) { //Loop through the tags and use the name to replace them foreach ($comment_item->message_tags as $message_tag) { $tag_name = $message_tag->name; $tag_link = '<a href="http://facebook.com/' . $message_tag->id . '" ' . $target . ' ' . $cff_meta_link_color . '>' . $message_tag->name . '</a>'; $comment = str_replace($tag_name, $tag_link, $comment); } } //END MESSAGE TAGS //Create comments $cff_comments .= '<div class="cff-comment" id="' . $comment_item->from->id . '" ' . $cff_meta_styles . '>'; $cff_comments .= '<div class="cff-comment-text-wrapper">'; $cff_comments .= '<div class="cff-comment-text'; if ($cff_hide_comment_avatars) { $cff_comments .= ' cff-no-image'; } $cff_comments .= '"><a href="https://facebook.com/' . $comment_item->from->id . '" class="cff-name" ' . $target . ' ' . $cff_meta_link_color . '>' . $comment_item->from->name . '</a>' . cff_autolink($comment, $link_color = str_replace('#', '', $atts['sociallinkcolor'])); $cff_comments .= '<span class="cff-time">'; $cff_comments .= cff_timeSince(strtotime($comment_item->created_time)) . ' ' . $cff_date_after; if ($comment_likes > 0) { $cff_comments .= '<span class="cff-comment-likes"> · <b></b>' . $comment_likes . '</span>'; } $cff_comments .= '</span>'; $cff_comments .= '</div>'; //End .cff-comment-text $cff_comments .= '</div>'; //End .cff-comment-text-wrapper $cff_comments .= '<div class="cff-comment-img"><a href="https://facebook.com/' . $comment_item->from->id . '" ' . $target . '>'; //Only load the comment avatars if they're being displayed initially, otherwise load via JS on click if (!$cff_hide_comment_avatars) { if ($cff_expand_comments && $comment_index >= $comment_count - $cff_comments_num) { $cff_comments .= '<img src="https://graph.facebook.com/' . $comment_item->from->id . '/picture" width=32 height=32>'; } else { $cff_comments .= '<img width=32 height=32>'; } } $cff_comments .= '</a></div>'; $cff_comments .= '</div>'; //End .cff-comment $comment_index++; } } $cff_comments .= '<p class="cff-comments cff-comment-on-facebook" ' . $cff_meta_styles . '><a href="' . $link . '" ' . $target . ' ' . $cff_meta_link_color . '><span class="cff-icon"></span>' . $cff_translate_comment_on_facebook_text . '</a></p>'; $cff_comments .= '</div>'; //Compile comments if meta is included if ($cff_show_meta) { $cff_meta_total .= $cff_comments; } //**************************// //***CREATE THE POST HTML***// //**************************// //Start the container $cff_post_item .= '<div class="cff-item '; if ($cff_post_type == 'link') { $cff_post_item .= 'cff-link-item'; } if ($cff_post_type == 'event') { $cff_post_item .= 'cff-timeline-event'; } if ($cff_post_type == 'photo') { $cff_post_item .= 'cff-photo-post'; } if ($cff_post_type == 'video') { $cff_post_item .= 'cff-video-post'; } if ($cff_is_video_embed) { $cff_post_item .= ' cff-embedded-video'; } if ($cff_post_type == 'swf') { $cff_post_item .= 'cff-swf-post'; } if ($cff_post_type == 'status') { $cff_post_item .= 'cff-status-post'; } if ($cff_post_type == 'offer') { $cff_post_item .= 'cff-offer-post'; } if ($cff_album) { $cff_post_item .= ' cff-album'; } if ($cff_post_bg_color_check) { $cff_post_item .= ' cff-box'; } $cff_post_item .= ' author-' . cff_to_slug($news->from->name) . '" id="' . $news->id . '" ' . $cff_item_styles . '>'; //POST AUTHOR $cff_is_video_embed = false; if ($cff_is_video_embed) { if ($cff_show_author) { $cff_post_item .= $cff_author; } //DATE ABOVE if ($cff_show_date && $cff_date_position == 'above') { $cff_post_item .= $cff_date; } //If embedded video then show post text above the wrapper if ($cff_show_text) { $cff_post_item .= $cff_post_text; } $cff_post_item .= '<div class="cff-embed-wrap">'; } //Start text wrapper if (($cff_thumb_layout || $cff_half_layout) && !empty($news->picture)) { $cff_post_item .= '<div class="cff-text-wrapper">'; } //POST AUTHOR if ($cff_show_author && !$cff_is_video_embed) { $cff_post_item .= $cff_author; } //MEDIA if ($cff_show_media && $cff_media_position == 'above') { $cff_post_item .= $cff_media; } //DATE ABOVE if ($cff_show_date && $cff_date_position == 'above' && !$cff_is_video_embed) { $cff_post_item .= $cff_date; } //POST TEXT if ($cff_show_text && !$cff_is_video_embed) { $cff_post_item .= $cff_post_text; } //DESCRIPTION if ($cff_show_desc && $cff_post_type != 'offer' && $cff_post_type != 'link') { $cff_post_item .= $cff_description; } //LINK if ($cff_show_shared_links) { $cff_post_item .= $cff_shared_link; } //DATE BELOW if (!$cff_show_author && $cff_date_position == 'author' || $cff_show_date && $cff_date_position == 'below' && !$cff_is_video_embed) { if ($cff_show_date && $cff_post_type !== 'event') { $cff_post_item .= $cff_date; } } //End text wrapper if (($cff_thumb_layout || $cff_half_layout) && !empty($news->picture)) { $cff_post_item .= '</div>'; } //EVENT if ($cff_show_event_title || $cff_show_event_details) { $cff_post_item .= $cff_event; } //MEDIA if ($cff_show_media && $cff_media_position !== 'above') { $cff_post_item .= $cff_media; if ($cff_is_video_embed) { $cff_post_item .= '</div>'; } } //DATE BELOW if ($cff_show_date && $cff_date_position == 'below' && $cff_is_video_embed) { $cff_post_item .= $cff_date; } if ($cff_show_date && $cff_post_type == 'event' && ($cff_date_position == 'below' || $cff_date_position == 'author' && !$cff_show_author)) { $cff_post_item .= $cff_date; } //META if ($cff_show_meta || $cff_show_link) { $cff_post_item .= $cff_meta_total; } //End the post item $cff_post_item .= '</div>'; // $cff_post_item .= '<div class="cff-clear"></div>'; } // End !$cff_photos_only || albums only || album embed //ALBUMS ONLY if ($cff_albums_only && $cff_albums_source == 'photospage') { isset($news->link) ? $cff_album_link = $news->link : ($cff_album_link = ''); isset($news->name) ? $cff_album_name = $news->name : ($cff_album_name = ''); //GROUP ALBUMS if ($cff_is_group) { //Cover photos aren't available for group albums $cff_post_item = '<div class="cff-album-item cff-col-'; $cff_post_item .= $cff_album_cols; $cff_post_item .= '">'; $cff_post_item .= '<h4><a href="' . $cff_album_link . '" ' . $target . '>' . $cff_album_name . '</a></h4>'; $cff_post_item .= '</div>'; //Group albums use 'created' instead of 'created_time' like other posts $post_time = $news->created; } else { isset($news->cover_photo) ? $thumb = 'https://graph.facebook.com/' . $news->cover_photo . '/picture' : ($thumb = ''); isset($news->count) ? $cff_album_count = $news->count : ($cff_album_count = ''); $cff_post_item = '<div class="cff-album-item cff-col-'; $cff_post_item .= $cff_album_cols; $cff_post_item .= '">'; $cff_post_item .= '<a href="' . $cff_album_link . '" class="cff-album-cover" ' . $target . '><img src="' . $thumb . '" alt="' . $cff_album_name . '" /></a>'; if ($cff_show_album_title || $cff_show_album_number) { $cff_post_item .= '<div class="cff-album-info">'; } if ($cff_show_album_title) { $cff_post_item .= '<h4><a href="' . $cff_album_link . '" ' . $target . '>' . $cff_album_name . '</a></h4>'; } if ($cff_show_album_number && isset($news->count)) { $cff_post_item .= '<p>' . $cff_album_count . ' photos</p>'; } if ($cff_show_album_title || $cff_show_album_number) { $cff_post_item .= '</div>'; } $cff_post_item .= '</div>'; //If there's no photos in the album then don't show it if (!isset($news->cover_photo)) { $cff_post_item = ''; } } } //ALBUM EMBED if ($cff_album_active && !empty($cff_album_id)) { $cff_post_item = '<div class="cff-album-item cff-col-'; $cff_post_item .= $cff_album_cols; $cff_post_item .= '">'; $cff_post_item .= '<a href="https://facebook.com/' . $news->id . '" class="cff-album-cover" title="' . $news->name . '" ' . $target . '><img src="' . $news->source . '" /></a>'; $cff_post_item .= '</div>'; $post_time = $i; } if ($cff_photos_only) { //PHOTOS ONLY $cff_post_item = '<div class="cff-album-item cff-col-' . $cff_photos_cols . '">'; $cff_post_item .= '<a href="' . $news->link . '" class="cff-album-cover" ' . $target . '><img src="' . $news->src_big . '" /></a>'; $cff_post_item .= '</div>'; if ($cff_is_group) { //FOR GROUPS $post_time = $news->created; $cff_posts_array = cff_array_push_assoc_photos($cff_posts_array, $i, $cff_post_item, $post_time); } else { //FOR PAGES $cff_content .= $cff_post_item; } } else { //PUSH POSTS TO ARRAY $cff_posts_array = cff_array_push_assoc($cff_posts_array, $post_time, $cff_post_item); } } // End post type check if (isset($news->message)) { $prev_post_message = $news->message; } if (isset($news->link)) { $prev_post_link = $news->link; } if (isset($news->description)) { $prev_post_description = $news->description; } } // End the loop if ($cff_photos_only) { //PHOTOS ONLY usort($cff_posts_array, 'sortByOrder'); } else { if ($cff_album_active && !empty($cff_album_id)) { //ALBUM EMBED //Don't sort array. Display posts in their native order. } else { //Sort the array in reverse order (newest first) krsort($cff_posts_array); } } } // End ALL POSTS } // END PAGE_IDS LOOP //Output the posts array if ($cff_photos_only) { //PHOTOS ONLY $p = 0; foreach ($cff_posts_array as $post) { if ($p == $show_posts) { break; } $cff_content .= $post['post']; $p++; } } else { $p = 0; foreach ($cff_posts_array as $post) { if ($p == $show_posts) { break; } $cff_content .= $post; $p++; } } //Reset the timezone date_default_timezone_set($cff_orig_timezone); //Add the Like Box inside if ($cff_like_box_position == 'bottom' && $cff_show_like_box && !$cff_like_box_outside) { $cff_content .= $like_box; } //End the feed $cff_content .= '</div><div class="cff-clear"></div>'; //Add the Like Box outside if ($cff_like_box_position == 'bottom' && $cff_show_like_box && $cff_like_box_outside) { $cff_content .= $like_box; } //If the feed is loaded via Ajax then put the scripts into the shortcode itself $ajax_theme = $atts['ajax']; $ajax_theme == 'on' || $ajax_theme == 'true' || $ajax_theme == true ? $ajax_theme = true : ($ajax_theme = false); if ($atts['ajax'] == 'false') { $ajax_theme = false; } if ($ajax_theme) { $url = plugins_url(); $path = urlencode(ABSPATH); $cff_link_hashtags = $atts['linkhashtags']; $cff_link_hashtags == 'true' || $cff_link_hashtags == 'on' ? $cff_link_hashtags = 'true' : ($cff_link_hashtags = 'false'); if ($cff_title_link == 'true' || $cff_title_link == 'on') { $cff_link_hashtags = 'false'; } $cff_content .= '<script type="text/javascript">var cffsiteurl = "' . $url . '", cfflinkhashtags = "' . $cff_link_hashtags . '";</script>'; $cff_content .= '<script type="text/javascript" src="' . plugins_url('/js/cff-scripts.js?8', __FILE__) . '"></script>'; } $cff_content .= '</div>'; //Return our feed HTML to display return $cff_content; }
<?php include 'connect.php'; //Get Post ID $comment_id = $_GET['id']; $json_object = cff_fetchUrl("https://graph.facebook.com/" . $comment_id . "/?fields=comments{created_time,from,id,message,message_tags,attachment,like_count}&access_token=" . $access_token); //If no data returned then return if (empty($json_object) || $json_object == '') { echo ''; } echo $json_object;
<?php include 'connect.php'; //Get Post ID $post_id = $_GET['id']; //Which meta type should we query? $metaType = $_GET['type']; $json_object = cff_fetchUrl("https://graph.facebook.com/" . $post_id . "/" . $metaType . "?summary=true&access_token=" . $access_token); //If no data returned then return if (empty($json_object) || $json_object == '') { echo '25+'; } $FBdata = json_decode($json_object); $meta_count = ''; //If the summary of the count data isn't there then return if (isset($FBdata->summary)) { $meta_count = $FBdata->summary->total_count; } else { echo '25+'; } if (is_numeric($meta_count)) { echo $meta_count; }
} elseif (ini_get('allow_url_fopen') == 1 || ini_get('allow_url_fopen') === TRUE) { $feedData = @file_get_contents($url); //Or else use the WP HTTP API } else { if (!class_exists('WP_Http')) { include_once ABSPATH . WPINC . '/class-http.php'; } $request = new WP_Http(); $result = $request->request($url); $feedData = $result['body']; } return $feedData; } //Get Post ID $post_id = $_GET['id']; //Which meta type should we query? $metaType = $_GET['type']; if ($metaType == 'likes') { $row = 'like_info'; $cell = 'like_count'; } else { if ($metaType == 'comments') { $row = 'comment_info'; $cell = 'comment_count'; } } $json_object = cff_fetchUrl("https://graph.facebook.com/fql?q=SELECT%20" . $row . "%20FROM%20stream%20WHERE%20post_id='" . $post_id . "'%20&access_token=" . $access_token); $FBdata = json_decode($json_object); foreach ($FBdata->data as $news) { echo $news->{$row}->{$cell}; }
function cff_settings_page() { //Which extensions are active? //Is individual extension active || is Smash License extensions bundle active? $cff_ext_options = get_option('cff_extensions_status'); //Set extensions in extensions plugin all to false by default $cff_extensions_multifeed_active = false; $cff_extensions_date_range_active = false; $cff_extensions_featured_post_active = false; $cff_extensions_album_active = false; $cff_extensions_lightbox_active = false; if (WPW_SL_ITEM_NAME == 'Custom Facebook Feed WordPress Plugin Smash') { //Set page variables if (isset($cff_ext_options['cff_extensions_multifeed_active'])) { $cff_extensions_multifeed_active = $cff_ext_options['cff_extensions_multifeed_active']; } if (isset($cff_ext_options['cff_extensions_date_range_active'])) { $cff_extensions_date_range_active = $cff_ext_options['cff_extensions_date_range_active']; } if (isset($cff_ext_options['cff_extensions_featured_post_active'])) { $cff_extensions_featured_post_active = $cff_ext_options['cff_extensions_featured_post_active']; } if (isset($cff_ext_options['cff_extensions_album_active'])) { $cff_extensions_album_active = $cff_ext_options['cff_extensions_album_active']; } if (isset($cff_ext_options['cff_extensions_lightbox_active'])) { $cff_extensions_lightbox_active = $cff_ext_options['cff_extensions_lightbox_active']; } } is_plugin_active('cff-multifeed/cff-multifeed.php') || $cff_extensions_multifeed_active ? $cff_ext_multifeed_active = true : ($cff_ext_multifeed_active = false); is_plugin_active('cff-date-range/cff-date-range.php') || $cff_extensions_date_range_active ? $cff_ext_date_active = true : ($cff_ext_date_active = false); is_plugin_active('cff-featured-post/cff-featured-post.php') || $cff_extensions_featured_post_active ? $cff_featured_post_active = true : ($cff_featured_post_active = false); is_plugin_active('cff-album/cff-album.php') || $cff_extensions_album_active ? $cff_album_active = true : ($cff_album_active = false); is_plugin_active('cff-lightbox/cff-lightbox.php') || $cff_extensions_lightbox_active ? $cff_lightbox_active = true : ($cff_lightbox_active = false); //Declare variables for fields $hidden_field_name = 'cff_submit_hidden'; $show_access_token = 'cff_show_access_token'; $access_token = 'cff_access_token'; $page_id = 'cff_page_id'; $cff_page_type = 'cff_page_type'; $num_show = 'cff_num_show'; $cff_post_limit = 'cff_post_limit'; $cff_show_others = 'cff_show_others'; $cff_cache_time = 'cff_cache_time'; $cff_cache_time_unit = 'cff_cache_time_unit'; $cff_locale = 'cff_locale'; //Extensions $cff_date_from = 'cff_date_from'; $cff_date_until = 'cff_date_until'; $cff_featured_post_id = 'cff_featured_post_id'; $cff_lightbox = 'cff_lightbox'; // Read in existing option value from database $show_access_token_val = get_option($show_access_token); $access_token_val = get_option($access_token); $page_id_val = get_option($page_id); $cff_page_type_val = get_option($cff_page_type); $num_show_val = get_option($num_show, '5'); $cff_post_limit_val = get_option($cff_post_limit); $cff_show_others_val = get_option($cff_show_others); $cff_cache_time_val = get_option($cff_cache_time, '1'); $cff_cache_time_unit_val = get_option($cff_cache_time_unit, 'hours'); $cff_locale_val = get_option($cff_locale, 'en_US'); //Extensions $cff_date_from_val = get_option($cff_date_from); $cff_date_until_val = get_option($cff_date_until); $cff_featured_post_id_val = get_option($cff_featured_post_id); $cff_lightbox_val = get_option($cff_lightbox); // See if the user has posted us some information. If they did, this hidden field will be set to 'Y'. if (isset($_POST[$hidden_field_name]) && $_POST[$hidden_field_name] == 'Y') { // Read their posted value isset($_POST[$show_access_token]) ? $show_access_token_val = $_POST[$show_access_token] : ($show_access_token_val = ''); isset($_POST[$access_token]) ? $access_token_val = $_POST[$access_token] : ($access_token_val = ''); isset($_POST[$page_id]) ? $page_id_val = $_POST[$page_id] : ($page_id_val = ''); isset($_POST[$cff_page_type]) ? $cff_page_type_val = $_POST[$cff_page_type] : ($cff_page_type_val = ''); isset($_POST[$num_show]) ? $num_show_val = $_POST[$num_show] : ($num_show_val = ''); isset($_POST[$cff_post_limit]) ? $cff_post_limit_val = $_POST[$cff_post_limit] : ($cff_post_limit_val = ''); isset($_POST[$cff_show_others]) ? $cff_show_others_val = $_POST[$cff_show_others] : ($cff_show_others_val = ''); isset($_POST[$cff_cache_time]) ? $cff_cache_time_val = $_POST[$cff_cache_time] : ($cff_cache_time_val = ''); isset($_POST[$cff_cache_time_unit]) ? $cff_cache_time_unit_val = $_POST[$cff_cache_time_unit] : ($cff_cache_time_unit_val = ''); isset($_POST[$cff_locale]) ? $cff_locale_val = $_POST[$cff_locale] : ($cff_locale_val = ''); //Extensions isset($_POST[$cff_date_from]) ? $cff_date_from_val = $_POST[$cff_date_from] : ($cff_date_from_val = ''); isset($_POST[$cff_date_until]) ? $cff_date_until_val = $_POST[$cff_date_until] : ($cff_date_until_val = ''); isset($_POST[$cff_featured_post_id]) ? $cff_featured_post_id_val = $_POST[$cff_featured_post_id] : ($cff_featured_post_id_val = ''); isset($_POST[$cff_lightbox]) ? $cff_lightbox_val = $_POST[$cff_lightbox] : ($cff_lightbox_val = ''); // Save the posted value in the database update_option($show_access_token, $show_access_token_val); update_option($access_token, $access_token_val); update_option($page_id, $page_id_val); update_option($cff_page_type, $cff_page_type_val); update_option($num_show, $num_show_val); update_option($cff_post_limit, $cff_post_limit_val); update_option($cff_show_others, $cff_show_others_val); update_option($cff_cache_time, $cff_cache_time_val); update_option($cff_cache_time_unit, $cff_cache_time_unit_val); update_option($cff_locale, $cff_locale_val); //Extensions update_option($cff_date_from, $cff_date_from_val); update_option($cff_date_until, $cff_date_until_val); update_option($cff_featured_post_id, $cff_featured_post_id_val); update_option($cff_lightbox, $cff_lightbox_val); //Delete the transient for the main page ID delete_transient('cff_posts_json_' . $page_id_val); delete_transient('cff_feed_json_' . $page_id_val); delete_transient('cff_events_json_' . $page_id_val); //Delete ALL transients global $wpdb; $table_name = $wpdb->prefix . "options"; $wpdb->query("\r\n DELETE\r\n FROM {$table_name}\r\n WHERE `option_name` LIKE ('%cff\\_posts\\_json\\_%')\r\n "); $wpdb->query("\r\n DELETE\r\n FROM {$table_name}\r\n WHERE `option_name` LIKE ('%cff\\_feed\\_json\\_%')\r\n "); $wpdb->query("\r\n DELETE\r\n FROM {$table_name}\r\n WHERE `option_name` LIKE ('%cff\\_events\\_json\\_%')\r\n "); $wpdb->query("\r\n DELETE\r\n FROM {$table_name}\r\n WHERE `option_name` LIKE ('%cff\\_timeline\\_event\\_json\\_%')\r\n "); $wpdb->query("\r\n DELETE\r\n FROM {$table_name}\r\n WHERE `option_name` LIKE ('%cff\\_album\\_json\\_%')\r\n "); // Put an settings updated message on the screen ?> <div class="updated"><p><strong><?php _e('Settings saved.', 'custom-facebook-feed'); ?> </strong></p></div> <?php } ?> <div id="cff-admin" class="wrap"> <div id="header"> <h2><?php _e('Custom Facebook Feed Settings'); ?> </h2> </div> <?php cff_expiration_notice(); ?> <?php $cff_active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'configuration'; ?> <h2 class="nav-tab-wrapper"> <a href="?page=cff-top&tab=configuration" class="nav-tab <?php echo $cff_active_tab == 'configuration' ? 'nav-tab-active' : ''; ?> "><?php _e('Configuration'); ?> </a> <a href="?page=cff-style" class="nav-tab"><?php _e('Customize'); ?> </a> <a href="?page=cff-top&tab=license" class="nav-tab <?php echo $cff_active_tab == 'license' ? 'nav-tab-active' : ''; ?> "><?php _e('License'); ?> </a> <a href="?page=cff-top&tab=support" class="nav-tab <?php echo $cff_active_tab == 'support' ? 'nav-tab-active' : ''; ?> "><?php _e('Support'); ?> </a> </h2> <?php if ($cff_active_tab == 'configuration') { //Start Extensions tab ?> <form name="form1" method="post" action=""> <input type="hidden" name="<?php echo $hidden_field_name; ?> " value="Y"> <br /> <h3><?php _e('Configuration'); ?> </h3> <table class="form-table"> <tbody> <tr valign="top"> <th scope="row"> <?php if ($cff_ext_multifeed_active) { ?> <?php _e('Facebook Page IDs'); ?> <br /><i style="color: #666; font-size: 11px;"><?php _e('Separate multiple IDs with commas</i>'); ?> </th> <?php } else { ?> <?php _e('Facebook Page ID<br /><i style="font-weight: normal; font-size: 12px;">ID of your Facebook Page or Group</i>'); ?> </th> <?php } ?> <td> <?php if ($cff_ext_multifeed_active) { ?> <textarea name="cff_page_id" id="cff_page_id" style="width: 390px;" rows="3" /><?php esc_attr_e($page_id_val); ?> </textarea> <?php } else { ?> <input name="cff_page_id" id="cff_page_id" type="text" value="<?php esc_attr_e($page_id_val); ?> " size="45" /> <?php } ?> <a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e("What's my Page ID?"); ?> </a> <br /><i style="color: #666; font-size: 11px;"><?php _e("Eg. 1234567890123"); ?> </i> <div class="cff-tooltip cff-more-info"> <ul> <li><?php _e('If you have a Facebook <b>page</b> with a URL like this: <code>https://www.facebook.com/your_page_name</code> then the Page ID is just <b>your_page_name</b>. If your page URL is structured like this: <code>https://www.facebook.com/pages/your_page_name/123654123654123</code> then the Page ID is actually the number at the end, so in this case <b>123654123654123</b>.</li>'); ?> <li><?php _e('If you have a Facebook <b>group</b> then use <a href="http://lookup-id.com/" target="_blank" title="Find my ID">this tool</a> to find your ID.'); ?> </li> <li><?php _e('You can copy and paste your ID into the <a href="http://smashballoon.com/custom-facebook-feed/demo/" target="_blank">demo</a> to test it.'); ?> </li> </ul> </div> </td> </tr> <?php if ($cff_featured_post_active) { echo cff_featured_post_options($cff_featured_post_id_val); } ?> <tr valign="top"> <th scope="row" style="padding-bottom: 10px;"><?php _e('Enter my own Access Token <i style="font-weight: normal; font-size: 12px;">This is Optional</i>'); ?> </th> <td> <input name="cff_show_access_token" type="checkbox" id="cff_show_access_token" <?php if ($show_access_token_val == true) { echo "checked"; } ?> /> <a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e("What is this?"); ?> </a> <p class="cff-tooltip cff-more-info"><?php _e("A Facebook Access Token is not required to use this plugin, but if you have your own that you'd like to use then you can check this box and enter it here. To get your own Access Token you can follow these <a href='https://smashballoon.com/custom-facebook-feed/access-token/' target='_blank'>step-by-step instructions</a>"); ?> .</p> </td> </tr> <tr valign="top" class="cff-access-token-hidden"> <th scope="row" style="padding-bottom: 10px;"><?php _e('Facebook Access Token'); ?> </th> <td> <input name="cff_access_token" id="cff_access_token" type="text" value="<?php esc_attr_e($access_token_val); ?> " size="45" /> <div class="cff-notice cff-profile-error cff-access-token"> <?php _e("<p>This doesn't appear to be an Access Token. Please be sure that you didn't enter your App Secret instead of your Access Token.<br />Your App ID and App Secret are used to obtain your Access Token; simply paste them into the fields in the last step of the <a href='https://smashballoon.com/custom-facebook-feed/access-token/' target='_blank'>Access Token instructions</a> and click '<b>Get my Access Token</b>'.</p>"); ?> </div> </td> </tr> </tbody> </table> <hr /> <table class="form-table"> <tbody> <h3><?php _e('Settings'); ?> </h3> <tr valign="top" class="cff-page-type"> <th scope="row"><?php _e('Is this a page, group or profile?'); ?> </th> <td> <select name="cff_page_type"> <option value="page" <?php if ($cff_page_type_val == "page") { echo 'selected="selected"'; } ?> ><?php _e('Page'); ?> </option> <option value="group" <?php if ($cff_page_type_val == "group") { echo 'selected="selected"'; } ?> ><?php _e('Group'); ?> </option> <option value="profile" <?php if ($cff_page_type_val == "profile") { echo 'selected="selected"'; } ?> ><?php _e('Profile'); ?> </option> </select> <div class="cff-notice cff-profile-error cff-page-type"> <?php _e("<p>Due to Facebook's privacy policy you're not able to display posts from a personal profile, only from a public page or group.</p><p>If you're using a profile to represent a business, organization, product, public figure or the like, then Facebook recommends <a href='http://www.facebook.com/help/175644189234902/' target='_blank'>converting your profile to a page</a>. There are many advantages to using pages over profiles, and once you've converted then the plugin will be able to successfully retrieve and display all of your posts.</p>"); ?> </div> </td> </tr> <tr valign="top" class="cff-page-options"> <th scope="row"><?php _e('Show posts on my page by:'); ?> </th> <td> <select name="cff_show_others" id="cff_show_others" style="width: 250px;"> <option value="me" <?php if ($cff_show_others_val == 'me') { echo 'selected="selected"'; } ?> ><?php _e('Only the page owner (me)'); ?> </option> <option value="others" <?php if ($cff_show_others_val == 'others') { echo 'selected="selected"'; } ?> ><?php _e('Page owner + other people'); ?> </option> <option value="onlyothers" <?php if ($cff_show_others_val == 'onlyothers') { echo 'selected="selected"'; } ?> ><?php _e('Only other people'); ?> </option> </select> <p id="cff-others-only" style="font-size: 12px;"><b>Note:</b> Only displaying posts by other people works by retrieving your posts from Facebook and then filtering out the posts by the page owner. If this option doesn't display many posts then you can retrieve more by setting the post limit option (below) to a higher number.</p> </td> </tr> <?php if ($cff_ext_date_active) { echo cff_ext_date_options($cff_date_from_val, $cff_date_until_val); } ?> <tr valign="top"> <th scope="row"><?php _e('Number of posts to display'); ?> </th> <td> <input name="cff_num_show" type="text" value="<?php esc_attr_e($num_show_val); ?> " size="4" /> <i style="color: #666; font-size: 11px;">Eg. 5</i> <a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e("Why aren't this many posts showing up?"); ?> </a> <p class="cff-tooltip cff-more-info"><?php _e("If too many posts are being filtered out then you may need to set the 'Change the post limit' option below to be 10-15 higher than the amount of posts you want to display."); ?> </p> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Change the post limit'); ?> </th> <td> <input name="cff_post_limit" type="text" value="<?php esc_attr_e($cff_post_limit_val); ?> " size="4" /> <i style="color: #666; font-size: 11px;">Eg. 30</i> <a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e('What does this mean?'); ?> </a> <p class="cff-tooltip cff-more-info"><?php _e("The 'limit' is the number of posts retrieved from the Facebook API. By default the plugin retrieves 7 posts more from the Facebook API than you specify in the 'Number of posts to display' field above, as some posts are filtered out. You can alter how many posts are retrieved by manually setting this value. If you choose to retrieve a high number of posts then it will take longer for Facebook to return the posts when the plugin checks for new ones."); ?> </p> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Check for new Facebook posts every'); ?> </th> <td> <input name="cff_cache_time" type="text" value="<?php esc_attr_e($cff_cache_time_val); ?> " size="4" /> <select name="cff_cache_time_unit"> <option value="minutes" <?php if ($cff_cache_time_unit_val == "minutes") { echo 'selected="selected"'; } ?> ><?php _e('Minutes'); ?> </option> <option value="hours" <?php if ($cff_cache_time_unit_val == "hours") { echo 'selected="selected"'; } ?> ><?php _e('Hours'); ?> </option> <option value="days" <?php if ($cff_cache_time_unit_val == "days") { echo 'selected="selected"'; } ?> ><?php _e('Days'); ?> </option> </select> <a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e('What does this mean?'); ?> </a> <p class="cff-tooltip cff-more-info"><?php _e('Your Facebook posts and comments data is temporarily cached by the plugin in your WordPress database. You can choose how long this data should be cached for. If you set the time to 60 minutes then the plugin will clear the cached data after that length of time, and the next time the page is viewed it will check for new data.'); ?> </p> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Localization'); ?> </th> <td> <select name="cff_locale"> <option value="af_ZA" <?php if ($cff_locale_val == "af_ZA") { echo 'selected="selected"'; } ?> ><?php _e('Afrikaans'); ?> </option> <option value="ar_AR" <?php if ($cff_locale_val == "ar_AR") { echo 'selected="selected"'; } ?> ><?php _e('Arabic'); ?> </option> <option value="az_AZ" <?php if ($cff_locale_val == "az_AZ") { echo 'selected="selected"'; } ?> ><?php _e('Azerbaijani'); ?> </option> <option value="be_BY" <?php if ($cff_locale_val == "be_BY") { echo 'selected="selected"'; } ?> ><?php _e('Belarusian'); ?> </option> <option value="bg_BG" <?php if ($cff_locale_val == "bg_BG") { echo 'selected="selected"'; } ?> ><?php _e('Bulgarian'); ?> </option> <option value="bn_IN" <?php if ($cff_locale_val == "bn_IN") { echo 'selected="selected"'; } ?> ><?php _e('Bengali'); ?> </option> <option value="bs_BA" <?php if ($cff_locale_val == "bs_BA") { echo 'selected="selected"'; } ?> ><?php _e('Bosnian'); ?> </option> <option value="ca_ES" <?php if ($cff_locale_val == "ca_ES") { echo 'selected="selected"'; } ?> ><?php _e('Catalan'); ?> </option> <option value="cs_CZ" <?php if ($cff_locale_val == "cs_CZ") { echo 'selected="selected"'; } ?> ><?php _e('Czech'); ?> </option> <option value="cy_GB" <?php if ($cff_locale_val == "cy_GB") { echo 'selected="selected"'; } ?> ><?php _e('Welsh'); ?> </option> <option value="da_DK" <?php if ($cff_locale_val == "da_DK") { echo 'selected="selected"'; } ?> ><?php _e('Danish'); ?> </option> <option value="de_DE" <?php if ($cff_locale_val == "de_DE") { echo 'selected="selected"'; } ?> ><?php _e('German'); ?> </option> <option value="el_GR" <?php if ($cff_locale_val == "el_GR") { echo 'selected="selected"'; } ?> ><?php _e('Greek'); ?> </option> <option value="en_GB" <?php if ($cff_locale_val == "en_GB") { echo 'selected="selected"'; } ?> ><?php _e('English (UK)'); ?> </option> <option value="en_PI" <?php if ($cff_locale_val == "en_PI") { echo 'selected="selected"'; } ?> ><?php _e('English (Pirate)'); ?> </option> <option value="en_UD" <?php if ($cff_locale_val == "en_UD") { echo 'selected="selected"'; } ?> ><?php _e('English (Upside Down)'); ?> </option> <option value="en_US" <?php if ($cff_locale_val == "en_US") { echo 'selected="selected"'; } ?> ><?php _e('English (US)'); ?> </option> <option value="eo_EO" <?php if ($cff_locale_val == "eo_EO") { echo 'selected="selected"'; } ?> ><?php _e('Esperanto'); ?> </option> <option value="es_ES" <?php if ($cff_locale_val == "es_ES") { echo 'selected="selected"'; } ?> ><?php _e('Spanish (Spain)'); ?> </option> <option value="es_LA" <?php if ($cff_locale_val == "es_LA") { echo 'selected="selected"'; } ?> ><?php _e('Spanish'); ?> </option> <option value="et_EE" <?php if ($cff_locale_val == "et_EE") { echo 'selected="selected"'; } ?> ><?php _e('Estonian'); ?> </option> <option value="eu_ES" <?php if ($cff_locale_val == "eu_ES") { echo 'selected="selected"'; } ?> ><?php _e('Basque'); ?> </option> <option value="fa_IR" <?php if ($cff_locale_val == "fa_IR") { echo 'selected="selected"'; } ?> ><?php _e('Persian'); ?> </option> <option value="fb_LT" <?php if ($cff_locale_val == "fb_LT") { echo 'selected="selected"'; } ?> ><?php _e('Leet Speak'); ?> </option> <option value="fi_FI" <?php if ($cff_locale_val == "fi_FI") { echo 'selected="selected"'; } ?> ><?php _e('Finnish'); ?> </option> <option value="fo_FO" <?php if ($cff_locale_val == "fo_FO") { echo 'selected="selected"'; } ?> ><?php _e('Faroese'); ?> </option> <option value="fr_CA" <?php if ($cff_locale_val == "fr_CA") { echo 'selected="selected"'; } ?> ><?php _e('French (Canada)'); ?> </option> <option value="fr_FR" <?php if ($cff_locale_val == "fr_FR") { echo 'selected="selected"'; } ?> ><?php _e('French (France)'); ?> </option> <option value="fy_NL" <?php if ($cff_locale_val == "fy_NL") { echo 'selected="selected"'; } ?> ><?php _e('Frisian'); ?> </option> <option value="ga_IE" <?php if ($cff_locale_val == "ga_IE") { echo 'selected="selected"'; } ?> ><?php _e('Irish'); ?> </option> <option value="gl_ES" <?php if ($cff_locale_val == "gl_ES") { echo 'selected="selected"'; } ?> ><?php _e('Galician'); ?> </option> <option value="he_IL" <?php if ($cff_locale_val == "he_IL") { echo 'selected="selected"'; } ?> ><?php _e('Hebrew'); ?> </option> <option value="hi_IN" <?php if ($cff_locale_val == "hi_IN") { echo 'selected="selected"'; } ?> ><?php _e('Hindi'); ?> </option> <option value="hr_HR" <?php if ($cff_locale_val == "hr_HR") { echo 'selected="selected"'; } ?> ><?php _e('Croatian'); ?> </option> <option value="hu_HU" <?php if ($cff_locale_val == "hu_HU") { echo 'selected="selected"'; } ?> ><?php _e('Hungarian'); ?> </option> <option value="hy_AM" <?php if ($cff_locale_val == "hy_AM") { echo 'selected="selected"'; } ?> ><?php _e('Armenian'); ?> </option> <option value="id_ID" <?php if ($cff_locale_val == "id_ID") { echo 'selected="selected"'; } ?> ><?php _e('Indonesian'); ?> </option> <option value="is_IS" <?php if ($cff_locale_val == "is_IS") { echo 'selected="selected"'; } ?> ><?php _e('Icelandic'); ?> </option> <option value="it_IT" <?php if ($cff_locale_val == "it_IT") { echo 'selected="selected"'; } ?> ><?php _e('Italian'); ?> </option> <option value="ja_JP" <?php if ($cff_locale_val == "ja_JP") { echo 'selected="selected"'; } ?> ><?php _e('Japanese'); ?> </option> <option value="ka_GE" <?php if ($cff_locale_val == "ka_GE") { echo 'selected="selected"'; } ?> ><?php _e('Georgian'); ?> </option> <option value="km_KH" <?php if ($cff_locale_val == "km_KH") { echo 'selected="selected"'; } ?> ><?php _e('Khmer'); ?> </option> <option value="ko_KR" <?php if ($cff_locale_val == "ko_KR") { echo 'selected="selected"'; } ?> ><?php _e('Korean'); ?> </option> <option value="ku_TR" <?php if ($cff_locale_val == "ku_TR") { echo 'selected="selected"'; } ?> ><?php _e('Kurdish'); ?> </option> <option value="la_VA" <?php if ($cff_locale_val == "la_VA") { echo 'selected="selected"'; } ?> ><?php _e('Latin'); ?> </option> <option value="lt_LT" <?php if ($cff_locale_val == "lt_LT") { echo 'selected="selected"'; } ?> ><?php _e('Lithuanian'); ?> </option> <option value="lv_LV" <?php if ($cff_locale_val == "lv_LV") { echo 'selected="selected"'; } ?> ><?php _e('Latvian'); ?> </option> <option value="mk_MK" <?php if ($cff_locale_val == "mk_MK") { echo 'selected="selected"'; } ?> ><?php _e('Macedonian'); ?> </option> <option value="ml_IN" <?php if ($cff_locale_val == "ml_IN") { echo 'selected="selected"'; } ?> ><?php _e('Malayalam'); ?> </option> <option value="ms_MY" <?php if ($cff_locale_val == "ms_MY") { echo 'selected="selected"'; } ?> ><?php _e('Malay'); ?> </option> <option value="nb_NO" <?php if ($cff_locale_val == "nb_NO") { echo 'selected="selected"'; } ?> ><?php _e('Norwegian (bokmal)'); ?> </option> <option value="ne_NP" <?php if ($cff_locale_val == "ne_NP") { echo 'selected="selected"'; } ?> ><?php _e('Nepali'); ?> </option> <option value="nl_NL" <?php if ($cff_locale_val == "nl_NL") { echo 'selected="selected"'; } ?> ><?php _e('Dutch'); ?> </option> <option value="nn_NO" <?php if ($cff_locale_val == "nn_NO") { echo 'selected="selected"'; } ?> ><?php _e('Norwegian (nynorsk)'); ?> </option> <option value="pa_IN" <?php if ($cff_locale_val == "pa_IN") { echo 'selected="selected"'; } ?> ><?php _e('Punjabi'); ?> </option> <option value="pl_PL" <?php if ($cff_locale_val == "pl_PL") { echo 'selected="selected"'; } ?> ><?php _e('Polish'); ?> </option> <option value="ps_AF" <?php if ($cff_locale_val == "ps_AF") { echo 'selected="selected"'; } ?> ><?php _e('Pashto'); ?> </option> <option value="pt_BR" <?php if ($cff_locale_val == "pt_BR") { echo 'selected="selected"'; } ?> ><?php _e('Portuguese (Brazil)'); ?> </option> <option value="pt_PT" <?php if ($cff_locale_val == "pt_PT") { echo 'selected="selected"'; } ?> ><?php _e('Portuguese (Portugal)'); ?> </option> <option value="ro_RO" <?php if ($cff_locale_val == "ro_RO") { echo 'selected="selected"'; } ?> ><?php _e('Romanian'); ?> </option> <option value="ru_RU" <?php if ($cff_locale_val == "ru_RU") { echo 'selected="selected"'; } ?> ><?php _e('Russian'); ?> </option> <option value="sk_SK" <?php if ($cff_locale_val == "sk_SK") { echo 'selected="selected"'; } ?> ><?php _e('Slovak'); ?> </option> <option value="sl_SI" <?php if ($cff_locale_val == "sl_SI") { echo 'selected="selected"'; } ?> ><?php _e('Slovenian'); ?> </option> <option value="sq_AL" <?php if ($cff_locale_val == "sq_AL") { echo 'selected="selected"'; } ?> ><?php _e('Albanian'); ?> </option> <option value="sr_RS" <?php if ($cff_locale_val == "sr_RS") { echo 'selected="selected"'; } ?> ><?php _e('Serbian'); ?> </option> <option value="sv_SE" <?php if ($cff_locale_val == "sv_SE") { echo 'selected="selected"'; } ?> ><?php _e('Swedish'); ?> </option> <option value="sw_KE" <?php if ($cff_locale_val == "sw_KE") { echo 'selected="selected"'; } ?> ><?php _e('Swahili'); ?> </option> <option value="ta_IN" <?php if ($cff_locale_val == "ta_IN") { echo 'selected="selected"'; } ?> ><?php _e('Tamil'); ?> </option> <option value="te_IN" <?php if ($cff_locale_val == "te_IN") { echo 'selected="selected"'; } ?> ><?php _e('Telugu'); ?> </option> <option value="th_TH" <?php if ($cff_locale_val == "th_TH") { echo 'selected="selected"'; } ?> ><?php _e('Thai'); ?> </option> <option value="tl_PH" <?php if ($cff_locale_val == "tl_PH") { echo 'selected="selected"'; } ?> ><?php _e('Filipino'); ?> </option> <option value="tr_TR" <?php if ($cff_locale_val == "tr_TR") { echo 'selected="selected"'; } ?> ><?php _e('Turkish'); ?> </option> <option value="uk_UA" <?php if ($cff_locale_val == "uk_UA") { echo 'selected="selected"'; } ?> ><?php _e('Ukrainian'); ?> </option> <option value="vi_VN" <?php if ($cff_locale_val == "vi_VN") { echo 'selected="selected"'; } ?> ><?php _e('Vietnamese'); ?> </option> <option value="zh_CN" <?php if ($cff_locale_val == "zh_CN") { echo 'selected="selected"'; } ?> ><?php _e('Simplified Chinese (China)'); ?> </option> <option value="zh_HK" <?php if ($cff_locale_val == "zh_HK") { echo 'selected="selected"'; } ?> ><?php _e('Traditional Chinese (Hong Kong)'); ?> </option> <option value="zh_TW" <?php if ($cff_locale_val == "zh_TW") { echo 'selected="selected"'; } ?> ><?php _e('Traditional Chinese (Taiwan)'); ?> </option> </select> <i style="color: #666; font-size: 11px;"><?php _e('Select a language'); ?> </i> </td> </tr> <?php if ($cff_lightbox_active) { echo cff_lightbox_options($cff_lightbox_val); } ?> </tbody> </table> <?php submit_button(); ?> </form> <hr /> <h3><?php _e('Displaying your Feed'); ?> </h3> <p><?php _e("Copy and paste this shortcode directly into the page, post or widget where you'd like the feed to show up:"); ?> </p> <input type="text" value="[custom-facebook-feed]" size="22" readonly="readonly" onclick="this.focus();this.select()" title="<?php _e('To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac).'); ?> " /> <hr /> <h3><?php _e('Customizing your Feed'); ?> </h3> <p><?php _e("Use the <a href='admin.php?page=cff-style'>Customize</a> page to customize your feed. If you're displaying multiple feeds then you can override your settings directly in the shortcode like so:"); ?> </p> <p>[custom-facebook-feed num=3 layout=thumb height=500px]</p> <p><a href="http://smashballoon.com/custom-facebook-feed/docs/shortcodes/" target="_blank"><?php _e('See a full list of shortcode options'); ?> </a></p> <?php } //End config tab ?> <?php if ($cff_active_tab == 'license') { //Start License tab ?> <?php $cff_license = trim(get_option('cff_license_key')); $cff_status = get_option('cff_license_status'); ?> <form method="post" action="options.php"> <?php settings_fields('cff_license'); ?> <?php // data to send in our API request $cff_api_params = array('edd_action' => 'check_license', 'license' => $cff_license, 'item_name' => urlencode(WPW_SL_ITEM_NAME)); // Call the custom API. $cff_response = wp_remote_get(add_query_arg($cff_api_params, WPW_SL_STORE_URL), array('timeout' => 60, 'sslverify' => false)); // decode the license data $cff_license_data = (array) json_decode(wp_remote_retrieve_body($cff_response)); //Store license data in db unless the data comes back empty as wasn't able to connect to our website to get it if (!empty($cff_license_data)) { update_option('cff_license_data', $cff_license_data); } ?> <br /> <table class="form-table"> <tbody> <tr valign="top"> <th scope="row" valign="top"><?php _e('Custom Facebook Feed Pro'); ?> </th> <td> <input id="cff_license_key" name="cff_license_key" type="text" class="regular-text" value="<?php esc_attr_e($cff_license); ?> " /> <?php if (false !== $cff_license) { ?> <?php if ($cff_status !== false && $cff_status == 'valid') { ?> <?php wp_nonce_field('cff_nonce', 'cff_nonce'); ?> <input type="submit" class="button-secondary" name="cff_license_deactivate" value="<?php _e('Deactivate License'); ?> "/> <?php if ($cff_license_data['license'] == 'expired') { ?> <span style="color:red;"><?php _e('Expired'); ?> </span> <?php } else { ?> <span style="color:green;"><?php _e('Active'); ?> </span> <?php } ?> <?php } else { wp_nonce_field('cff_nonce', 'cff_nonce'); ?> <input type="submit" class="button-secondary" name="cff_license_activate" value="<?php _e('Activate License'); ?> "/> <?php if ($cff_license_data['license'] == 'expired') { ?> <span style="color:red;"><?php _e('Expired'); ?> </span> <?php } else { ?> <span style="color:red;"><?php _e('Inactive'); ?> </span> <?php } ?> <?php } ?> <?php } ?> <br /> <i style="color: #666; font-size: 11px;"><?php _e('The license key you received when purchasing the plugin.'); ?> </i> <?php global $cff_download_id; ?> <p style="font-size: 13px;"><a href='https://smashballoon.com/checkout/?edd_license_key=<?php echo trim($cff_license); ?> &download_id=<?php echo $cff_download_id; ?> ' target='_blank'><?php _e("Renew your license"); ?> </a> ·<a class="cff-tooltip-link" href="JavaScript:void(0);"><?php _e("Upgrade your license"); ?> </a> </p> <div class="cff-tooltip cff-more-info"> <?php _e("<p>You can upgrade your license in two ways:</p>\r\n <p>• Log into <a href='https://smashballoon.com/account' target='_blank'>your Account</a> and click on the 'Upgrade my License' tab<br />\r\n • <a href='https://smashballoon.com/contact/' target='_blank'>Contact us directly</a></p>"); ?> </div> </td> </tr> <?php do_action('cff_admin_license'); ?> </tbody> </table> <?php submit_button(); ?> </form> <?php } ?> <?php if ($cff_active_tab == 'support') { //Start Support tab ?> <br /> <h3><?php _e('FAQs and Troubleshooting'); ?> </h3> <p>Having trouble getting the plugin to work? Try the links below:</p> <ul> <li>- <?php _e('<a href="http://smashballoon.com/custom-facebook-feed/faq/general/" target="_blank">General Questions</a>'); ?> </li> <li>- <?php _e('<a href="http://smashballoon.com/custom-facebook-feed/faq/setup/" target="_blank">Setting Up & Displaying your Feed</a>'); ?> </li> <li>- <?php _e('<a href="http://smashballoon.com/custom-facebook-feed/faq/troubleshooting/" target="_blank">Troubleshooting & Common Support Questions</a>'); ?> </li> </ul> <br /> <h3>Documentation</h3> <p>Need help setting up, configuring or customizing the plugin? Check out the links below:</p> <ul> <li>- <?php _e('<a href="http://smashballoon.com/custom-facebook-feed/docs/wordpress/" target="_blank">Installation and Configuration</a>'); ?> </li> <li>- <?php _e('<a href="http://smashballoon.com/custom-facebook-feed/docs/shortcodes/" target="_blank">Shortcode Reference</a>'); ?> </li> <li>- <?php _e('<a href="http://smashballoon.com/custom-facebook-feed/docs/snippets/" target="_blank">Custom CSS and JavaScript Snippets</a>'); ?> </li> </ul> <br /> <p><?php _e('Still need help? <a href="http://smashballoon.com/custom-facebook-feed/support/" target="_blank">Request support</a>.'); ?> </p> <br /> <h3><?php _e('System Info'); ?> </h3> <p>PHP Version: <b><?php echo PHP_VERSION . "\n"; ?> </b></p> <p>Web Server Info: <b><?php echo $_SERVER['SERVER_SOFTWARE'] . "\n"; ?> </b></p> <p>PHP allow_url_fopen: <b><?php echo ini_get('allow_url_fopen') ? "<span style='color: green;'>Yes</span>" : "<span style='color: red;'>No</span>"; ?> </b></p> <p>PHP cURL: <b><?php echo is_callable('curl_init') ? "<span style='color: green;'>Yes</span>" : "<span style='color: red;'>No</span>"; ?> </b></p> <p>JSON: <b><?php echo function_exists("json_decode") ? "<span style='color: green;'>Yes</span>" : "<span style='color: red;'>No</span>"; ?> </b></p> <button class="button secondary-button" id="cff-api-test">Test connection to Facebook API</button> <div id="cff-api-test-result"> <?php $access_token = get_option($access_token); if ($access_token == '' || empty($access_token)) { $access_token = '611606915581035|RdRHbHtrHseQw4C7SDUBFWIrJLA'; } ?> <?php $posts_json = cff_fetchUrl("https://graph.facebook.com/" . get_option(trim($page_id)) . "/feed?access_token=" . trim($access_token) . "&limit=1"); ?> <textarea readonly="readonly" onclick="this.focus();this.select()" title="To copy, click the field then press Ctrl + C (PC) or Cmd + C (Mac)."><?php echo $posts_json; ?> </textarea> </div> <?php } ?> <?php }