当前位置: 首页>>代码示例>>PHP>>正文


PHP MWTimestamp::getInstance方法代码示例

本文整理汇总了PHP中MWTimestamp::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP MWTimestamp::getInstance方法的具体用法?PHP MWTimestamp::getInstance怎么用?PHP MWTimestamp::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MWTimestamp的用法示例。


在下文中一共展示了MWTimestamp::getInstance方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDateCond

 function getDateCond($year, $month)
 {
     $year = intval($year);
     $month = intval($month);
     // Basic validity checks
     $this->mYear = $year > 0 ? $year : false;
     $this->mMonth = $month > 0 && $month < 13 ? $month : false;
     // Given an optional year and month, we need to generate a timestamp
     // to use as "WHERE rev_timestamp <= result"
     // Examples: year = 2006 equals < 20070101 (+000000)
     // year=2005, month=1    equals < 20050201
     // year=2005, month=12   equals < 20060101
     if (!$this->mYear && !$this->mMonth) {
         return;
     }
     if ($this->mYear) {
         $year = $this->mYear;
     } else {
         // If no year given, assume the current one
         $timestamp = MWTimestamp::getInstance();
         $year = $timestamp->format('Y');
         // If this month hasn't happened yet this year, go back to last year's month
         if ($this->mMonth > $timestamp->format('n')) {
             $year--;
         }
     }
     if ($this->mMonth) {
         $month = $this->mMonth + 1;
         // For December, we want January 1 of the next year
         if ($month > 12) {
             $month = 1;
             $year++;
         }
     } else {
         // No month implies we want up to the end of the year in question
         $month = 1;
         $year++;
     }
     // Y2K38 bug
     if ($year > 2032) {
         $year = 2032;
     }
     $ymd = (int) sprintf("%04d%02d01", $year, $month);
     if ($ymd > 20320101) {
         $ymd = 20320101;
     }
     $this->mOffset = $this->mDb->timestamp("{$ymd}000000");
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:48,代码来源:ReverseChronologicalPager.php

示例2: testGetDateCond

 /**
  * @covers ReverseChronologicalPager::getDateCond
  */
 public function testGetDateCond()
 {
     $pager = $this->getMockForAbstractClass('ReverseChronologicalPager');
     $timestamp = MWTimestamp::getInstance();
     $db = wfGetDB(DB_MASTER);
     $currYear = $timestamp->format('Y');
     $currMonth = $timestamp->format('n');
     // Test that getDateCond sets and returns mOffset
     $this->assertEquals($pager->getDateCond(2006, 6), $pager->mOffset);
     // Test year and month
     $pager->getDateCond(2006, 6);
     $this->assertEquals($pager->mOffset, $db->timestamp('20060701000000'));
     // Test year, month, and day
     $pager->getDateCond(2006, 6, 5);
     $this->assertEquals($pager->mOffset, $db->timestamp('20060606000000'));
     // Test month overflow into the next year
     $pager->getDateCond(2006, 12);
     $this->assertEquals($pager->mOffset, $db->timestamp('20070101000000'));
     // Test day overflow to the next month
     $pager->getDateCond(2006, 6, 30);
     $this->assertEquals($pager->mOffset, $db->timestamp('20060701000000'));
     // Test invalid month (should use end of year)
     $pager->getDateCond(2006, -1);
     $this->assertEquals($pager->mOffset, $db->timestamp('20070101000000'));
     // Test invalid day (should use end of month)
     $pager->getDateCond(2006, 6, 1337);
     $this->assertEquals($pager->mOffset, $db->timestamp('20060701000000'));
     // Test last day of year
     $pager->getDateCond(2006, 12, 31);
     $this->assertEquals($pager->mOffset, $db->timestamp('20070101000000'));
     // Test invalid day that overflows to next year
     $pager->getDateCond(2006, 12, 32);
     $this->assertEquals($pager->mOffset, $db->timestamp('20070101000000'));
     // Test month past current month (should use previous year)
     if ($currMonth < 5) {
         $pager->getDateCond(-1, 5);
         $this->assertEquals($pager->mOffset, $db->timestamp($currYear - 1 . '0601000000'));
     }
     if ($currMonth < 12) {
         $pager->getDateCond(-1, 12);
         $this->assertEquals($pager->mOffset, $db->timestamp($currYear . '0101000000'));
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:46,代码来源:ReverseChronologicalPagerTest.php

示例3: dateMenu

 /**
  * @param int $year
  * @param int $month
  * @return string Formatted HTML
  */
 public static function dateMenu($year, $month)
 {
     # Offset overrides year/month selection
     if ($month && $month !== -1) {
         $encMonth = intval($month);
     } else {
         $encMonth = '';
     }
     if ($year) {
         $encYear = intval($year);
     } elseif ($encMonth) {
         $timestamp = MWTimestamp::getInstance();
         $thisMonth = intval($timestamp->format('n'));
         $thisYear = intval($timestamp->format('Y'));
         if (intval($encMonth) > $thisMonth) {
             $thisYear--;
         }
         $encYear = $thisYear;
     } else {
         $encYear = '';
     }
     $inputAttribs = array('id' => 'year', 'maxlength' => 4, 'size' => 7);
     return self::label(wfMessage('year')->text(), 'year') . ' ' . Html::input('year', $encYear, 'number', $inputAttribs) . ' ' . self::label(wfMessage('month')->text(), 'month') . ' ' . self::monthSelector($encMonth, -1);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:29,代码来源:Xml.php

示例4: getVariableValue

 /**
  * Return value of a magic variable (like PAGENAME)
  *
  * @private
  *
  * @param $index integer
  * @param bool|\PPFrame $frame
  *
  * @throws MWException
  * @return string
  */
 function getVariableValue($index, $frame = false)
 {
     global $wgContLang, $wgSitename, $wgServer;
     global $wgArticlePath, $wgScriptPath, $wgStylePath;
     if (is_null($this->mTitle)) {
         // If no title set, bad things are going to happen
         // later. Title should always be set since this
         // should only be called in the middle of a parse
         // operation (but the unit-tests do funky stuff)
         throw new MWException(__METHOD__ . ' Should only be ' . ' called while parsing (no title set)');
     }
     /**
      * Some of these require message or data lookups and can be
      * expensive to check many times.
      */
     if (wfRunHooks('ParserGetVariableValueVarCache', array(&$this, &$this->mVarCache))) {
         if (isset($this->mVarCache[$index])) {
             return $this->mVarCache[$index];
         }
     }
     $ts = wfTimestamp(TS_UNIX, $this->mOptions->getTimestamp());
     wfRunHooks('ParserGetVariableValueTs', array(&$this, &$ts));
     $pageLang = $this->getFunctionLang();
     switch ($index) {
         case 'currentmonth':
             $value = $pageLang->formatNum(MWTimestamp::getInstance($ts)->format('m'));
             break;
         case 'currentmonth1':
             $value = $pageLang->formatNum(MWTimestamp::getInstance($ts)->format('n'));
             break;
         case 'currentmonthname':
             $value = $pageLang->getMonthName(MWTimestamp::getInstance($ts)->format('n'));
             break;
         case 'currentmonthnamegen':
             $value = $pageLang->getMonthNameGen(MWTimestamp::getInstance($ts)->format('n'));
             break;
         case 'currentmonthabbrev':
             $value = $pageLang->getMonthAbbreviation(MWTimestamp::getInstance($ts)->format('n'));
             break;
         case 'currentday':
             $value = $pageLang->formatNum(MWTimestamp::getInstance($ts)->format('j'));
             break;
         case 'currentday2':
             $value = $pageLang->formatNum(MWTimestamp::getInstance($ts)->format('d'));
             break;
         case 'localmonth':
             $value = $pageLang->formatNum(MWTimestamp::getLocalInstance($ts)->format('m'));
             break;
         case 'localmonth1':
             $value = $pageLang->formatNum(MWTimestamp::getLocalInstance($ts)->format('n'));
             break;
         case 'localmonthname':
             $value = $pageLang->getMonthName(MWTimestamp::getLocalInstance($ts)->format('n'));
             break;
         case 'localmonthnamegen':
             $value = $pageLang->getMonthNameGen(MWTimestamp::getLocalInstance($ts)->format('n'));
             break;
         case 'localmonthabbrev':
             $value = $pageLang->getMonthAbbreviation(MWTimestamp::getLocalInstance($ts)->format('n'));
             break;
         case 'localday':
             $value = $pageLang->formatNum(MWTimestamp::getLocalInstance($ts)->format('j'));
             break;
         case 'localday2':
             $value = $pageLang->formatNum(MWTimestamp::getLocalInstance($ts)->format('d'));
             break;
         case 'pagename':
             $value = wfEscapeWikiText($this->mTitle->getText());
             break;
         case 'pagenamee':
             $value = wfEscapeWikiText($this->mTitle->getPartialURL());
             break;
         case 'fullpagename':
             $value = wfEscapeWikiText($this->mTitle->getPrefixedText());
             break;
         case 'fullpagenamee':
             $value = wfEscapeWikiText($this->mTitle->getPrefixedURL());
             break;
         case 'subpagename':
             $value = wfEscapeWikiText($this->mTitle->getSubpageText());
             break;
         case 'subpagenamee':
             $value = wfEscapeWikiText($this->mTitle->getSubpageUrlForm());
             break;
         case 'rootpagename':
             $value = wfEscapeWikiText($this->mTitle->getRootText());
             break;
         case 'rootpagenamee':
             $value = wfEscapeWikiText(wfUrlEncode(str_replace(' ', '_', $this->mTitle->getRootText())));
//.........这里部分代码省略.........
开发者ID:Tarendai,项目名称:spring-website,代码行数:101,代码来源:Parser.php

示例5: dateMenu

 /**
  * @param $year Integer
  * @param $month Integer
  * @return string Formatted HTML
  */
 public static function dateMenu($year, $month)
 {
     # Offset overrides year/month selection
     if ($month && $month !== -1) {
         $encMonth = intval($month);
     } else {
         $encMonth = '';
     }
     if ($year) {
         $encYear = intval($year);
     } elseif ($encMonth) {
         $timestamp = MWTimestamp::getInstance();
         $thisMonth = intval($timestamp->format('n'));
         $thisYear = intval($timestamp->format('Y'));
         if (intval($encMonth) > $thisMonth) {
             $thisYear--;
         }
         $encYear = $thisYear;
     } else {
         $encYear = '';
     }
     // JRS, upgrade 1.21: Add button classes to date menu
     $inputAttribs = array('id' => 'year', 'maxlength' => 4, 'size' => 7, 'class' => 'input_med');
     return self::label(wfMessage('input-year')->text(), 'year', array('class' => 'input_med noborder')) . ' ' . Html::input('year', $encYear, 'number', $inputAttribs) . '&#160;' . self::label(wfMessage('input-month')->text(), 'month', array('class' => 'input_med noborder')) . ' ' . self::monthSelector($encMonth, -1);
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:30,代码来源:Xml.php

示例6: storeTemp

 /**
  * Pick a random name in the temp zone and store a file to it.
  * Returns a FileRepoStatus object with the file Virtual URL in the value,
  * file can later be disposed using FileRepo::freeTemp().
  *
  * @param string $originalName The base name of the file as specified
  *   by the user. The file extension will be maintained.
  * @param string $srcPath The current location of the file.
  * @return FileRepoStatus Object with the URL in the value.
  */
 public function storeTemp($originalName, $srcPath)
 {
     $this->assertWritableRepo();
     // fail out if read-only
     $date = MWTimestamp::getInstance()->format('YmdHis');
     $hashPath = $this->getHashPath($originalName);
     $dstUrlRel = $hashPath . $date . '!' . rawurlencode($originalName);
     $virtualUrl = $this->getVirtualUrl('temp') . '/' . $dstUrlRel;
     $result = $this->quickImport($srcPath, $virtualUrl);
     $result->value = $virtualUrl;
     return $result;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:22,代码来源:FileRepo.php

示例7: getForm

 /**
  * Generates the namespace selector form with hidden attributes.
  * @return string HTML fragment
  */
 protected function getForm()
 {
     $this->opts['title'] = $this->getPageTitle()->getPrefixedText();
     if (!isset($this->opts['target'])) {
         $this->opts['target'] = '';
     } else {
         $this->opts['target'] = str_replace('_', ' ', $this->opts['target']);
     }
     if (!isset($this->opts['namespace'])) {
         $this->opts['namespace'] = '';
     }
     if (!isset($this->opts['nsInvert'])) {
         $this->opts['nsInvert'] = '';
     }
     if (!isset($this->opts['associated'])) {
         $this->opts['associated'] = false;
     }
     if (!isset($this->opts['contribs'])) {
         $this->opts['contribs'] = 'user';
     }
     if (!isset($this->opts['year'])) {
         $this->opts['year'] = '';
     }
     if (!isset($this->opts['month'])) {
         $this->opts['month'] = '';
     }
     if ($this->opts['contribs'] == 'newbie') {
         $this->opts['target'] = '';
     }
     if (!isset($this->opts['tagfilter'])) {
         $this->opts['tagfilter'] = '';
     }
     if (!isset($this->opts['topOnly'])) {
         $this->opts['topOnly'] = false;
     }
     if (!isset($this->opts['newOnly'])) {
         $this->opts['newOnly'] = false;
     }
     if (!isset($this->opts['hideMinor'])) {
         $this->opts['hideMinor'] = false;
     }
     $form = Html::openElement('form', ['method' => 'get', 'action' => wfScript(), 'class' => 'mw-contributions-form']);
     # Add hidden params for tracking except for parameters in $skipParameters
     $skipParameters = ['namespace', 'nsInvert', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'newOnly', 'hideMinor', 'associated', 'tagfilter'];
     foreach ($this->opts as $name => $value) {
         if (in_array($name, $skipParameters)) {
             continue;
         }
         $form .= "\t" . Html::hidden($name, $value) . "\n";
     }
     $tagFilter = ChangeTags::buildTagFilterSelector($this->opts['tagfilter']);
     if ($tagFilter) {
         $filterSelection = Html::rawElement('div', [], implode('&#160;', $tagFilter));
     } else {
         $filterSelection = Html::rawElement('div', [], '');
     }
     $this->getOutput()->addModules('mediawiki.userSuggest');
     $labelNewbies = Xml::radioLabel($this->msg('sp-contributions-newbies')->text(), 'contribs', 'newbie', 'newbie', $this->opts['contribs'] == 'newbie', ['class' => 'mw-input']);
     $labelUsername = Xml::radioLabel($this->msg('sp-contributions-username')->text(), 'contribs', 'user', 'user', $this->opts['contribs'] == 'user', ['class' => 'mw-input']);
     $input = Html::input('target', $this->opts['target'], 'text', ['size' => '40', 'required' => '', 'class' => ['mw-input', 'mw-ui-input-inline', 'mw-autocomplete-user']] + ($this->opts['contribs'] === 'newbie' || $this->opts['target'] ? [] : ['autofocus' => true]));
     $targetSelection = Html::rawElement('div', [], $labelNewbies . '<br>' . $labelUsername . ' ' . $input . ' ');
     $namespaceSelection = Xml::tags('div', [], Xml::label($this->msg('namespace')->text(), 'namespace', '') . '&#160;' . Html::namespaceSelector(['selected' => $this->opts['namespace'], 'all' => ''], ['name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector']) . '&#160;' . Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('invert')->text(), 'nsInvert', 'nsInvert', $this->opts['nsInvert'], ['title' => $this->msg('tooltip-invert')->text(), 'class' => 'mw-input']) . '&#160;') . Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('namespace_association')->text(), 'associated', 'associated', $this->opts['associated'], ['title' => $this->msg('tooltip-namespace_association')->text(), 'class' => 'mw-input']) . '&#160;'));
     $filters = [];
     if ($this->getUser()->isAllowed('deletedhistory')) {
         $filters[] = Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('history-show-deleted')->text(), 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'], ['class' => 'mw-input']));
     }
     $filters[] = Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('sp-contributions-toponly')->text(), 'topOnly', 'mw-show-top-only', $this->opts['topOnly'], ['class' => 'mw-input']));
     $filters[] = Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('sp-contributions-newonly')->text(), 'newOnly', 'mw-show-new-only', $this->opts['newOnly'], ['class' => 'mw-input']));
     $filters[] = Html::rawElement('span', ['class' => 'mw-input-with-label'], Xml::checkLabel($this->msg('sp-contributions-hideminor')->text(), 'hideMinor', 'mw-hide-minor-edits', $this->opts['hideMinor'], ['class' => 'mw-input']));
     Hooks::run('SpecialContributions::getForm::filters', [$this, &$filters]);
     $extraOptions = Html::rawElement('div', [], implode('', $filters));
     $dateSelectionAndSubmit = Xml::tags('div', [], Xml::dateMenu($this->opts['year'] === '' ? MWTimestamp::getInstance()->format('Y') : $this->opts['year'], $this->opts['month']) . ' ' . Html::submitButton($this->msg('sp-contributions-submit')->text(), ['class' => 'mw-submit'], ['mw-ui-progressive']));
     $form .= Xml::fieldset($this->msg('sp-contributions-search')->text(), $targetSelection . $namespaceSelection . $filterSelection . $extraOptions . $dateSelectionAndSubmit, ['class' => 'mw-contributions-table']);
     $explain = $this->msg('sp-contributions-explain');
     if (!$explain->isBlank()) {
         $form .= "<p id='mw-sp-contributions-explain'>{$explain->parse()}</p>";
     }
     $form .= Xml::closeElement('form');
     return $form;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:84,代码来源:SpecialContributions.php

示例8: getDateCond

 /**
  * Set and return the mOffset timestamp such that we can get all revisions with
  * a timestamp up to the specified parameters.
  * @param int $year Year up to which we want revisions
  * @param int $month Month up to which we want revisions
  * @param int $day [optional] Day up to which we want revisions. Default is end of month.
  * @return string|null Timestamp or null if year and month are false/invalid
  */
 function getDateCond($year, $month, $day = -1)
 {
     $year = intval($year);
     $month = intval($month);
     $day = intval($day);
     // Basic validity checks for year and month
     $this->mYear = $year > 0 ? $year : false;
     $this->mMonth = $month > 0 && $month < 13 ? $month : false;
     // If year and month are false, don't update the mOffset
     if (!$this->mYear && !$this->mMonth) {
         return;
     }
     // Given an optional year, month, and day, we need to generate a timestamp
     // to use as "WHERE rev_timestamp <= result"
     // Examples: year = 2006      equals < 20070101 (+000000)
     // year=2005, month=1         equals < 20050201
     // year=2005, month=12        equals < 20060101
     // year=2005, month=12, day=5 equals < 20051206
     if ($this->mYear) {
         $year = $this->mYear;
     } else {
         // If no year given, assume the current one
         $timestamp = MWTimestamp::getInstance();
         $year = $timestamp->format('Y');
         // If this month hasn't happened yet this year, go back to last year's month
         if ($this->mMonth > $timestamp->format('n')) {
             $year--;
         }
     }
     if ($this->mMonth) {
         $month = $this->mMonth;
         // Day validity check after we have month and year checked
         $this->mDay = checkdate($month, $day, $year) ? $day : false;
         if ($this->mDay) {
             // If we have a day, we want up to the day immediately afterward
             $day = $this->mDay + 1;
             // Did we overflow the current month?
             if (!checkdate($month, $day, $year)) {
                 $day = 1;
                 $month++;
             }
         } else {
             // If no day, assume beginning of next month
             $day = 1;
             $month++;
         }
         // Did we overflow the current year?
         if ($month > 12) {
             $month = 1;
             $year++;
         }
     } else {
         // No month implies we want up to the end of the year in question
         $month = 1;
         $day = 1;
         $year++;
     }
     // Y2K38 bug
     if ($year > 2032) {
         $year = 2032;
     }
     $ymd = (int) sprintf("%04d%02d%02d", $year, $month, $day);
     if ($ymd > 20320101) {
         $ymd = 20320101;
     }
     // Treat the given time in the wiki timezone and get a UTC timestamp for the database lookup
     $timestamp = MWTimestamp::getInstance("{$ymd}000000");
     $timestamp->setTimezone($this->getConfig()->get('Localtimezone'));
     $this->mOffset = $this->mDb->timestamp($timestamp->getTimestamp());
     return $this->mOffset;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:79,代码来源:ReverseChronologicalPager.php

示例9: getForm

 /**
  * Generates the namespace selector form with hidden attributes.
  * @return string HTML fragment
  */
 protected function getForm()
 {
     $this->opts['title'] = $this->getPageTitle()->getPrefixedText();
     if (!isset($this->opts['target'])) {
         $this->opts['target'] = '';
     } else {
         $this->opts['target'] = str_replace('_', ' ', $this->opts['target']);
     }
     if (!isset($this->opts['namespace'])) {
         $this->opts['namespace'] = '';
     }
     if (!isset($this->opts['nsInvert'])) {
         $this->opts['nsInvert'] = '';
     }
     if (!isset($this->opts['associated'])) {
         $this->opts['associated'] = false;
     }
     if (!isset($this->opts['contribs'])) {
         $this->opts['contribs'] = 'user';
     }
     if (!isset($this->opts['year'])) {
         $this->opts['year'] = '';
     }
     if (!isset($this->opts['month'])) {
         $this->opts['month'] = '';
     }
     if ($this->opts['contribs'] == 'newbie') {
         $this->opts['target'] = '';
     }
     if (!isset($this->opts['tagfilter'])) {
         $this->opts['tagfilter'] = '';
     }
     if (!isset($this->opts['topOnly'])) {
         $this->opts['topOnly'] = false;
     }
     if (!isset($this->opts['newOnly'])) {
         $this->opts['newOnly'] = false;
     }
     $form = Html::openElement('form', array('method' => 'get', 'action' => wfScript(), 'class' => 'mw-contributions-form'));
     # Add hidden params for tracking except for parameters in $skipParameters
     $skipParameters = array('namespace', 'nsInvert', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly', 'newOnly', 'associated');
     foreach ($this->opts as $name => $value) {
         if (in_array($name, $skipParameters)) {
             continue;
         }
         $form .= "\t" . Html::hidden($name, $value) . "\n";
     }
     $tagFilter = ChangeTags::buildTagFilterSelector($this->opts['tagfilter']);
     if ($tagFilter) {
         $filterSelection = Html::rawElement('td', array('class' => 'mw-label'), array_shift($tagFilter));
         $filterSelection .= Html::rawElement('td', array('class' => 'mw-input'), implode('&#160', $tagFilter));
     } else {
         $filterSelection = Html::rawElement('td', array('colspan' => 2), '');
     }
     $labelNewbies = Xml::radioLabel($this->msg('sp-contributions-newbies')->text(), 'contribs', 'newbie', 'newbie', $this->opts['contribs'] == 'newbie', array('class' => 'mw-input'));
     $labelUsername = Xml::radioLabel($this->msg('sp-contributions-username')->text(), 'contribs', 'user', 'user', $this->opts['contribs'] == 'user', array('class' => 'mw-input'));
     $input = Html::input('target', $this->opts['target'], 'text', array('size' => '40', 'required' => '', 'class' => 'mw-input') + ($this->opts['target'] ? array() : array('autofocus')));
     $targetSelection = Html::rawElement('td', array('colspan' => 2), $labelNewbies . '<br />' . $labelUsername . ' ' . $input . ' ');
     $namespaceSelection = Xml::tags('td', array('class' => 'mw-label'), Xml::label($this->msg('namespace')->text(), 'namespace', ''));
     $namespaceSelection .= Html::rawElement('td', null, Html::namespaceSelector(array('selected' => $this->opts['namespace'], 'all' => ''), array('name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector')) . '&#160;' . Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('invert')->text(), 'nsInvert', 'nsInvert', $this->opts['nsInvert'], array('title' => $this->msg('tooltip-invert')->text(), 'class' => 'mw-input')) . '&#160;') . Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('namespace_association')->text(), 'associated', 'associated', $this->opts['associated'], array('title' => $this->msg('tooltip-namespace_association')->text(), 'class' => 'mw-input')) . '&#160;'));
     if ($this->getUser()->isAllowed('deletedhistory')) {
         $deletedOnlyCheck = Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('history-show-deleted')->text(), 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'], array('class' => 'mw-input')));
     } else {
         $deletedOnlyCheck = '';
     }
     $checkLabelTopOnly = Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('sp-contributions-toponly')->text(), 'topOnly', 'mw-show-top-only', $this->opts['topOnly'], array('class' => 'mw-input')));
     $checkLabelNewOnly = Html::rawElement('span', array('style' => 'white-space: nowrap'), Xml::checkLabel($this->msg('sp-contributions-newonly')->text(), 'newOnly', 'mw-show-new-only', $this->opts['newOnly'], array('class' => 'mw-input')));
     $extraOptions = Html::rawElement('td', array('colspan' => 2), $deletedOnlyCheck . $checkLabelTopOnly . $checkLabelNewOnly);
     $dateSelectionAndSubmit = Xml::tags('td', array('colspan' => 2), Xml::dateMenu($this->opts['year'] === '' ? MWTimestamp::getInstance()->format('Y') : $this->opts['year'], $this->opts['month']) . ' ' . Xml::submitButton($this->msg('sp-contributions-submit')->text(), array('class' => 'mw-submit')));
     $form .= Xml::fieldset($this->msg('sp-contributions-search')->text());
     $form .= Html::rawElement('table', array('class' => 'mw-contributions-table'), "\n" . Html::rawElement('tr', array(), $targetSelection) . "\n" . Html::rawElement('tr', array(), $namespaceSelection) . "\n" . Html::rawElement('tr', array(), $filterSelection) . "\n" . Html::rawElement('tr', array(), $extraOptions) . "\n" . Html::rawElement('tr', array(), $dateSelectionAndSubmit) . "\n");
     $explain = $this->msg('sp-contributions-explain');
     if (!$explain->isBlank()) {
         $form .= "<p id='mw-sp-contributions-explain'>{$explain->parse()}</p>";
     }
     $form .= Xml::closeElement('fieldset') . Xml::closeElement('form');
     return $form;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:82,代码来源:SpecialContributions.php


注:本文中的MWTimestamp::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。