/** * Returns the actions that are registered for the object by * $wgFbOpenGraphCustomActions. */ public function getCustomActions() { $actions = array(); $customObjects = FacebookOpenGraph::getActionObjects(); if (!empty($customObjects)) { // Start with actions matching the specified object $type = $this->getType(); if (isset($customObjects[$type])) { $actions = $customObjects[$type]; } // Merge in actions matching all objects ('*') if (isset($customObjects['*'])) { $actions = array_merge($customObjects['*'], $actions); } } return $actions; }
/** * Installs a parser hook for every tag reported by FacebookXFBML::availableTags(). * Accomplishes this by asking FacebookXFBML to create a hook function that then * redirects to FacebookXFBML::parserHook(). * * Secondly, this function installs a parser hook for our <opengraph> tag. */ public static function ParserFirstCallInit(&$parser) { // XFBML tags (for example, <fb:login-button>) $pHooks = FacebookXFBML::availableTags(); foreach ($pHooks as $tag) { $parser->setHook($tag, FacebookXFBML::createParserHook($tag)); } // Open Graph tag (for example, <opengraph type="article">) $tag = FacebookOpenGraph::GetTag(); if ($tag != '') { $parser->setHook($tag, 'FacebookOpenGraph::parserHook'); } return true; }
/** * Remove the watch action from the user's Timeline when they unwatch an * article. */ public static function UnwatchArticleComplete(&$user, &$article) { global $facebook; if (self::getAction('watch')) { $fbUser = new FacebookUser(); if ($fbUser->getMWUser()->getId() == $user->getId()) { $object = FacebookOpenGraph::newObjectFromTitle($article->getTitle()); try { self::removeAction('watch', $object); } catch (FacebookApiException $e) { // echo $e->getType() . ": " . $e->getMessage() . "<br/>\n"; } } } return true; }