public static function onOutputPageParserOutput(OutputPage &$out, ParserOutput $parseroutput)
 {
     global $wgEnableMWSuggest;
     $skin = $out->getSkin()->getSkinName();
     if ($skin == 'monobook' || $skin == 'uncyclopedia') {
         $wgEnableMWSuggest = true;
     }
     return true;
 }
 /**
  * Add JS and CSS to File Page (except mobile skin - see onWikiaMobileAssetsPackages)
  *
  * @param OutputPage $out
  * @param $skin
  * @return bool
  */
 public static function onBeforePageDisplay(OutputPage $out, $skin)
 {
     global $wgEnableVideoPageRedesign;
     $app = F::app();
     wfProfileIn(__METHOD__);
     if ($app->wg->Title->getNamespace() == NS_FILE) {
         $assetsManager = AssetsManager::getInstance();
         $wikiaFilePageJs = 'wikia_file_page_js';
         foreach ($assetsManager->getURL($wikiaFilePageJs) as $url) {
             $out->addScript("<script src=\"{$url}\"></script>");
         }
         // load assets when File Page redesign is enabled
         if ($app->checkSkin('oasis') && !empty($wgEnableVideoPageRedesign)) {
             $filePageTabbedCss = 'file_page_tabbed_css';
             $filePageTabbedJs = 'file_page_tabbed_js';
             foreach ($assetsManager->getURL($filePageTabbedCss) as $url) {
                 $out->addStyle($url);
             }
             foreach ($assetsManager->getURL($filePageTabbedJs) as $url) {
                 $out->addScript("<script src=\"{$url}\"></script>");
             }
         }
     }
     wfProfileOut(__METHOD__);
     return true;
 }
 protected function getHTMLPreviousNextPageLinks(OutputPage $out, $edit_token, $offset, $next_offset, $button_name, $page_name)
 {
     global $wgNewManuscriptOptions, $wgArticleUrl;
     $max_on_page = $wgNewManuscriptOptions['max_on_page'];
     $html = "";
     if ($offset >= $max_on_page) {
         $previous_message_hover = $out->msg('singlemanuscriptpages-previoushover');
         $previous_message = $out->msg('singlemanuscriptpages-previous');
         $previous_offset = $offset - $max_on_page;
         $html .= '<form class="summarypage-form" id="previous-link" action="' . $wgArticleUrl . 'Special:' . $page_name . '" method="post">';
         $html .= "<input type='hidden' name='offset' value = '{$previous_offset}'>";
         $html .= "<input type='hidden' name='{$button_name}' value='{$button_name}'>";
         $html .= "<input type='submit' class='button-transparent' name='redirect_page_back' title='{$previous_message_hover}'  value='{$previous_message}'>";
         $html .= "<input type='hidden' name='default_page_posted' value='default_page_posted'>";
         $html .= "<input type='hidden' name='wpEditToken' value='{$edit_token}'>";
         $html .= "</form>";
     }
     if (isset($next_offset)) {
         if (!$offset >= $max_on_page) {
             $html .= '<br>';
         }
         $next_message_hover = $out->msg('singlemanuscriptpages-nexthover');
         $next_message = $out->msg('singlemanuscriptpages-next');
         $html .= '<form class="summarypage-form" id="next-link" action="' . $wgArticleUrl . 'Special:' . $page_name . '" method="post">';
         $html .= "<input type='hidden' name='offset' value = '{$next_offset}'>";
         $html .= "<input type='hidden' name='{$button_name}' value='{$button_name}'>";
         $html .= "<input type='submit' class='button-transparent' name = 'redirect_page_forward' title='{$next_message_hover}' value='{$next_message}'>";
         $html .= "<input type='hidden' name='default_page_posted' value='default_page_posted'>";
         $html .= "<input type='hidden' name='wpEditToken' value='{$edit_token}'>";
         $html .= "</form>";
     }
     return $html;
 }
