Esempio n. 1
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;
 }
Esempio n. 2
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;
}
 /**
  * Format and output report results using the given information plus
  * OutputPage
  *
  * @param OutputPage $out OutputPage to print to
  * @param Skin $skin User skin to use
  * @param Database $dbr Database (read) connection to use
  * @param int $res Result pointer
  * @param int $num Number of available result rows
  * @param int $offset Paging offset
  */
 protected function outputResults($out, $skin, $dbr, $res, $num, $offset)
 {
     if ($num > 0) {
         $gallery = new ImageGallery();
         $gallery->useSkin($skin);
         # $res might contain the whole 1,000 rows, so we read up to
         # $num [should update this to use a Pager]
         for ($i = 0; $i < $num && ($row = $dbr->fetchObject($res)); $i++) {
             $image = $this->prepareImage($row);
             if ($image) {
                 $gallery->add($image->getTitle(), $this->getCellHtml($row));
             }
         }
         $out->addHtml($gallery->toHtml());
     }
 }
 /**
  * Dispatched from execute();
  */
 private function outputInformation()
 {
     // TODO RBV (14.12.10 09:59): Display information about WebService availability, configuration settings, etc... Could also be used to monitor Webservice and manually empty cache.
     $this->oOutputPage->setPageTitle(wfMessage('bs-universalexport-page-title-without-param')->text());
     $this->oOutputPage->addHtml(wfMessage('bs-universalexport-page-text-without-param')->text());
     $this->oOutputPage->addHtml('<hr />');
     if (empty($this->aModules)) {
         $this->oOutputPage->addHtml(wfMessage('bs-universalexport-page-text-without-param-no-modules-registered')->text());
         return;
     }
     foreach ($this->aModules as $sKey => $oModule) {
         if ($oModule instanceof BsUniversalExportModule) {
             $oModuleOverview = $oModule->getOverview();
             $this->oOutputPage->addHtml($oModuleOverview->execute());
         } else {
             wfDebugLog('BS::UniversalExport', 'SpecialUniversalExport::outputInformation: Invalid view.');
         }
     }
 }
	protected function showEmail( $step ) {
		$header = new HtmlTag( 'h2' );
		$step_message = 'translate-fs-email-title';
		$header->style( 'opacity', 0.4 )->content( wfMsg( $step_message ) );

		if ( $step && ( $step !== 'translate-fs-target-title' && $step !== 'translate-fs-permissions-title' ) ) {
			$this->out->addHtml( $header );
			return $step;
		}

		if ( $this->user->isEmailConfirmed() ) {
			$header->content( $header->content . wfMsg( 'translate-fs-pagetitle-done' ) );
			$this->out->addHtml( $header );
			return $step; // Start translating step
		}

		$this->out->addHtml( $header->style( 'opacity', false ) );
		$this->out->addWikiMsg( 'translate-fs-email-text' );

		return $step_message;
	}
 /**
  * Hook into Article::view() to provide syntax highlighting for
  * custom CSS and JavaScript pages
  *
  * @param string $text
  * @param Title $title
  * @param OutputPage $output
  * @return bool
  */
 public static function viewHook($text, $title, $output)
 {
     // Determine the language
     preg_match('!\\.(css|js)$!u', $title->getText(), $matches);
     $lang = $matches[1] == 'css' ? 'css' : 'javascript';
     // Attempt to format
     $geshi = self::prepare($text, $lang);
     if ($geshi instanceof GeSHi) {
         $out = $geshi->parse_code();
         if (!$geshi->error()) {
             // Done
             $output->addHeadItem("source-{$lang}", self::buildHeadItem($geshi));
             $output->addHtml("<div dir=\"ltr\">{$out}</div>");
             return false;
         }
     }
     // Bottle out
     return true;
 }
 /**
  * If there are rows in the deletion log for this page, show them,
  * along with a nice little note for the user
  *
  * @param OutputPage $out
  */
 private function showDeletionLog($out)
 {
     $title = $this->mTitle;
     $reader = new LogReader(new FauxRequest(array('page' => $title->getPrefixedText(), 'type' => 'delete')));
     if ($reader->hasRows()) {
         $out->addHtml('<div id="mw-recreate-deleted-warn">');
         $out->addWikiMsg('recreate-deleted-warn');
         $viewer = new LogViewer($reader);
         $viewer->showList($out);
         $out->addHtml('</div>');
     }
 }
 /**
  * Show a rights log fragment for the specified user
  *
  * @param User $user User to show log for
  * @param OutputPage $output OutputPage to use
  */
 protected function showLogFragment($user, $output)
 {
     $viewer = new LogViewer(new LogReader(new FauxRequest(array('type' => 'rights', 'page' => $user->getUserPage()->getPrefixedText()))));
     $output->addHtml("<h2>" . htmlspecialchars(LogPage::logName('rights')) . "</h2>\n");
     $viewer->showList($output);
 }
