} } if ($done_one) { $attached_filename .= WP_CONTENT_URL."/wps-content/members/".$subject_uid."/activity/".$filename; } } // Send to Facebook? if ($facebook == 1 && function_exists('__wps__facebook')) { if (!class_exists('__wps__FacebookApiException')) include_once("../library/src/facebook.php"); $__wps__facebook = new __wps__Facebook(array( 'appId'=>get_option(WPS_OPTIONS_PREFIX.'_facebook_api'), 'secret'=>get_option(WPS_OPTIONS_PREFIX.'_facebook_secret'), 'cookie'=>true )); // Get User ID $user = $__wps__facebook->getUser(); if ($user) { try { $iframe = __wps__extract_unit($text, '<iframe width=\"100%\" height=\"250\" src=\"http://www.youtube.com/embed/', '?wmode=transparent\" frameborder=\"0\" allowfullscreen></iframe>'); if ($iframe) { $iframe = 'http://www.youtube.com/watch?v='.$iframe; $ftext = strip_tags($text); } else { $ftext = $text;
function __wps__get_facebook() { $profile_url = __wps__get_url('profile'); $q = __wps__string_query($profile_url); $fhtml = "<div id='facebook_div'>"; if (!class_exists('__wps__FacebookApiException')) include_once("library/src/facebook.php"); $__wps__facebook = new __wps__Facebook(array( 'appId'=>get_option(WPS_OPTIONS_PREFIX.'_facebook_api'), 'secret'=>get_option(WPS_OPTIONS_PREFIX.'_facebook_secret'), 'cookie'=>true )); if (isset($_GET['fb']) && $_GET['fb'] == 'lo') { setcookie('fbs_'.$__wps__facebook->getAppId(), '', time()-100, '/', 'domain.com'); session_destroy(); header('Location: '.$profile_url); } // Get User ID $user = $__wps__facebook->getUser(); if ($user) { try { // Proceed knowing you have a logged in user who's authenticated. $user_profile = $__wps__facebook->api('/me'); $fhtml .= "<input type='checkbox' CHECKED id='post_to_facebook' /> "; $fhtml .= sprintf(__("Share post on Facebook as <a target='_blank' href='%s'>%s</a>", WPS_TEXT_DOMAIN), $user_profile['link'], $user_profile['name']); $fhtml .= ' (<a href="'.$profile_url.$q.'fb=lo">'.__('Disconnect', WPS_TEXT_DOMAIN).'</a>)'; } catch (__wps__FacebookApiException $e) { $result = $e->getResult(); echo "<pre>User authenticated"; print_r($result); echo "</pre>"; $user = null; } } else { $fhtml .= "<img src='".WPS_PLUGIN_URL."/images/logo_facebook.png' style='float:left; margin-right: 5px;' />"; $params = array( 'canvas' => 1, 'scope' => 'publish_actions,user_about_me', 'fbconnect' => 1 ); $fhtml .= '<a href="'.$__wps__facebook->getLoginUrl($params).'">'.__('Connect to Facebook', WPS_TEXT_DOMAIN).'</a>'; } $fhtml .= "</div>"; return $fhtml; }