Example #4
0
 public function execute()
 {
     $params = $this->extractRequestParams();
     $modules = array();
     foreach ($params['modules'] as $path) {
         $modules[] = $this->getModuleFromPath($path);
     }
     // Get the help
     $context = new DerivativeContext($this->getMain()->getContext());
     $context->setSkin(SkinFactory::getDefaultInstance()->makeSkin('apioutput'));
     $context->setLanguage($this->getMain()->getLanguage());
     $context->setTitle(SpecialPage::getTitleFor('ApiHelp'));
     $out = new OutputPage($context);
     $out->setCopyrightUrl('https://www.mediawiki.org/wiki/Special:MyLanguage/Copyright');
     $context->setOutput($out);
     self::getHelp($context, $modules, $params);
     // Grab the output from the skin
     ob_start();
     $context->getOutput()->output();
     $html = ob_get_clean();
     $result = $this->getResult();
     if ($params['wrap']) {
         $data = array('mime' => 'text/html', 'help' => $html);
         ApiResult::setSubelementsList($data, 'help');
         $result->addValue(null, $this->getModuleName(), $data);
     } else {
         $result->reset();
         $result->addValue(null, 'text', $html, ApiResult::NO_SIZE_CHECK);
         $result->addValue(null, 'mime', 'text/html', ApiResult::NO_SIZE_CHECK);
     }
 }
 public static function onBeforePageDisplay(OutputPage &$out, Skin &$skin)
 {
     // Run this only if it's a high priority
     if (self::isHighPriority()) {
         $out->addHeadItem('FacebookConversionPixel', self::getFbPixelScript($skin));
     }
 }
Example #6
0
 /**
  *
  */
 function setupSkinUserCss(OutputPage $out)
 {
     global $wgContLang;
     $qb = $this->qbSetting();
     $rules = array();
     if (2 == $qb) {
         # Right
         $rules[] = "#quickbar { position: absolute; top: 4px; right: 4px; border-left: 2px solid #000000; }";
         $rules[] = "#article, #mw-data-after-content { margin-left: 4px; margin-right: 152px; }";
     } elseif (1 == $qb || 3 == $qb) {
         $rules[] = "#quickbar { position: absolute; top: 4px; left: 4px; border-right: 1px solid gray; }";
         $rules[] = "#article, #mw-data-after-content { margin-left: 152px; margin-right: 4px; }";
         if (3 == $qb) {
             $rules[] = "#quickbar { position: fixed; padding: 4px; }";
         }
     } elseif (4 == $qb) {
         $rules[] = "#quickbar { position: fixed; right: 0px; top: 0px; padding: 4px;}";
         $rules[] = "#quickbar { border-right: 1px solid gray; }";
         $rules[] = "#article, #mw-data-after-content { margin-right: 152px; margin-left: 4px; }";
     }
     $style = implode("\n", $rules);
     if ($wgContLang->getDir() === 'rtl') {
         $style = CSSJanus::transform($style, true, false);
     }
     $out->addInlineStyle($style);
     parent::setupSkinUserCss($out);
 }
Example #7
0
 public static function onBeforePageDisplay(\OutputPage &$output, \Skin &$skin)
 {
     $title = $output->getTitle();
     // Disallow commenting on pages without article id
     if ($title->getArticleID() == 0) {
         return true;
     }
     if ($title->isSpecialPage()) {
         return true;
     }
     // These could be explicitly allowed in later version
     if (!$title->canTalk()) {
         return true;
     }
     if ($title->isTalkPage()) {
         return true;
     }
     if ($title->isMainPage()) {
         return true;
     }
     // Do not display when printing
     if ($output->isPrintable()) {
         return true;
     }
     // Disable if not viewing
     if ($skin->getRequest()->getVal('action', 'view') != 'view') {
         return true;
     }
     // Blacklist several namespace
     if (in_array($title->getNamespace(), array(NS_MEDIAWIKI, NS_TEMPLATE, NS_CATEGORY, NS_FILE, NS_USER))) {
         return true;
     }
     $output->addModules('ext.pagerating');
     return true;
 }
