本文整理汇总了PHP中OutputPage类的典型用法代码示例。如果您正苦于以下问题:PHP OutputPage类的具体用法?PHP OutputPage怎么用?PHP OutputPage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OutputPage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onOutputPageParserOutput
public static function onOutputPageParserOutput(OutputPage &$out, ParserOutput $parseroutput)
{
global $wgEnableMWSuggest;
$skin = $out->getSkin()->getSkinName();
if ($skin == 'monobook' || $skin == 'uncyclopedia') {
$wgEnableMWSuggest = true;
}
return true;
}
示例2: onBeforePageDisplay
/**
* 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;
}
示例3: getHTMLPreviousNextPageLinks
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;
}
示例4: execute
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);
}
}
示例5: onBeforePageDisplay
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));
}
}
开发者ID:kolzchut,项目名称:mediawiki-extensions-FacebookConversionPixel,代码行数:7,代码来源:FacebookConversionPixel.hooks.php
示例6: setupSkinUserCss
/**
*
*/
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);
}
示例7: onBeforePageDisplay
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;
}
示例8: onShowEditForm
/**
* @param \EditPage $editPage
* @param \OutputPage $output
*
* @return bool
*/
public function onShowEditForm($editPage, $output)
{
if (!$output->getUser()->isEmailConfirmed()) {
$editPage->editFormTextBeforeContent .= $this->installHtml();
}
return true;
}
示例9: onBeforePageDisplay
/**
* 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;
}
示例10: getForm
/**
* 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;
}
示例11: wfArticleMetaDescription
/**
* @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;
}
示例12: setupSkinUserCss
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');
}
示例13: setupSkinUserCss
/**
* @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');
}
示例14: efOpenGraphMetaPageHook
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;
}
示例15: onBeforePageDisplay
/**
* 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;
}