本文整理汇总了PHP中Preferences::getFormObject方法的典型用法代码示例。如果您正苦于以下问题:PHP Preferences::getFormObject方法的具体用法?PHP Preferences::getFormObject怎么用?PHP Preferences::getFormObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preferences
的用法示例。
在下文中一共展示了Preferences::getFormObject方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
$out->disallowUserJs();
# Prevent hijacked user scripts from sniffing passwords etc.
$user = $this->getUser();
if ($user->isAnon()) {
$out->showErrorPage('prefsnologin', 'prefsnologintext', array($this->getTitle()->getPrefixedDBkey()));
return;
}
$this->checkReadOnly();
if ($par == 'reset') {
$this->showResetForm();
return;
}
$out->addModules('mediawiki.special.preferences');
/* Wikia change begin - @author: macbre */
/* Enable custom notifications handling */
wfRunHooks('SpecialPreferencesOnRender', array(&$this));
/* Wikia change end */
if ($this->getRequest()->getCheck('success')) {
$out->wrapWikiMsg("<div class=\"successbox\"><strong>\n\$1\n</strong></div><div id=\"mw-pref-clear\"></div>", 'savedprefs');
}
if ($this->getRequest()->getCheck('eauth')) {
$out->wrapWikiMsg("<div class='error' style='clear: both;'>\n\$1</div>", 'eauthentsent', $user->getName());
}
$htmlForm = Preferences::getFormObject($user, $this->getContext());
$htmlForm->setSubmitCallback(array('Preferences', 'tryUISubmit'));
$htmlForm->show();
}
示例2: execute
public function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
$out->disallowUserJs();
# Prevent hijacked user scripts from sniffing passwords etc.
$this->requireLogin('prefsnologintext2');
$this->checkReadOnly();
if ($par == 'reset') {
$this->showResetForm();
return;
}
$out->addModules('mediawiki.special.preferences');
$out->addModuleStyles('mediawiki.special.preferences.styles');
if ($this->getRequest()->getCheck('success')) {
$out->wrapWikiMsg(Html::rawElement('div', array('class' => 'mw-preferences-messagebox successbox', 'id' => 'mw-preferences-success'), Html::element('p', array(), '$1')), 'savedprefs');
}
$this->addHelpLink('Help:Preferences');
// Load the user from the master to reduce CAS errors on double post (T95839)
$user = $this->getUser()->getInstanceForUpdate() ?: $this->getUser();
$htmlForm = Preferences::getFormObject($user, $this->getContext());
$htmlForm->setSubmitCallback(array('Preferences', 'tryUISubmit'));
$sectionTitles = $htmlForm->getPreferenceSections();
$prefTabs = '';
foreach ($sectionTitles as $key) {
$prefTabs .= Html::rawElement('li', array('role' => 'presentation', 'class' => $key === 'personal' ? 'selected' : null), Html::rawElement('a', array('id' => 'preftab-' . $key, 'role' => 'tab', 'href' => '#mw-prefsection-' . $key, 'aria-controls' => 'mw-prefsection-' . $key, 'aria-selected' => $key === 'personal' ? 'true' : 'false', 'tabIndex' => $key === 'personal' ? 0 : -1), $htmlForm->getLegend($key)));
}
$out->addHTML(Html::rawElement('ul', array('id' => 'preftoc', 'role' => 'tablist'), $prefTabs));
$htmlForm->show();
}
示例3: execute
function execute($par)
{
global $wgOut, $wgUser, $wgRequest;
$this->setHeaders();
$this->outputHeader();
$wgOut->disallowUserJs();
# Prevent hijacked user scripts from sniffing passwords etc.
if ($wgUser->isAnon()) {
$wgOut->showErrorPage('prefsnologin', 'prefsnologintext', array($this->getTitle()->getPrefixedDBkey()));
return;
}
if (wfReadOnly()) {
$wgOut->readOnlyPage();
return;
}
if ($par == 'reset') {
$this->showResetForm();
return;
}
$wgOut->addModules('mediawiki.legacy.prefs');
$wgOut->addModules('mediawiki.special.preferences');
if ($wgRequest->getCheck('success')) {
$wgOut->wrapWikiMsg("<div class=\"successbox\"><strong>\n\$1\n</strong></div><div id=\"mw-pref-clear\"></div>", 'savedprefs');
}
if ($wgRequest->getCheck('eauth')) {
$wgOut->wrapWikiMsg("<div class='error' style='clear: both;'>\n\$1\n</div>", 'eauthentsent', $wgUser->getName());
}
$htmlForm = Preferences::getFormObject($wgUser);
$htmlForm->setSubmitCallback(array('Preferences', 'tryUISubmit'));
$htmlForm->show();
}
示例4: execute
public function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
$out->disallowUserJs();
# Prevent hijacked user scripts from sniffing passwords etc.
$user = $this->getUser();
if ($user->isAnon()) {
$out->showErrorPage('prefsnologin', 'prefsnologintext', array($this->getTitle()->getPrefixedDBkey()));
return;
}
$this->checkReadOnly();
if ($par == 'reset') {
$this->showResetForm();
return;
}
$out->addModules('mediawiki.special.preferences');
if ($this->getRequest()->getCheck('success')) {
$out->wrapWikiMsg("<div class=\"successbox\"><strong>\n\$1\n</strong></div><div id=\"mw-pref-clear\"></div>", 'savedprefs');
}
$htmlForm = Preferences::getFormObject($user, $this->getContext());
$htmlForm->setSubmitCallback(array('Preferences', 'tryUISubmit'));
$htmlForm->show();
}
示例5: execute
function execute($par)
{
$user = $this->getUser();
$out = $this->getOutput();
if (!$user->isAllowed('edituser')) {
$out->permissionRequired('edituser');
return false;
}
$this->setHeaders();
$request = $this->getRequest();
$this->target = isset($par) ? $par : $request->getText('username', '');
if ($this->target === '') {
$out->addHtml($this->makeSearchForm());
return;
}
$targetuser = User::NewFromName($this->target);
if ($targetuser->getID() == 0) {
$out->addWikiMsg('edituser-nouser', htmlspecialchars($this->target));
return;
}
$this->targetuser = $targetuser;
#Allow editing self via this interface
if ($targetuser->isAllowed('edituser-exempt') && $targetuser->getName() != $user->getName()) {
$out->addWikiMsg('edituser-exempt', $targetuser->getName());
return;
}
$this->setHeaders();
$this->outputHeader();
$out->disallowUserJs();
# Prevent hijacked user scripts from sniffing passwords etc.
if (wfReadOnly()) {
$out->readOnlyPage();
return;
}
if ($request->getCheck('reset')) {
$this->showResetForm();
return;
}
$out->addModules('mediawiki.special.preferences');
//$this->loadGlobals( $this->target );
$out->addHtml($this->makeSearchForm() . '<br />');
#End EditUser additions
if ($request->getCheck('success')) {
$out->wrapWikiMsg("<div class=\"successbox\"><strong>\n\$1\n</strong></div><div id=\"mw-pref-clear\"></div>", 'savedprefs');
}
if ($request->getCheck('eauth')) {
$out->wrapWikiMsg("<div class='error' style='clear: both;'>\n\$1\n</div>", 'eauthentsent', $this->target);
}
$htmlForm = Preferences::getFormObject($targetuser, $this->getContext(), 'EditUserPreferencesForm', array('password'));
$htmlForm->setSubmitCallback('Preferences::tryUISubmit');
$htmlForm->addHiddenField('username', $this->target);
$htmlForm->show();
}
示例6: execute
public function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
$out->disallowUserJs();
# Prevent hijacked user scripts from sniffing passwords etc.
$this->requireLogin('prefsnologintext2');
$this->checkReadOnly();
if ($par == 'reset') {
$this->showResetForm();
return;
}
$out->addModules('mediawiki.special.preferences');
if ($this->getRequest()->getCheck('success')) {
$out->wrapWikiMsg("<div class=\"successbox\">\n\$1\n</div>", 'savedprefs');
}
$htmlForm = Preferences::getFormObject($this->getUser(), $this->getContext());
$htmlForm->setSubmitCallback(array('Preferences', 'tryUISubmit'));
$htmlForm->show();
}
示例7: execute
public function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
$out->disallowUserJs();
# Prevent hijacked user scripts from sniffing passwords etc.
$this->requireLogin('prefsnologintext2');
$this->checkReadOnly();
if ($par == 'reset') {
$this->showResetForm();
return;
}
$out->addModules('mediawiki.special.preferences');
if ($this->getRequest()->getCheck('success')) {
$out->wrapWikiMsg(Html::rawElement('div', array('class' => 'mw-preferences-messagebox successbox', 'id' => 'mw-preferences-success'), Html::element('p', array(), '$1')), 'savedprefs');
}
$this->addHelpLink('Help:Preferences');
$htmlForm = Preferences::getFormObject($this->getUser(), $this->getContext());
$htmlForm->setSubmitCallback(array('Preferences', 'tryUISubmit'));
$htmlForm->show();
}
示例8: execute
public function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
$out->disallowUserJs();
# Prevent hijacked user scripts from sniffing passwords etc.
$this->requireLogin('prefsnologintext2');
$this->checkReadOnly();
if ($par == 'reset') {
$this->showResetForm();
return;
}
$out->addModules('mediawiki.special.preferences');
$out->addModuleStyles('mediawiki.special.preferences.styles');
$session = $this->getRequest()->getSession();
if ($session->get('specialPreferencesSaveSuccess')) {
// Remove session data for the success message
$session->remove('specialPreferencesSaveSuccess');
$out->addModuleStyles('mediawiki.notification.convertmessagebox.styles');
$out->addHTML(Html::rawElement('div', ['class' => 'mw-preferences-messagebox mw-notify-success successbox', 'id' => 'mw-preferences-success', 'data-mw-autohide' => 'false'], Html::element('p', [], $this->msg('savedprefs')->text())));
}
$this->addHelpLink('Help:Preferences');
// Load the user from the master to reduce CAS errors on double post (T95839)
if ($this->getRequest()->wasPosted()) {
$user = $this->getUser()->getInstanceForUpdate() ?: $this->getUser();
} else {
$user = $this->getUser();
}
$htmlForm = Preferences::getFormObject($user, $this->getContext());
$htmlForm->setSubmitCallback(['Preferences', 'tryUISubmit']);
$sectionTitles = $htmlForm->getPreferenceSections();
$prefTabs = '';
foreach ($sectionTitles as $key) {
$prefTabs .= Html::rawElement('li', ['role' => 'presentation', 'class' => $key === 'personal' ? 'selected' : null], Html::rawElement('a', ['id' => 'preftab-' . $key, 'role' => 'tab', 'href' => '#mw-prefsection-' . $key, 'aria-controls' => 'mw-prefsection-' . $key, 'aria-selected' => $key === 'personal' ? 'true' : 'false', 'tabIndex' => $key === 'personal' ? 0 : -1], $htmlForm->getLegend($key)));
}
$out->addHTML(Html::rawElement('ul', ['id' => 'preftoc', 'role' => 'tablist'], $prefTabs));
$htmlForm->show();
}