Example #8
0
 /**
  * @param \EditPage   $editPage
  * @param \OutputPage $output
  *
  * @return bool
  */
 public function onShowEditForm($editPage, $output)
 {
     if (!$output->getUser()->isEmailConfirmed()) {
         $editPage->editFormTextBeforeContent .= $this->installHtml();
     }
     return true;
 }
 /**
  * BeforePageDisplay hook
  *
  * Add the modules to the page
  *
  * @param $out OutputPage output page
  * @param $skin Skin current skin
  *
  * @return true
  */
 public static function onBeforePageDisplay(OutputPage $out, $skin)
 {
     //Add modules:
     $out->addModuleStyles('ext.wr.ShareBar');
     $out->addModules('ext.wr.ShareBar.js');
     return true;
 }
    /**
     * Get the captcha form.
     * @return string
     */
    function getForm(OutputPage $out)
    {
        global $wgReCaptchaSiteKey;
        // Insert reCAPTCHA script.
        // See https://developers.google.com/recaptcha/docs/faq
        $out->addHeadItem('g-recaptchascript', '<script src="https://www.google.com/recaptcha/api.js" async defer></script>');
        $output = Html::element('div', array('class' => array('g-recaptcha', 'mw-confirmedit-captcha-fail' => !!$this->error), 'data-sitekey' => $wgReCaptchaSiteKey));
        $htmlUrlencoded = htmlspecialchars(urlencode($wgReCaptchaSiteKey));
        $output .= <<<HTML
<noscript>
  <div style="width: 302px; height: 422px;">
    <div style="width: 302px; height: 422px; position: relative;">
      <div style="width: 302px; height: 422px; position: absolute;">
        <iframe src="https://www.google.com/recaptcha/api/fallback?k={$htmlUrlencoded}"
                frameborder="0" scrolling="no"
                style="width: 302px; height:422px; border-style: none;">
        </iframe>
      </div>
      <div style="width: 300px; height: 60px; border-style: none;
                  bottom: 12px; left: 25px; margin: 0px; padding: 0px; right: 25px;
                  background: #f9f9f9; border: 1px solid #c1c1c1; border-radius: 3px;">
        <textarea id="g-recaptcha-response" name="g-recaptcha-response"
                  class="g-recaptcha-response"
                  style="width: 250px; height: 40px; border: 1px solid #c1c1c1;
                         margin: 10px 25px; padding: 0px; resize: none;" >
        </textarea>
      </div>
    </div>
  </div>
</noscript>
HTML;
        return $output;
    }
/**
 * @param OutputPage $out
 * @param string $text
 * @return bool
 */
function wfArticleMetaDescription(&$out, &$text)
{
    global $wgTitle;
    wfProfileIn(__METHOD__);
    $sMessage = null;
    $sMainPage = wfMsgForContent('Mainpage');
    if (strpos($sMainPage, ':') !== false) {
        $sTitle = $wgTitle->getFullText();
    } else {
        $sTitle = $wgTitle->getText();
    }
    if (strcmp($sTitle, $sMainPage) == 0) {
        // we're on Main Page, check MediaWiki:Description message
        $sMessage = wfMsg("Description");
    }
    if ($sMessage == null || wfEmptyMsg("Description", $sMessage)) {
        $DESC_LENGTH = 100;
        $articleId = $wgTitle->getArticleID();
        $articleService = new ArticleService($articleId);
        $description = $articleService->getTextSnippet($DESC_LENGTH);
    } else {
        // MediaWiki:Description message found, use it
        $description = $sMessage;
    }
    if (!empty($description)) {
        $out->addMeta('description', htmlspecialchars($description));
    }
    wfProfileOut(__METHOD__);
    return true;
}
 function setupSkinUserCss(OutputPage $out)
 {
     $out->addStyle('common/shared.css', 'screen');
     $out->addStyle('CbpTranscription/main.css', 'screen');
     $out->addStyle('CbpTranscription/print.css', 'print');
     $out->addStyle('CbpTranscription/rtl.css', 'screen', '', 'rtl');
 }
 /**
  * @param $out OutputPage object
  */
 function setupSkinUserCss(OutputPage $out)
 {
     // do not use non-standard MW less files anymore
     //		parent::setupSkinUserCss( $out );
     // load Bootstrap styles
     $out->addModuleStyles('ext.bootstrap.styles');
 }
