• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP FormOptions类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __construct

 public function __construct(FormOptions $opts, Title $title)
 {
     $this->opts = $opts;
     $this->title = $title;
     $this->userMode = $opts->getValue('mode') === SpecialAPC::MODE_USER_CACHE;
     $this->fieldKey = $this->userMode ? 'info' : (ini_get('apc.stat') ? 'inode' : 'filename');
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:7,代码来源:APCCacheMode.php


示例2: execute

 /**
  * Generates feed's content
  *
  * @param ChannelFeed $feed ChannelFeed subclass object (generally the one returned
  *   by getFeedObject())
  * @param ResultWrapper $rows ResultWrapper object with rows in recentchanges table
  * @param int $lastmod Timestamp of the last item in the recentchanges table (only
  *   used for the cache key)
  * @param FormOptions $opts As in SpecialRecentChanges::getDefaultOptions()
  * @return null|bool True or null
  */
 public function execute($feed, $rows, $lastmod, $opts)
 {
     global $wgLang, $wgRenderHashAppend;
     if (!FeedUtils::checkFeedOutput($this->format)) {
         return null;
     }
     $optionsHash = md5(serialize($opts->getAllValues())) . $wgRenderHashAppend;
     $timekey = wfMemcKey($this->type, $this->format, $wgLang->getCode(), $optionsHash, 'timestamp');
     $key = wfMemcKey($this->type, $this->format, $wgLang->getCode(), $optionsHash);
     FeedUtils::checkPurge($timekey, $key);
     /**
      * Bumping around loading up diffs can be pretty slow, so where
      * possible we want to cache the feed output so the next visitor
      * gets it quick too.
      */
     $cachedFeed = $this->loadFromCache($lastmod, $timekey, $key);
     if (is_string($cachedFeed)) {
         wfDebug("RC: Outputting cached feed\n");
         $feed->httpHeaders();
         echo $cachedFeed;
     } else {
         wfDebug("RC: rendering new feed and caching it\n");
         ob_start();
         self::generateFeed($rows, $feed);
         $cachedFeed = ob_get_contents();
         ob_end_flush();
         $this->saveToCache($cachedFeed, $timekey, $key);
     }
     return true;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:41,代码来源:ChangesFeed.php


示例3: fromArrayCallback

 /**
  * Get options from array, applying callback to extract key and value.
  *
  * fromArrayCallback([$a, $b, $c], function($x){
  *   return [$x->key, $x->value];
  * });
  **/
 public static function fromArrayCallback(array $data, callable $callback)
 {
     $ret = new FormOptions();
     foreach ($data as $item) {
         list($value, $text) = $callback($item);
         $ret->add($value, $text);
     }
     return $ret;
 }
开发者ID:nitroxy,项目名称:php-forms,代码行数:16,代码来源:FormOptions.php


示例4: execute

 public function execute($par)
 {
     // Shortcut by using $par
     if ($par) {
         $this->getOutput()->redirect($this->getTitle()->getLinkURL(array('user' => $par)));
         return;
     }
     $this->setHeaders();
     $this->outputHeader();
     // Parse options
     $opt = new \FormOptions();
     $opt->add('user', '');
     $opt->add('delete', '');
     $opt->add('reason', '');
     $opt->fetchValuesFromRequest($this->getRequest());
     // Parse user
     $user = $opt->getValue('user');
     $userObj = \User::newFromName($user);
     $userExists = $userObj && $userObj->getId() !== 0;
     // If current task is delete and user is not allowed
     $canDoAdmin = $this->getUser()->isAllowed('avataradmin');
     if ($opt->getValue('delete')) {
         if (!$canDoAdmin) {
             throw new \PermissionsError('avataradmin');
         }
         // Delete avatar if the user exists
         if ($userExists) {
             if (Avatars::deleteAvatar($userObj)) {
                 global $wgAvatarLogInRC;
                 $logEntry = new \ManualLogEntry('avatar', 'delete');
                 $logEntry->setPerformer($this->getUser());
                 $logEntry->setTarget($userObj->getUserPage());
                 $logEntry->setComment($opt->getValue('reason'));
                 $logId = $logEntry->insert();
                 $logEntry->publish($logId, $wgAvatarLogInRC ? 'rcandudp' : 'udp');
             }
         }
     }
     $this->getOutput()->addModules(array('mediawiki.userSuggest'));
     $this->showForm($user);
     if ($userExists) {
         $haveAvatar = Avatars::hasAvatar($userObj);
         if ($haveAvatar) {
             $html = \Xml::tags('img', array('src' => Avatars::getLinkFor($user, 'original') . '&nocache&ver=' . dechex(time()), 'height' => 400), '');
             $html = \Xml::tags('p', array(), $html);
             $this->getOutput()->addHTML($html);
             // Add a delete button
             if ($canDoAdmin) {
                 $this->showDeleteForm($user);
             }
         } else {
             $this->getOutput()->addWikiMsg('viewavatar-noavatar');
         }
     } else {
         if ($user) {
             $this->getOutput()->addWikiMsg('viewavatar-nouser');
         }
     }
 }
开发者ID:nbdd0121,项目名称:MW-Avatar,代码行数:59,代码来源:SpecialView.php


示例5: __construct

 /**
  * @param IContextSource $context
  * @param FormOptions $opts
  */
 function __construct(IContextSource $context = null, FormOptions $opts)
 {
     parent::__construct($context);
     $this->RCMaxAge = $this->getConfig()->get('ActiveUserDays');
     $this->requestedUser = '';
     $un = $opts->getValue('username');
     if ($un != '') {
         $username = Title::makeTitleSafe(NS_USER, $un);
         if (!is_null($username)) {
             $this->requestedUser = $username->getText();
         }
     }
     if ($opts->getValue('hidebots') == 1) {
         $this->hideRights[] = 'bot';
     }
     if ($opts->getValue('hidesysops') == 1) {
         $this->hideGroups[] = 'sysop';
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:23,代码来源:ActiveUsersPager.php


示例6: execute

 /**
  * Show the special page
  *
  * @param string $par Parameter passed to the page or null
  */
 public function execute($par)
 {
     $out = $this->getOutput();
     $this->setHeaders();
     $this->outputHeader();
     $opts = new FormOptions();
     $opts->add('username', '');
     $opts->add('hidebots', false, FormOptions::BOOL);
     $opts->add('hidesysops', false, FormOptions::BOOL);
     $opts->fetchValuesFromRequest($this->getRequest());
     if ($par !== null) {
         $opts->setValue('username', $par);
     }
     // Mention the level of cache staleness...
     $cacheText = '';
     $dbr = wfGetDB(DB_SLAVE, 'recentchanges');
     $rcMax = $dbr->selectField('recentchanges', 'MAX(rc_timestamp)', '', __METHOD__);
     if ($rcMax) {
         $cTime = $dbr->selectField('querycache_info', 'qci_timestamp', ['qci_type' => 'activeusers'], __METHOD__);
         if ($cTime) {
             $secondsOld = wfTimestamp(TS_UNIX, $rcMax) - wfTimestamp(TS_UNIX, $cTime);
         } else {
             $rcMin = $dbr->selectField('recentchanges', 'MIN(rc_timestamp)');
             $secondsOld = time() - wfTimestamp(TS_UNIX, $rcMin);
         }
         if ($secondsOld > 0) {
             $cacheTxt = '<br>' . $this->msg('cachedspecial-viewing-cached-ttl')->durationParams($secondsOld);
         }
     }
     $pager = new ActiveUsersPager($this->getContext(), $opts);
     $usersBody = $pager->getBody();
     $days = $this->getConfig()->get('ActiveUserDays');
     $formDescriptor = ['username' => ['type' => 'user', 'name' => 'username', 'label-message' => 'activeusers-from'], 'hidebots' => ['type' => 'check', 'name' => 'hidebots', 'label-message' => 'activeusers-hidebots', 'default' => false], 'hidesysops' => ['type' => 'check', 'name' => 'hidesysops', 'label-message' => 'activeusers-hidesysops', 'default' => false]];
     $htmlForm = HTMLForm::factory('ooui', $formDescriptor, $this->getContext())->setIntro($this->msg('activeusers-intro')->numParams($days) . $cacheText)->setWrapperLegendMsg('activeusers')->setSubmitTextMsg('activeusers-submit')->setMethod('get')->prepareForm()->displayForm(false);
     if ($usersBody) {
         $out->addHTML($pager->getNavigationBar() . Html::rawElement('ul', [], $usersBody) . $pager->getNavigationBar());
     } else {
         $out->addWikiMsg('activeusers-noresult');
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:45,代码来源:SpecialActiveusers.php


示例7: execute

 public function execute($par)
 {
     $user = $this->getUser();
     if (!$this->userCanExecute($user)) {
         throw new \PermissionsError('commentadmin-restricted');
     }
     // Parse request
     $opt = new \FormOptions();
     $opt->add('user', '');
     $opt->add('page', '');
     $opt->add('filter', 'all');
     $opt->add('keyword', '');
     $opt->add('offset', '0');
     $opt->add('limit', '20');
     $opt->add('dir', '');
     $opt->fetchValuesFromRequest($this->getRequest());
     // Reset filter to all if it cannot be recognized
     $filter = $opt->getValue('filter');
     if (!in_array($filter, $this->getPossibleFilters())) {
         $filter = 'all';
     }
     $this->filter = $filter;
     // Set local variable
     $this->page = $opt->getValue('page');
     $this->user = $opt->getValue('user');
     $this->keyword = $opt->getValue('keyword');
     $this->offset = intval($opt->getValue('offset'));
     $this->limit = intval($opt->getValue('limit'));
     $this->revDir = $opt->getValue('dir') === 'prev';
     // Limit the max limit
     if ($this->limit >= 500) {
         $this->limit = 500;
     }
     global $wgScript;
     $this->setHeaders();
     $this->outputHeader();
     $output = $this->getOutput();
     $output->addModules('mediawiki.userSuggest');
     # This is used for user input field
     $output->addModules('ext.flowthread.manage');
     $this->showForm();
     $json = array();
     $res = $this->queryDatabase();
     $count = 0;
     foreach ($res as $row) {
         if ($count === $this->limit) {
             $this->haveMore = true;
             break;
         } else {
             $count++;
         }
         $post = Post::newFromDatabaseRow($row);
         $title = \Title::newFromId($row->flowthread_pageid);
         $json[] = array('id' => $post->id->getHex(), 'userid' => $post->userid, 'username' => $post->username, 'title' => $title ? $title->getPrefixedText() : null, 'text' => $post->text, 'timestamp' => $post->id->getTimestamp(), 'parentid' => $post->parentid ? $post->parentid->getHex() : '', 'like' => $post->getFavorCount(), 'report' => $post->getReportCount());
     }
     // Pager can only be generated after query
     $output->addHTML($this->getPager());
     $output->addJsConfigVars(array('commentfilter' => $this->filter, 'commentjson' => $json));
     if ($this->getUser()->isAllowed('commentadmin')) {
         $output->addJsConfigVars(array('commentadmin' => ''));
     }
     global $wgFlowThreadConfig;
     $output->addJsConfigVars(array('wgFlowThreadConfig' => array('Avatar' => $wgFlowThreadConfig['Avatar'], 'AnonymousAvatar' => $wgFlowThreadConfig['AnonymousAvatar'])));
 }
开发者ID:nbdd0121,项目名称:MW-FlowThread,代码行数:64,代码来源:Manage.php


示例8: setup

 public function setup()
 {
     global $wgRequest;
     $opts = new FormOptions();
     // Bind to the member variable
     $this->opts = $opts;
     $opts->add('mode', self::MODE_STATS);
     $opts->add('image', APCImages::IMG_NONE);
     $opts->add('clearcache', false);
     $opts->add('limit', 20);
     $opts->add('offset', 0);
     $opts->add('display', '');
     $opts->add('delete', '');
     $opts->add('sort', 'hits');
     $opts->add('sortdir', 0);
     $opts->add('scope', 'active');
     $opts->add('searchi', '');
     // MediaWiki captures search, ARGH!
     $opts->fetchValuesFromRequest($wgRequest);
     $opts->validateIntBounds('limit', 0, 5000);
     $opts->validateIntBounds('sortdir', 0, 1);
     $this->opts->consumeValues(array('display', 'clearcache', 'image'));
 }
开发者ID:namrenni,项目名称:mediawiki,代码行数:23,代码来源:SpecialAPC.php


示例9: setup

 protected function setup($par)
 {
     global $wgRequest, $wgUser;
     // Options
     $opts = new FormOptions();
     $this->opts = $opts;
     // bind
     $opts->add('page1', '');
     $opts->add('page2', '');
     $opts->add('rev1', '');
     $opts->add('rev2', '');
     $opts->add('action', '');
     // Set values
     $opts->fetchValuesFromRequest($wgRequest);
     $title1 = Title::newFromText($opts->getValue('page1'));
     $title2 = Title::newFromText($opts->getValue('page2'));
     if ($title1 && $title1->exists() && $opts->getValue('rev1') == '') {
         $pda = new Article($title1);
         $pdi = $pda->getID();
         $pdLastRevision = Revision::loadFromPageId(wfGetDB(DB_SLAVE), $pdi);
         $opts->setValue('rev1', $pdLastRevision->getId());
     } elseif ($opts->getValue('rev1') != '') {
         $pdrev = Revision::newFromId($opts->getValue('rev1'));
         if ($pdrev) {
             $opts->setValue('page1', $pdrev->getTitle()->getPrefixedText());
         }
     }
     if ($title2 && $title2->exists() && $opts->getValue('rev2') == '') {
         $pda = new Article($title2);
         $pdi = $pda->getID();
         $pdLastRevision = Revision::loadFromPageId(wfGetDB(DB_SLAVE), $pdi);
         $opts->setValue('rev2', $pdLastRevision->getId());
     } elseif ($opts->getValue('rev2') != '') {
         $pdrev = Revision::newFromId($opts->getValue('rev2'));
         if ($pdrev) {
             $opts->setValue('page2', $pdrev->getTitle()->getPrefixedText());
         }
     }
     // Store some objects
     $this->skin = $wgUser->getSkin();
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:41,代码来源:SpecialComparePages.php


示例10: draw

	/**
	 * Adds raw image data of the graph to the output.
	 * @param $opts FormOptions
	 */
	public function draw( FormOptions $opts ) {
		global $wgTranslatePHPlotFont, $wgLang;

		$width = $opts->getValue( 'width' );
		$height = $opts->getValue( 'height' );
		// Define the object
		$plot = new PHPlot( $width, $height );

		list( $legend, $resData ) = $this->getData( $opts );
		$count = count( $resData );
		$skip = intval( $count / ( $width / 60 ) - 1 );
		$i = $count;

		foreach ( $resData as $date => $edits ) {
			if ( $skip > 0 ) {
				if ( ( $count - $i ) % $skip !== 0 ) $date = '';
			}

			if ( strpos( $date, ';' ) !== false ) {
				list( , $date ) = explode( ';', $date, 2 );
			}

			array_unshift( $edits, $date );
			$data[] = $edits;
			$i--;
		}

		$font = FCFontFinder::find( $wgLang->getCode() );

		if ( $font ) {
			$plot->SetDefaultTTFont( $font );
		} else {
			$plot->SetDefaultTTFont( $wgTranslatePHPlotFont );
		}
		$plot->SetDataValues( $data );

		if ( $legend !== null ) {
			$plot->SetLegend( $legend );
		}

		$numberFont = FCFontFinder::find( 'en' );

		$plot->setFont( 'x_label', $numberFont, 8 );
		$plot->setFont( 'y_label', $numberFont, 8 );

		$yTitle = wfMsg( 'translate-stats-' . $opts['count'] );

		// Turn off X axis ticks and labels because they get in the way:
		$plot->SetYTitle( $yTitle );
		$plot->SetXTickLabelPos( 'none' );
		$plot->SetXTickPos( 'none' );
		$plot->SetXLabelAngle( 45 );


		$max = max( array_map( 'max', $resData ) );
		$max = self::roundToSignificant( $max, 1 );
		$max = round( $max, intval( -log( $max, 10 ) ) );

		$yTick = 10;
		while ( $max / $yTick > $height / 20 ) {
			$yTick *= 2;
		}

		// If we have very small case, ensure that there is at least one tick
		$yTick = min( $max, $yTick );
		$yTick = self::roundToSignificant( $yTick );
		$plot->SetYTickIncrement( $yTick );
		$plot->SetPlotAreaWorld( null, 0, null, $max );


		$plot->SetTransparentColor( 'white' );
		$plot->SetBackgroundColor( 'white' );

		// Draw it
		$plot->DrawGraph();
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:80,代码来源:SpecialTranslationStats.php


示例11: testAddIntegers

 public function testAddIntegers()
 {
     $this->object->add('one', 1);
     $this->object->add('negone', -1);
     $this->assertEquals(array('negone' => array('default' => -1, 'value' => null, 'consumed' => false, 'type' => FormOptions::INT), 'one' => array('default' => 1, 'value' => null, 'consumed' => false, 'type' => FormOptions::INT)), $this->object->getOptions());
 }
开发者ID:yusufchang,项目名称:app,代码行数:6,代码来源:FormOptionsInitializationTest.php


示例12: setup

 protected function setup($par)
 {
     global $wgRequest, $wgUser, $wgEnableNewpagesUserFilter;
     // Options
     $opts = new FormOptions();
     $this->opts = $opts;
     // bind
     $opts->add('hideliu', false);
     $opts->add('hidepatrolled', false);
     $opts->add('hidebots', false);
     $opts->add('hideredirs', true);
     $opts->add('limit', (int) $wgUser->getOption('rclimit'));
     $opts->add('offset', '');
     $opts->add('namespace', '0');
     $opts->add('username', '');
     $opts->add('feed', '');
     // Set values
     $opts->fetchValuesFromRequest($wgRequest);
     if ($par) {
         $this->parseParams($par);
     }
     // Validate
     $opts->validateIntBounds('limit', 0, 5000);
     if (!$wgEnableNewpagesUserFilter) {
         $opts->setValue('username', '');
     }
     // Store some objects
     $this->skin = $wgUser->getSkin();
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:29,代码来源:SpecialNewpages.php


示例13: setTopText

 function setTopText(FormOptions $opts)
 {
     $nondefaults = $opts->getChangedValues();
     $form = "";
     $user = $this->getUser();
     $dbr = $this->getDB();
     $numItems = $this->countItems($dbr);
     $showUpdatedMarker = $this->getConfig()->get('ShowUpdatedMarker');
     // Show watchlist header
     $form .= "<p>";
     if ($numItems == 0) {
         $form .= $this->msg('nowatchlist')->parse() . "\n";
     } else {
         $form .= $this->msg('watchlist-details')->numParams($numItems)->parse() . "\n";
         if ($this->getConfig()->get('EnotifWatchlist') && $user->getOption('enotifwatchlistpages')) {
             $form .= $this->msg('wlheader-enotif')->parse() . "\n";
         }
         if ($showUpdatedMarker) {
             $form .= $this->msg('wlheader-showupdated')->parse() . "\n";
         }
     }
     $form .= "</p>";
     if ($numItems > 0 && $showUpdatedMarker) {
         $form .= Xml::openElement('form', array('method' => 'post', 'action' => $this->getPageTitle()->getLocalURL(), 'id' => 'mw-watchlist-resetbutton')) . "\n" . Xml::submitButton($this->msg('enotif_reset')->text(), array('name' => 'dummy')) . "\n" . Html::hidden('reset', 'all') . "\n";
         foreach ($nondefaults as $key => $value) {
             $form .= Html::hidden($key, $value) . "\n";
         }
         $form .= Xml::closeElement('form') . "\n";
     }
     $form .= Xml::openElement('form', array('method' => 'get', 'action' => $this->getPageTitle()->getLocalURL(), 'id' => 'mw-watchlist-form'));
     $form .= Xml::fieldset($this->msg('watchlist-options')->text(), false, array('id' => 'mw-watchlist-options'));
     $form .= $this->makeLegend();
     $this->getOutput()->addHTML($form);
 }
开发者ID:admonkey,项目名称:mediawiki,代码行数:34,代码来源:SpecialWatchlist.php


示例14: buildMainQueryConds

 /**
  * Return an array of conditions depending of options set in $opts
  *
  * @param $opts FormOptions
  * @return array
  */
 public function buildMainQueryConds(FormOptions $opts)
 {
     global $wgUser;
     $dbr = wfGetDB(DB_SLAVE);
     $conds = array();
     # It makes no sense to hide both anons and logged-in users
     # Where this occurs, force anons to be shown
     $forcebot = false;
     if ($opts['hideanons'] && $opts['hideliu']) {
         # Check if the user wants to show bots only
         if ($opts['hidebots']) {
             $opts['hideanons'] = false;
         } else {
             $forcebot = true;
             $opts['hidebots'] = false;
         }
     }
     // Calculate cutoff
     $cutoff_unixtime = time() - $opts['days'] * 86400;
     $cutoff_unixtime = $cutoff_unixtime - $cutoff_unixtime % 86400;
     $cutoff = $dbr->timestamp($cutoff_unixtime);
     $fromValid = preg_match('/^[0-9]{14}$/', $opts['from']);
     if ($fromValid && $opts['from'] > wfTimestamp(TS_MW, $cutoff)) {
         $cutoff = $dbr->timestamp($opts['from']);
     } else {
         $opts->reset('from');
     }
     $conds[] = 'rc_timestamp >= ' . $dbr->addQuotes($cutoff);
     // Selected product changes
     $product = addslashes(isset($_GET['product']) ? $_GET['product'] : PonyDocsProduct::GetSelectedProduct());
     $conds[] = 'rc_title LIKE "' . $product . '%"';
     $hidePatrol = $wgUser->useRCPatrol() && $opts['hidepatrolled'];
     $hideLoggedInUsers = $opts['hideliu'] && !$forcebot;
     $hideAnonymousUsers = $opts['hideanons'] && !$forcebot;
     if ($opts['hideminor']) {
         $conds['rc_minor'] = 0;
     }
     if ($opts['hidebots']) {
         $conds['rc_bot'] = 0;
     }
     if ($hidePatrol) {
         $conds['rc_patrolled'] = 0;
     }
     if ($forcebot) {
         $conds['rc_bot'] = 1;
     }
     if ($hideLoggedInUsers) {
         $conds[] = 'rc_user = 0';
     }
     if ($hideAnonymousUsers) {
         $conds[] = 'rc_user != 0';
     }
     if ($opts['hidemyself']) {
         if ($wgUser->getId()) {
             $conds[] = 'rc_user != ' . $dbr->addQuotes($wgUser->getId());
         } else {
             $conds[] = 'rc_user_text != ' . $dbr->addQuotes($wgUser->getName());
         }
     }
     # Namespace filtering
     if ($opts['namespace'] !== '') {
         if (!$opts['invert']) {
             $conds[] = 'rc_namespace = ' . $dbr->addQuotes($opts['namespace']);
         } else {
             $conds[] = 'rc_namespace != ' . $dbr->addQuotes($opts['namespace']);
         }
     }
     return $conds;
 }
开发者ID:Velody,项目名称:ponydocs,代码行数:75,代码来源:SpecialRecentProductChanges.php


示例15: buildMainQueryConds

 /**
  * Return an array of conditions depending of options set in $opts
  *
  * @param FormOptions $opts
  * @return array
  */
 public function buildMainQueryConds(FormOptions $opts)
 {
     $dbr = wfGetDB(DB_SLAVE);
     $conds = array();
     # It makes no sense to hide both anons and logged-in users
     # Where this occurs, force anons to be shown
     $forcebot = false;
     if ($opts['hideanons'] && $opts['hideliu']) {
         # Check if the user wants to show bots only
         if ($opts['hidebots']) {
             $opts['hideanons'] = false;
         } else {
             $forcebot = true;
             $opts['hidebots'] = false;
         }
     }
     // Calculate cutoff
     $cutoff_unixtime = time() - $opts['days'] * 86400;
     $cutoff_unixtime = $cutoff_unixtime - $cutoff_unixtime % 86400;
     $cutoff = $dbr->timestamp($cutoff_unixtime);
     $fromValid = preg_match('/^[0-9]{14}$/', $opts['from']);
     if ($fromValid && $opts['from'] > wfTimestamp(TS_MW, $cutoff)) {
         $cutoff = $dbr->timestamp($opts['from']);
     } else {
         $opts->reset('from');
     }
     $conds[] = 'rc_timestamp >= ' . $dbr->addQuotes($cutoff);
     $hidePatrol = $this->getUser()->useRCPatrol() && $opts['hidepatrolled'];
     $hideLoggedInUsers = $opts['hideliu'] && !$forcebot;
     $hideAnonymousUsers = $opts['hideanons'] && !$forcebot;
     if ($opts['hideminor']) {
         $conds['rc_minor'] = 0;
     }
     if ($opts['hidebots']) {
         $conds['rc_bot'] = 0;
     }
     if ($hidePatrol) {
         $conds['rc_patrolled'] = 0;
     }
     if ($forcebot) {
         $conds['rc_bot'] = 1;
     }
     if ($hideLoggedInUsers) {
         $conds[] = 'rc_user = 0';
     }
     if ($hideAnonymousUsers) {
         $conds[] = 'rc_user != 0';
     }
     if ($opts['hidemyself']) {
         if ($this->getUser()->getId()) {
             $conds[] = 'rc_user != ' . $dbr->addQuotes($this->getUser()->getId());
         } else {
             $conds[] = 'rc_user_text != ' . $dbr->addQuotes($this->getUser()->getName());
         }
     }
     # Namespace filtering
     if ($opts['namespace'] !== '') {
         $selectedNS = $dbr->addQuotes($opts['namespace']);
         $operator = $opts['invert'] ? '!=' : '=';
         $boolean = $opts['invert'] ? 'AND' : 'OR';
         # namespace association (bug 2429)
         if (!$opts['associated']) {
             $condition = "rc_namespace {$operator} {$selectedNS}";
         } else {
             # Also add the associated namespace
             $associatedNS = $dbr->addQuotes(MWNamespace::getAssociated($opts['namespace']));
             $condition = "(rc_namespace {$operator} {$selectedNS} " . $boolean . " rc_namespace {$operator} {$associatedNS})";
         }
         $conds[] = $condition;
     }
     return $conds;
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:78,代码来源:SpecialRecentchanges.php


示例16: getExtraOptions

 /**
  * Get options to be displayed in a form
  *
  * @param FormOptions $opts
  * @return array
  */
 function getExtraOptions($opts)
 {
     $opts->consumeValues(array('namespace', 'invert', 'associated', 'tagfilter', 'categories', 'categories_any'));
     $extraOpts = array();
     $extraOpts['namespace'] = $this->namespaceFilterForm($opts);
     if ($this->getConfig()->get('AllowCategorizedRecentChanges')) {
         $extraOpts['category'] = $this->categoryFilterForm($opts);
     }
     $tagFilter = ChangeTags::buildTagFilterSelector($opts['tagfilter']);
     if (count($tagFilter)) {
         $extraOpts['tagfilter'] = $tagFilter;
     }
     // Don't fire the hook for subclasses. (Or should we?)
     if ($this->getName() === 'Recentchanges') {
         Hooks::run('SpecialRecentChangesPanel', array(&$extraOpts, $opts));
     }
     return $extraOpts;
 }
开发者ID:mb720,项目名称:mediawiki,代码行数:24,代码来源:SpecialRecentchanges.php


示例17: show

 private function show(FormOptions $opts, array $extraConds)
 {
     # Create a LogPager item to get the results and a LogEventsList item to format them...
     $loglist = new LogEventsList($this->getContext(), null, LogEventsList::USE_REVDEL_CHECKBOXES);
     $pager = new LogPager($loglist, $opts->getValue('type'), $opts->getValue('user'), $opts->getValue('page'), $opts->getValue('pattern'), $extraConds, $opts->getValue('year'), $opts->getValue('month'), $opts->getValue('tagfilter'));
     $this->addHeader($opts->getValue('type'));
     # Set relevant user
     if ($pager->getPerformer()) {
         $this->getSkin()->setRelevantUser(User::newFromName($pager->getPerformer()));
     }
     # Show form options
     $loglist->showOptions($pager->getType(), $opts->getValue('user'), $pager->getPage(), $pager->getPattern(), $pager->getYear(), $pager->getMonth(), $pager->getFilterParams(), $opts->getValue('tagfilter'));
     # Insert list
     $logBody = $pager->getBody();
     if ($logBody) {
         $this->getOutput()->addHTML($pager->getNavigationBar() . $this->getRevisionButton($loglist->beginLogEventsList() . $logBody . $loglist->endLogEventsList()) . $pager->getNavigationBar());
     } else {
         $this->getOutput()->addWikiMsg('logempty');
     }
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:20,代码来源:SpecialLog.php


示例18: fetchOptionsFromRequest

 /**
  * Fetch values for a FormOptions object from the WebRequest associated with this instance.
  *
  * Intended for subclassing, e.g. to add a backwards-compatibility layer.
  *
  * @param FormOptions $opts
  * @return FormOptions
  */
 protected function fetchOptionsFromRequest($opts)
 {
     $opts->fetchValuesFromRequest($this->getRequest());
     return $opts;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:13,代码来源:ChangesListSpecialPage.php


示例19: execute

 function execute()
 {
     global $wgOut;
     $opts = new FormOptions();
     $opts->add('target', '');
     $opts->add('namespace', '', FormOptions::INTNULL);
     $opts->add('limit', 50);
     $opts->add('from', 0);
     $opts->add('back', 0);
     $opts->add('hideredirs', false);
     $opts->add('hidetrans', false);
     $opts->add('hidelinks', false);
     $opts->add('hideimages', false);
     $opts->fetchValuesFromRequest($this->request);
     $opts->validateIntBounds('limit', 0, 5000);
     // Give precedence to subpage syntax
     if (isset($this->par)) {
         $opts->setValue('target', $this->par);
     }
     // Bind to member variable
     $this->opts = $opts;
     $this->target = Title::newFromURL($opts->getValue('target'));
     if (!$this->target) {
         $wgOut->addHTML($this->whatlinkshereForm());
         return;
     }
     $this->selfTitle = SpecialPage::getTitleFor('Whatlinkshere', $this->target->getPrefixedDBkey());
     $wgOut->setPageTitle(wfMsg('whatlinkshere-title', $this->target->getPrefixedText()));
     $wgOut->setSubtitle(wfMsg('whatlinkshere-backlink', $this->skin->link($this->target, $this->target->getPrefixedText(), array(), array('redirect' => 'no'))));
     $this->showIndirectLinks(0, $this->target, $opts->getValue('limit'), $opts->getValue('from'), $opts->getValue('back'));
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:31,代码来源:SpecialWhatlinkshere.php


示例20: show

 private function show(FormOptions $opts, array $extraConds)
 {
     global $wgOut;
     # Create a LogPager item to get the results and a LogEventsList item to format them...
     $loglist = new LogEventsList($this->getSkin(), $wgOut, 0);
     $pager = new LogPager($loglist, $opts->getValue('type'), $opts->getValue('user'), $opts->getValue('page'), $opts->getValue('pattern'), $extraConds, $opts->getValue('year'), $opts->getValue('month'), $opts->getValue('tagfilter'));
     # Set title and add header
     $loglist->showHeader($pager->getType());
     # Set relevant user
     if ($pager->getUser()) {
         $this->getSkin()->setRelevantUser(User::newFromName($pager->getUser()));
     }
     # Show form options
     $loglist->showOptions($pager->getType(), $pager->getUser(), $pager->getPage(), $pager->getPattern(), $pager->getYear(), $pager->getMonth(), $pager->getFilterParams(), $opts->getValue('tagfilter'));
     # Insert list
     $logBody = $pager->getBody();
     if ($logBody) {
         $wgOut->addHTML($pager->getNavigationBar() . $loglist->beginLogEventsList() . $logBody . $loglist->endLogEventsList() . $pager->getNavigationBar());
     } else {
         $wgOut->addWikiMsg('logempty');
     }
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:22,代码来源:SpecialLog.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP FormOther类代码示例发布时间:2022-05-23
下一篇:
PHP FormMail类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap