=')) {
return;
}
}
deactivate_plugins(basename(__FILE__)); // Deactivate ourself
wp_die("The base SFC plugin must be activated before this plugin will run.");
}
register_activation_hook(__FILE__, 'sfc_upcoming_widget_activation_check');
// produce a list of upcoming events for a given facebook user
function sfc_upcoming_events($uid) {
if (!$uid) return;
$options = get_option('sfc_options');
// load facebook platform
include_once 'facebook-platform/facebook.php';
$fb=new Facebook($options['api_key'], $options['app_secret']);
try {
$events = $fb->api_client->events_get($uid, null, time());
} catch (Exception $e) { }
if (!$events) return;
$events_sorted = sfc_upcoming_sort($events, 'start_time');
foreach ($events_sorted as $event) {
do_action('sfc_upcoming_event',$event);
}
}
function sfc_upcoming_event_output($event) {
echo date_i18n('F jS', $event["start_time"]);
?>
-
'widget_sfc-upcoming', 'description' => 'Facebook Upcoming Events');
$this->WP_Widget('sfc-upcoming', 'Facebook Upcoming Events (SFC)', $widget_ops);
}
function widget($args, $instance) {
extract( $args );
$title = apply_filters('widget_title', $instance['title']);
$appid = $options['appid'];
$id = $instance['id'];
?>
'') );
$instance['title'] = strip_tags($new_instance['title']);
$instance['id'] = strip_tags($new_instance['id']);
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '') );
$title = strip_tags($instance['title']);
$id = strip_tags($instance['id']);
?>
(The User ID can also be a Group ID, a Fan Page ID, or an Application ID.)