Example #14
0
function efOpenGraphMetaPageHook(OutputPage &$out, &$sk)
{
    global $wgLogo, $wgSitename, $wgXhtmlNamespaces, $egFacebookAppId, $egFacebookAdmins;
    $wgXhtmlNamespaces["og"] = "http://opengraphprotocol.org/schema/";
    $title = $out->getTitle();
    $isMainpage = $title->isMainPage();
    $meta = array();
    if ($isMainpage) {
        $meta["og:type"] = "website";
        $meta["og:title"] = $wgSitename;
    } else {
        $meta["og:type"] = "article";
        $meta["og:site_name"] = $wgSitename;
        // Try to chose the most appropriate title for showing in news feeds.
        if (defined('NS_BLOG_ARTICLE') && $title->getNamespace() == NS_BLOG_ARTICLE || defined('NS_BLOG_ARTICLE_TALK') && $title->getNamespace() == NS_BLOG_ARTICLE_TALK) {
            $meta["og:title"] = $title->getSubpageText();
        } else {
            $meta["og:title"] = $title->getText();
        }
    }
    if (isset($out->mMainImage) && $out->mMainImage !== false) {
        if (is_object($out->mMainImage)) {
            $meta["og:image"] = wfExpandUrl($out->mMainImage->createThumb(100 * 3, 100));
        } else {
            // In some edge-cases we won't have defined an object but rather a full URL.
            $meta["og:image"] = $out->mMainImage;
        }
    } elseif ($isMainpage) {
        $meta["og:image"] = wfExpandUrl($wgLogo);
    }
    if (isset($out->mDescription)) {
        // set by Description2 extension, install it if you want proper og:description support
        $meta["og:description"] = $out->mDescription;
    }
    $meta["og:url"] = $title->getFullURL();
    if ($egFacebookAppId) {
        /* begin wikia change */
        // $meta["fb:app_id"] = $egFacebookAppId;
        // fb:app_id needs a prefix property declaring the namespace, so just add it directly
        $out->addHeadItem("meta:property:fb:app_id", "\t" . Html::element('meta', array('property' => 'fb:app_id', 'content' => $egFacebookAppId, 'prefix' => "fb: http://www.facebook.com/2008/fbml")) . "\n");
        /* end wikia change */
    }
    if ($egFacebookAdmins) {
        $meta["fb:admins"] = $egFacebookAdmins;
    }
    /* begin wikia change */
    wfRunHooks('OpenGraphMetaHeaders', array("meta" => &$meta, "title" => $title));
    /* end wikia change */
    foreach ($meta as $property => $value) {
        if ($value) {
            if (isset(OutputPage::$metaAttrPrefixes) && isset(OutputPage::$metaAttrPrefixes['property'])) {
                $out->addMeta("property:{$property}", $value);
            } else {
                $out->addHeadItem("meta:property:{$property}", "\t" . Html::element('meta', array('property' => $property, 'content' => $value)) . "\n");
            }
        }
    }
    return true;
}
 /**
  * Hook-Handler for MediaWiki 'BeforePageDisplay' hook. Sets context if needed.
  * @param OutputPage $oOutputPage
  * @param Skin $oSkin
  * @return bool
  */
 public function onBeforePageDisplay(&$oOutputPage, &$oSkin)
 {
     if (!SpecialPage::getTitleFor('Preferences')->equals($oOutputPage->getTitle())) {
         return true;
     }
     $oOutputPage->addModules('ext.bluespice.userpreferences');
     return true;
 }