Esempio n. 9
0
 function onBeforePageDisplay(OutputPage &$out, &$skin)
 {
     if (self::$enabled) {
         $out->addHtml('<noscript><link rel="stylesheet" href="' . $this->app->wg->ExtensionsPath . '/wikia/ImageLazyLoad/css/ImageLazyLoadNoScript.css" /></noscript>');
     }
     return true;
 }
	/**
	 * @since 2012-01-12
	 */
	public static function addSpecialHelpLink( OutputPage $out, /*string*/$to ) {
		$out->addModules( 'ext.translate.helplink' );
		$text = wfMessage( 'translate-gethelp' )->escaped();
		$link = Html::rawElement( 'a', array( 'href' => "//www.mediawiki.org/wiki/Special:MyLanguage/$to" ), "$text" );
		$wrapper = Html::rawElement( 'div', array( 'class' => 'mw-translate-helplink' ), $link );
		$out->addHtml( $wrapper );
	}
 /**
  * Show a message indicating the number of items on the user's watchlist,
  * and return this count for additional checking
  *
  * @param OutputPage $output
  * @param User $user
  * @return int
  */
 private function showItemCount($output, $user)
 {
     if (($count = $this->countWatchlist($user)) > 0) {
         $output->addHtml(wfMsgExt('watchlistedit-numitems', 'parse', $GLOBALS['wgLang']->formatNum($count)));
     } else {
         $output->addHtml(wfMsgExt('watchlistedit-noitems', 'parse'));
     }
     return $count;
 }
Esempio n. 12
0
 /**
  * Format and output report results using the given information plus
  * OutputPage
  *
  * @param OutputPage $out OutputPage to print to
  * @param Skin $skin User skin to use
  * @param Database $dbr Database (read) connection to use
  * @param int $res Result pointer
  * @param int $num Number of available result rows
  * @param int $offset Paging offset
  */
 protected function outputResults($out, $skin, $dbr, $res, $num, $offset)
 {
     global $wgContLang;
     if ($num > 0) {
         $html = array();
         if (!$this->listoutput) {
             $html[] = $this->openList($offset);
         }
         # $res might contain the whole 1,000 rows, so we read up to
         # $num [should update this to use a Pager]
         for ($i = 0; $i < $num && ($row = $dbr->fetchObject($res)); $i++) {
             $line = $this->formatResult($skin, $row);
             if ($line) {
                 $attr = isset($row->usepatrol) && $row->usepatrol && $row->patrolled == 0 ? ' class="not-patrolled"' : '';
                 $html[] = $this->listoutput ? $line : "<li{$attr}>{$line}</li>\n";
             }
         }
         # Flush the final result
         if ($this->tryLastResult()) {
             $row = null;
             $line = $this->formatResult($skin, $row);
             if ($line) {
                 $attr = isset($row->usepatrol) && $row->usepatrol && $row->patrolled == 0 ? ' class="not-patrolled"' : '';
                 $html[] = $this->listoutput ? $line : "<li{$attr}>{$line}</li>\n";
             }
         }
         if (!$this->listoutput) {
             $html[] = $this->closeList();
         }
         $html = $this->listoutput ? $wgContLang->listToText($html) : implode('', $html);
         $out->addHtml($html);
     }
 }
