static function renderFacebookComments($skin, &$text) { global $mediaWiki, $wgOut, $wgArticlePath, $wgScriptPath; global $wgFacebookCommonScriptWritten, $wgFacebookAppId; global $wgFacebookCommentsNumPosts, $wgFacebookCommentsWidth, $wgFacebookCommentsColorscheme; $title = $skin->getTitle(); if (isset($_REQUEST['redirect'])) { return true; } if ($mediaWiki->getAction() != 'view') { return true; } if (!$title->exists()) { return true; } if ($title->getNamespace() != 0) { return true; } $fbcomments = ''; if (!isset($wgFacebookAppId)) { $wgFacebookAppId = ''; } if (!isset($wgFacebookCommonScriptWritten) || !$wgFacebookCommonScriptWritten) { $wgFacebookCommonScriptWritten = true; $fbcomments .= '<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1&appId=' . $wgFacebookAppId . '"></script>'; } if (isset($wgArticlePath)) { $href = str_replace('$1', '', FacebookComments::getURL() . $wgArticlePath) . $title; } else { $href = FacebookComments::getURL() . $wgScriptPath . '/index.php/' . $title; } $fbcomments .= '<br><div class="fb-comments" data-href="' . $href . '"'; $fbcomments .= ' data-num-posts="' . $wgFacebookCommentsNumPosts . '"'; $fbcomments .= ' data-width="' . $wgFacebookCommentsWidth . '"'; $fbcomments .= ' data-colorscheme="' . $wgFacebookCommentsColorscheme . '"'; $fbcomments .= '></div>'; $wgOut->addHTML($fbcomments); return true; }
/** * Method render * @access public * @param boolean $ajax_render [default value: false] * @return string html code of object FacebookComments * @since 1.0.86 */ public function render($ajax_render = false) { FacebookComments::getFacebookJsInclude(); $html = "<div class=\"fb-comments\" data-href=\"" . $this->url_to_comment . "\" data-numposts=\"" . $this->number_post . "\" data-width=\"" . $this->width . "\" data-colorscheme=\"" . $this->style . "\" style=\"border:none; overflow:hidden;background-color:" . ($this->style == "dark" ? "black" : "white") . "; width:" . $this->width . "px;\"></div>"; return $html; }