Example #16
0
 function setupSkinUserCss(OutputPage $out)
 {
     // Do not call parent::setupSkinUserCss(), we have our own print style
     $out->addStyle('common/shared.css', 'screen');
     $out->addStyle('modern/main.css', 'screen');
     $out->addStyle('modern/print.css', 'print');
     $out->addStyle('modern/rtl.css', 'screen', '', 'rtl');
 }
 public static function onOutputPageBeforeHTML(OutputPage &$out, &$text)
 {
     global $wgEnableRecommendationsExt;
     if (!empty($wgEnableRecommendationsExt) && F::app()->checkSkin('venus')) {
         $out->addModules('ext.wikia.recommendations');
     }
     return true;
 }
 /**
  *
  * @param OutputPage $oOutputPage
  * @param SkinTemplate $oSkinTemplate
  * @return boolean
  */
 public function onBeforePageDisplay($oOutputPage, $oSkinTemplate)
 {
     if (!SpecialPage::getTitleFor('RSSFeeder')->equals($this->getTitle())) {
         return true;
     }
     $oOutputPage->addModules('ext.bluespice.rssStandards');
     return true;
 }
 /**
  * Adds module
  * @param OutputPage $out
  * @param SkinTemplate $skin
  * @return boolean
  */
 public static function onBeforePageDisplay(&$out, &$skin)
 {
     if (!$out->getTitle()->equals($out->getUser()->getUserPage())) {
         return true;
     }
     $out->addModules("ext.bluespice.avatars.js");
     return true;
 }
 /**
  * Hook-Handler for MediaWiki 'BeforePageDisplay' hook. Sets context if needed.
  * @param OutputPage $oOutputPage
  * @param Skin $oSkin
  * @return bool
  */
 public function onBeforePageDisplay(&$oOutputPage, &$oSkin)
 {
     if (BsConfig::get('MW::BlueSpiceProjectFeedbackHelper::Active') == false) {
         return true;
     }
     $oOutputPage->addModules('ext.bluespice.blueSpiceprojectfeedbackhelper');
     return true;
 }
Example #21
0
 /**
  * Add JS module to the output
  * @param \OutputPage $out An output object passed from a hook
  * @return bool
  */
 public static function onBeforePageDisplay(\OutputPage $out)
 {
     // use resource loader for i18n messages in JS
     $out->addModules('ext.cookiePolicyMessages');
     // use AssetsManager for script loading to avoid race conditions (SOC-528)
     \Wikia::addAssetsToOutput('cookie_policy_js');
     return true;
 }
Example #22
0
function wfCOBeforePageDisplay(OutputPage &$out, &$sk)
{
    global $wgExtensionsPath;
    if (wfCOCheck()) {
        $out->addExtensionStyle("{$wgExtensionsPath}/wikia/CommentsOnly/CommentsOnly.css");
    }
    return true;
}
Example #23
0
 public static function onBeforePageDisplay(OutputPage &$out, &$skin)
 {
     global $wgExtensionsPath;
     if (self::isEnabled()) {
         $out->addHtml('<noscript><link rel="stylesheet" href="' . $wgExtensionsPath . '/wikia/ImageLazyLoad/css/ImageLazyLoadNoScript.css" /></noscript>');
     }
     return true;
 }
 /**
  * BeforePageDisplay hook
  * Adds the modules to the page
  *
  * @param $out OutputPage output page
  * @param $skin Skin current skin
  *
  * @return bool
  */
 public static function onBeforePageDisplay(OutputPage &$out, Skin &$skin)
 {
     global $wgSurveyGizmoBeaconID, $wgSurveyGizmoBeaconUrl;
     if (!empty($wgSurveyGizmoBeaconID) && !empty($wgSurveyGizmoBeaconUrl)) {
         $out->addModules('ext.surveyGizmo');
     }
     return true;
 }
 public static function onBeforePageDisplay(OutputPage &$out, Skin &$skin)
 {
     global $wgScriptPath;
     $dir = $wgScriptPath . '/extensions/MediawikiHighlight/highlight';
     $out->addScript('<script src="' . $dir . '/highlight.pack.js"></script>');
     $out->addScript('<link rel="stylesheet" href="' . $dir . '/styles/github.css" />');
     $out->addScript("<script type='text/javascript'>\$(document).ready(function() {\n                             \$('pre').each(function(i, block) {\n                                 hljs.highlightBlock(block);\n                             });\n                         });</script>");
     return true;
 }
