/** * This view is sent when $wgFbDisableLogin is true. In this case, the user * must be logged in to Facebook to view the wiki, so we present a single * login button. */ private function exclusiveLoginToFacebookView() { global $wgOut, $wgSitename, $wgUser; $loginFormWidth = 400; // pixels $this->outputHeader(); $html = ' <div id="userloginForm"> <form style="width: ' . $loginFormWidth . 'px;"> <h2>' . wfMsg('userlogin') . '</h2> <p>' . wfMsg('facebook-only-text', $wgSitename) . '<br/><br/></p>' . "\n"; // Compatiblity with MW < 1.18 global $wgVersion; if (version_compare($wgVersion, '1.18', '>=')) { $skin = $this->getSkin(); } else { global $wgUser; $skin = $wgUser->getSkin(); } $html .= '<fb:login-button show-faces="true" width="' . $loginFormWidth . '" max-rows="3" scope="' . FacebookAPI::getPermissions() . '" colorscheme="' . FacebookXFBML::getColorScheme($skin->getSkinName()) . '"></fb:login-button><br/><br/><br/>' . "\n"; // Add a pretty Like box to entice the user to log in $html .= '<fb:like href="' . Title::newMainPage()->getFullURL() . '" send="false" width="' . $loginFormWidth . '" show_faces="true"></fb:like>'; $html .= ' </form> </div>'; $wgOut->addHTML($html); }
/** * 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; }
public static function getColorScheme($skinName) { if (self::$darkSkins === NULL) { self::$darkSkins = array(); $skins = array(); wfRunHooks('XFBMLSkinColorScheme', array(&$skins)); foreach ($skins as $skin => $value) { if ($value == 'dark') { self::$darkSkins[] = $skin; } } } return in_array($skinName, self::$darkSkins) ? 'dark' : 'light'; }