本文整理汇总了PHP中FormOptions::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP FormOptions::getValue方法的具体用法?PHP FormOptions::getValue怎么用?PHP FormOptions::getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormOptions
的用法示例。
在下文中一共展示了FormOptions::getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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'));
}
示例2: 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');
}
}
}
示例3: buildForm
protected function buildForm()
{
$formDescriptor = ['like' => ['type' => 'text', 'label-message' => 'newimages-label', 'name' => 'like'], 'showbots' => ['type' => 'check', 'label-message' => 'newimages-showbots', 'name' => 'showbots'], 'hidepatrolled' => ['type' => 'check', 'label-message' => 'newimages-hidepatrolled', 'name' => 'hidepatrolled'], 'limit' => ['type' => 'hidden', 'default' => $this->opts->getValue('limit'), 'name' => 'limit'], 'offset' => ['type' => 'hidden', 'default' => $this->opts->getValue('offset'), 'name' => 'offset']];
if ($this->getConfig()->get('MiserMode')) {
unset($formDescriptor['like']);
}
if (!$this->getUser()->useFilePatrol()) {
unset($formDescriptor['hidepatrolled']);
}
$form = HTMLForm::factory('ooui', $formDescriptor, $this->getContext())->setWrapperLegendMsg('newimages-legend')->setSubmitTextMsg('ilsubmit')->setMethod('get')->prepareForm()->displayForm(false);
}
示例4: __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');
}
示例5: getPageHeader
function getPageHeader() {
global $wgScript;
$self = $this->getTitle();
$limit = $this->mLimit ? Html::hidden( 'limit', $this->mLimit ) : '';
$out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); # Form tag
$out .= Xml::fieldset( $this->msg( 'activeusers' )->text() ) . "\n";
$out .= Html::hidden( 'title', $self->getPrefixedDBkey() ) . $limit . "\n";
$out .= Xml::inputLabel( $this->msg( 'activeusers-from' )->text(),
'username', 'offset', 20, $this->requestedUser, array( 'tabindex' => 1 ) ) . '<br />';# Username field
$out .= Xml::checkLabel( $this->msg( 'activeusers-hidebots' )->text(),
'hidebots', 'hidebots', $this->opts->getValue( 'hidebots' ), array( 'tabindex' => 2 ) );
$out .= Xml::checkLabel( $this->msg( 'activeusers-hidesysops' )->text(),
'hidesysops', 'hidesysops', $this->opts->getValue( 'hidesysops' ), array( 'tabindex' => 3 ) ) . '<br />';
$out .= Xml::submitButton( $this->msg( 'allpagessubmit' )->text(), array( 'tabindex' => 4 ) ) . "\n";# Submit button and form bottom
$out .= Xml::closeElement( 'fieldset' );
$out .= Xml::closeElement( 'form' );
return $out;
}
示例6: formatRevisionRow
function formatRevisionRow($row)
{
$rev = new Revision($row);
$stxt = '';
$last = $this->msg('last')->escaped();
$ts = wfTimestamp(TS_MW, $row->rev_timestamp);
$checkBox = Xml::radio('mergepoint', $ts, $this->mOpts->getValue('mergepoint') === $ts);
$user = $this->getUser();
$pageLink = Linker::linkKnown($rev->getTitle(), htmlspecialchars($this->getLanguage()->userTimeAndDate($ts, $user)), [], ['oldid' => $rev->getId()]);
if ($rev->isDeleted(Revision::DELETED_TEXT)) {
$pageLink = '<span class="history-deleted">' . $pageLink . '</span>';
}
# Last link
if (!$rev->userCan(Revision::DELETED_TEXT, $user)) {
$last = $this->msg('last')->escaped();
} elseif (isset($this->prevId[$row->rev_id])) {
$last = Linker::linkKnown($rev->getTitle(), $this->msg('last')->escaped(), [], ['diff' => $row->rev_id, 'oldid' => $this->prevId[$row->rev_id]]);
}
$userLink = Linker::revUserTools($rev);
$size = $row->rev_len;
if (!is_null($size)) {
$stxt = Linker::formatRevisionSize($size);
}
$comment = Linker::revComment($rev);
return Html::rawElement('li', [], $this->msg('mergehistory-revisionrow')->rawParams($checkBox, $last, $pageLink, $userLink, $stxt, $comment)->escaped());
}
示例7: feed
/**
* Output a subscription feed listing recent edits to this page.
*
* @param $type String
*/
protected function feed( $type ) {
global $wgFeed, $wgFeedClasses, $wgFeedLimit;
if ( !$wgFeed ) {
$this->getOutput()->addWikiMsg( 'feed-unavailable' );
return;
}
if ( !isset( $wgFeedClasses[$type] ) ) {
$this->getOutput()->addWikiMsg( 'feed-invalid' );
return;
}
$feed = new $wgFeedClasses[$type](
$this->feedTitle(),
$this->msg( 'tagline' )->text(),
$this->getTitle()->getFullURL()
);
$pager = new NewPagesPager( $this, $this->opts );
$limit = $this->opts->getValue( 'limit' );
$pager->mLimit = min( $limit, $wgFeedLimit );
$feed->outHeader();
if ( $pager->getNumRows() > 0 ) {
foreach ( $pager->mResult as $row ) {
$feed->outItem( $this->feedItem( $row ) );
}
}
$feed->outFooter();
}
示例8:
/**
* @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';
}
}
示例9: messageSelector
protected function messageSelector()
{
$nondefaults = $this->opts->getChangedValues();
$output = Html::openElement('div', array('class' => 'row tux-messagetable-header'));
$output .= Html::openElement('div', array('class' => 'nine columns'));
$output .= Html::openElement('ul', array('class' => 'row tux-message-selector'));
$tabs = array('default' => '', 'translated' => 'translated', 'untranslated' => 'untranslated');
$ellipsisOptions = array('outdated' => 'fuzzy');
$selected = $this->opts->getValue('filter');
$keys = array_keys($tabs);
if (in_array($selected, array_values($ellipsisOptions))) {
$key = $keys[count($keys) - 1];
$ellipsisOptions = array($key => $tabs[$key]);
// Remove the last tab
unset($tabs[$key]);
$tabs = array_merge($tabs, array('outdated' => $selected));
} elseif (!in_array($selected, array_values($tabs))) {
$selected = '';
}
$container = Html::openElement('ul', array('class' => 'column tux-message-selector'));
foreach ($ellipsisOptions as $optKey => $optValue) {
$container .= $this->ellipsisSelector($optKey, $optValue);
}
$sourcelanguage = $this->opts->getValue('sourcelanguage');
$sourcelanguage = TranslateUtils::getLanguageName($sourcelanguage);
foreach ($tabs as $tab => $filter) {
// Messages for grepping:
// tux-sst-default
// tux-sst-translated
// tux-sst-untranslated
// tux-sst-outdated
$tabClass = "tux-sst-{$tab}";
$taskParams = array('filter' => $filter) + $nondefaults;
ksort($taskParams);
$href = $this->getTitle()->getLocalUrl($taskParams);
if ($tab === 'default') {
$link = Html::element('a', array('href' => $href), $this->msg($tabClass)->text());
} else {
$link = Html::element('a', array('href' => $href), $this->msg($tabClass, $sourcelanguage)->text());
}
if ($selected === $filter) {
$tabClass = $tabClass . ' selected';
}
$output .= Html::rawElement('li', array('class' => array('column', $tabClass), 'data-filter' => $filter, 'data-title' => $tab), $link);
}
// More column
$output .= Html::openElement('li', array('class' => 'column more')) . '...' . $container . Html::closeElement('li');
$output .= Html::closeElement('ul');
$output .= Html::closeElement('div');
$output .= Html::closeElement('div');
return $output;
}
示例10: 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();
}
示例11: doPage
protected function doPage()
{
global $wgOut;
$wgOut->addHTML(Xml::openElement('div', array('class' => 'mw-apc-content')));
switch ($this->opts->getValue('mode')) {
case self::MODE_STATS:
$this->doObHostStats();
break;
case self::MODE_SYSTEM_CACHE:
case self::MODE_USER_CACHE:
$mode = new APCCacheMode($this->opts, $this->title);
$mode->cacheView();
break;
case self::MODE_VERSION_CHECK:
$this->versionCheck();
break;
}
$wgOut->addHTML(Xml::closeElement('div'));
}
示例12: getPageHeader
function getPageHeader()
{
$self = $this->getTitle();
$limit = $this->mLimit ? Html::hidden('limit', $this->mLimit) : '';
# Form tag
$out = Xml::openElement('form', array('method' => 'get', 'action' => wfScript()));
$out .= Xml::fieldset($this->msg('activeusers')->text()) . "\n";
$out .= Html::hidden('title', $self->getPrefixedDBkey()) . $limit . "\n";
# Username field (with autocompletion support)
$this->getOutput()->addModules('mediawiki.userSuggest');
$out .= Xml::inputLabel($this->msg('activeusers-from')->text(), 'username', 'offset', 20, $this->requestedUser, array('class' => 'mw-ui-input-inline mw-autocomplete-user', 'tabindex' => 1, 'autofocus' => $this->requestedUser === '')) . '<br />';
$out .= Xml::checkLabel($this->msg('activeusers-hidebots')->text(), 'hidebots', 'hidebots', $this->opts->getValue('hidebots'), array('tabindex' => 2));
$out .= Xml::checkLabel($this->msg('activeusers-hidesysops')->text(), 'hidesysops', 'hidesysops', $this->opts->getValue('hidesysops'), array('tabindex' => 3)) . '<br />';
# Submit button and form bottom
$out .= Xml::submitButton($this->msg('activeusers-submit')->text(), array('tabindex' => 4)) . "\n";
$out .= Xml::closeElement('fieldset');
$out .= Xml::closeElement('form');
return $out;
}
示例13: getFilterPanel
/**
* Create filter panel
*
* @return string HTML fieldset and filter panel with the show/hide links
*/
function getFilterPanel()
{
$show = wfMsgHtml('show');
$hide = wfMsgHtml('hide');
$changed = $this->opts->getChangedValues();
unset($changed['target']);
// Already in the request title
$links = array();
$types = array('hidetrans', 'hidelinks', 'hideredirs');
if ($this->target->getNamespace() == NS_FILE) {
$types[] = 'hideimages';
}
// Combined message keys: 'whatlinkshere-hideredirs', 'whatlinkshere-hidetrans', 'whatlinkshere-hidelinks', 'whatlinkshere-hideimages'
// To be sure they will be find by grep
foreach ($types as $type) {
$chosen = $this->opts->getValue($type);
$msg = $chosen ? $show : $hide;
$overrides = array($type => !$chosen);
$links[] = wfMsgHtml("whatlinkshere-{$type}", $this->makeSelfLink($msg, array_merge($changed, $overrides)));
}
return Xml::fieldset(wfMsg('whatlinkshere-filters'), $this->getLanguage()->pipeList($links));
}
示例14: 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');
}
}
示例15: 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'));
# Reuben, upgrade 1.23: apply a special hack where we insert FORCE INDEX (times)
# into the sql query, because Mysql chooses the wrong index and the Database
# class has a bug where it generates sql with syntax errors.
if (!$pager->getType() && !$opts->getValue('user') && !$pager->getPage()) {
$pager->setIndexHack();
}
# 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');
}
}