Example #26
0
    function outputPage(OutputPage $out)
    {
        global $wgContLang, $wgTomasSkinPath, $wgScriptPath;
        $lang = $wgContLang->getCode();
        $this->path = $wgTomasSkinPath ? $wgTomasSkinPath : "{$wgScriptPath}/extensions/skins/Tomas";
        $this->out = $out;
        $bodyText = $out->getHTML();
        $bodyText = preg_replace('!(<img[^>]*src=")schstock/!', "\$1{$this->path}/images/", $bodyText);
        $bodyText = preg_replace('!(<[^>]*style="[^"]*url\\()schstock/!', "\$1{$this->path}/images/", $bodyText);
        $bodyText = preg_replace('!(<input[^>]*src=")schstock/!', "\$1{$this->path}/images/", $bodyText);
        $query = 'usemsgcache=yes&action=raw&ctype=text/css&smaxage=2678400';
        $siteCss = Title::newFromText('MediaWiki:Tomas.css')->getLocalUrl($query);
        $siteJs = Title::newFromText('MediaWiki:Tomas.js')->getLocalUrl($query);
        ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Language" content="<?php 
        echo htmlspecialchars($lang);
        ?>
">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title><?php 
        echo htmlspecialchars($out->getPageTitle());
        ?>
 </title>
		<link rel="stylesheet" href="<?php 
        echo htmlspecialchars($this->getMainCss());
        ?>
" type="text/css"/>
		<script type="text/javascript" src="<?php 
        echo htmlspecialchars($this->getMainJs());
        ?>
"></script>
		<link rel="stylesheet" href="<?php 
        echo htmlspecialchars($siteCss);
        ?>
" type="text/css"/>
		<script type="text/javascript" src="<?php 
        echo htmlspecialchars($siteJs);
        ?>
"></script>

	</head>

	<body>
		<div align="center">

			<?php 
        echo $bodyText;
        ?>
		</div>
	</body>
</html>

<?php 
    }
Example #27
0
/**
 * If interstitials are enabled, add the JS for them.
 */
function interstitialAddJs(OutputPage $out, Skin $sk)
{
    global $wgAdsInterstitialsEnabled;
    if (!empty($wgAdsInterstitialsEnabled)) {
        global $wgJsMimeType, $wgExtensionsPath;
        $out->addScript("<script type=\"{$wgJsMimeType}\" src=\"{$wgExtensionsPath}/wikia/Interstitial/Interstitial.js\" ></script>\n");
    }
    return true;
}
Example #28
0
/**
 * Adds a script to a page that protects users without JavaScript from not being able
 * too see TOC (which is now hidden by default)
 */
function TOCcssfornoscript(OutputPage &$out, &$skin)
{
    // Do not add this asset on VenusSkin
    if ($skin instanceof SkinVenus) {
        return true;
    }
    $out->addHtml('<noscript><link rel="stylesheet" href="' . F::app()->wg->ExtensionsPath . '/wikia/TOCimprovements/TOCNoScript.css" /></noscript>');
    return true;
}
Example #29
0
 function setupSkinUserCss(OutputPage $out)
 {
     global $wgStyleVersion, $wgJsMimeType, $wgStylePath;
     // Do not call parent::setupSkinUserCss(), we have our own print style
     $out->addStyle('common/shared.css', 'screen');
     $out->addStyle('modern/main.css', 'screen');
     $out->addStyle('modern/print.css', 'print');
     $out->addStyle('modern/rtl.css', 'screen', '', 'rtl');
 }
function hookOutputPageBeforeHTML(OutputPage &$out, &$text)
{
    if ($out->getTitle()->getNamespace() == 6) {
        //6 is the File Namespace
        $out->includeJQuery();
        $out->addModules('ext.SemanticImageAnnotator');
    }
    return true;
}