Esempio n. 13
0
 /**
  * Format and output report results using the given information plus
  * OutputPage
  *
  * @param OutputPage $out OutputPage to print to
  * @param Skin $skin User skin to use
  * @param Database $dbr Database (read) connection to use
  * @param int $res Result pointer
  * @param int $num Number of available result rows
  * @param int $offset Paging offset
  */
 protected function outputResults($out, $skin, $dbr, $res, $num, $offset)
 {
     global $wgContLang, $wgUser, $wgLanguageCode;
     if ($num > 0) {
         $html = array();
         if (!$this->listoutput) {
             $html[] = $this->openList($offset);
         }
         # $res might contain the whole 1,000 rows, so we read up to
         # $num [should update this to use a Pager]
         for ($i = 0; $i < $num && ($row = $dbr->fetchObject($res)); $i++) {
             $line = $this->formatResult($skin, $row);
             $title = preg_replace('/-/', ' ', $row->title);
             if ($line) {
                 $attr = isset($row->usepatrol) && $row->usepatrol && $row->patrolled == 0 ? ' class="not-patrolled"' : '';
                 if ($wgUser->getID() > 0 && ($wgLanguageCode != 'zh' && $wgLanguageCode != 'ru' && $wgLanguageCode != 'hi')) {
                     $html[] = $this->listoutput ? $line : "<li{$attr}><div id=\"" . htmlentities($title, ENT_QUOTES) . "\">{$line}   <input type=\"button\" value=\"" . wfMsg('up_add_category') . "\" onclick=\"frames['dlogBody'].supAC('" . urlencode($title) . "');\"></div> </li>\n";
                 } else {
                     $html[] = $this->listoutput ? $line : "<li{$attr}>{$line}</li>\n";
                 }
             }
         }
         # Flush the final result
         if ($this->tryLastResult()) {
             $row = null;
             $line = $this->formatResult($skin, $row);
             if ($line) {
                 $attr = isset($row->usepatrol) && $row->usepatrol && $row->patrolled == 0 ? ' class="not-patrolled"' : '';
                 $html[] = $this->listoutput ? $line : "<li{$attr}>{$line}</li>\n";
             }
         }
         if (!$this->listoutput) {
             $html[] = $this->closeList();
         }
         $html = $this->listoutput ? $wgContLang->listToText($html) : implode('', $html);
         $out->addHtml($html);
         if ($wgUser->getID() > 0 && ($wgLanguageCode != 'zh' && $wgLanguageCode != 'ru' && $wgLanguageCode != 'hi')) {
             $out->addHtml($this->getCategoryPopup());
         }
     }
 }
 /**
  * If there are rows in the deletion log for this file, show them,
  * along with a nice little note for the user
  *
  * @param OutputPage $out
  * @param string filename
  */
 private function showDeletionLog($out, $filename)
 {
     $reader = new LogReader(new FauxRequest(array('page' => $filename, 'type' => 'delete')));
     if ($reader->hasRows()) {
         $out->addHtml('<div id="mw-upload-deleted-warn">');
         $out->addWikiMsg('upload-wasdeleted');
         $viewer = new LogViewer($reader);
         $viewer->showList($out);
         $out->addHtml('</div>');
     }
 }
Esempio n. 15
0
 /**
  * Add fields to perform temporary save
  */
 private static function addTemporarySaveFields(OutputPage $out)
 {
     $out->addHtml("\n" . Xml::element('input', array('type' => 'hidden', 'id' => 'RTETemporarySaveType', 'name' => 'RTETemporarySaveType')) . Xml::element('input', array('type' => 'hidden', 'id' => 'RTETemporarySaveContent', 'name' => 'RTETemporarySaveContent')) . "\n");
 }
Esempio n. 16
0
 /**
  * @since 2012-01-12
  */
 public static function addSpecialHelpLink(OutputPage $out, $to, $overrideBaseUrl = false)
 {
     $out->addModules('ext.translate.helplink');
     $text = wfMessage('translate-gethelp')->escaped();
     if ($overrideBaseUrl) {
         $helpUrl = $to;
     } else {
         $helpUrl = "//www.mediawiki.org/wiki/Special:MyLanguage/{$to}";
     }
     $link = Html::rawElement('a', array('href' => $helpUrl, 'target' => '_blank'), "{$text}");
     $wrapper = Html::rawElement('div', array('class' => 'mw-translate-helplink'), $link);
     $out->addHtml($wrapper);
 }