本文整理汇总了PHP中EasyTemplate::set_Vars方法的典型用法代码示例。如果您正苦于以下问题:PHP EasyTemplate::set_Vars方法的具体用法?PHP EasyTemplate::set_Vars怎么用?PHP EasyTemplate::set_Vars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EasyTemplate
的用法示例。
在下文中一共展示了EasyTemplate::set_Vars方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
//.........这里部分代码省略.........
// the next action done with Special:EditAccount will fail and the
// correct user data will be replaced by the temp user cache.
// In other words: LOST.
//
// In order to prevent that we have to do the following two steps:
//
// 1) REMOVED: invalidate temp user cache
//
// 2) and copy the data from the shared to the local database
$oUser = User::newFromName($userName);
wfRunHooks('UserNameLoadFromId', array($userName, &$oUser, true));
$id = 0;
$this->mUser = $oUser;
if (!empty($this->mUser)) {
$id = $this->mUser->getId();
}
if (empty($action)) {
$action = 'displayuser';
}
if (empty($id)) {
$this->mUser = null;
$this->mStatus = false;
$this->mStatusMsg = wfMsg('editaccount-nouser', $userName);
}
}
}
// FB:23860
if (!$this->mUser instanceof User) {
$action = '';
}
// CSRF protection for EditAccount (CE-774)
if ($action !== '' && $action !== 'displayuser' && $action !== 'closeaccount' && (!$request->wasPosted() || !$user->matchEditToken($request->getVal('wpToken')))) {
$output->addHTML(Xml::element('p', ['class' => 'error'], $this->msg('sessionfailure')->text()));
return;
}
$changeReason = $request->getVal('wpReason');
switch ($action) {
case 'setemail':
$newEmail = $request->getVal('wpNewEmail');
$this->mStatus = $this->setEmail($newEmail, $changeReason);
$template = 'displayuser';
break;
case 'setpass':
$newPass = $request->getVal('wpNewPass');
$this->mStatus = $this->setPassword($newPass, $changeReason);
$template = 'displayuser';
break;
case 'setrealname':
$newRealName = $request->getVal('wpNewRealName');
$this->mStatus = $this->setRealName($newRealName, $changeReason);
$template = 'displayuser';
break;
case 'closeaccount':
$template = 'closeaccount';
$this->mStatus = (bool) $this->mUser->getGlobalFlag('requested-closure', 0);
$this->mStatusMsg = $this->mStatus ? wfMsg('editaccount-requested') : wfMsg('editaccount-not-requested');
break;
case 'closeaccountconfirm':
$keepEmail = !$request->getBool('clearemail', false);
$this->mStatus = self::closeAccount($this->mUser, $changeReason, $this->mStatusMsg, $this->mStatusMsg2, $keepEmail);
$template = $this->mStatus ? 'selectuser' : 'displayuser';
break;
case 'clearunsub':
$this->mStatus = $this->clearUnsubscribe();
$template = 'displayuser';
break;
case 'cleardisable':
$this->mStatus = $this->clearDisable();
$template = 'displayuser';
break;
case 'clearclosurerequest':
$this->mStatus = $this->clearClosureRequest();
$template = 'displayuser';
break;
case 'toggleadopter':
$this->mStatus = $this->toggleAdopterStatus();
$template = 'displayuser';
break;
case 'displayuser':
$template = 'displayuser';
break;
default:
$template = 'selectuser';
}
$output->setPageTitle($this->msg('editaccount-title')->plain());
$oTmpl = new EasyTemplate(dirname(__FILE__) . '/templates/');
$oTmpl->set_Vars(array('status' => $this->mStatus, 'statusMsg' => $this->mStatusMsg, 'statusMsg2' => $this->mStatusMsg2, 'user' => $userName, 'userEmail' => null, 'userRealName' => null, 'userEncoded' => urlencode($userName), 'user_hsc' => htmlspecialchars($userName), 'userId' => null, 'userReg' => null, 'isUnsub' => null, 'isDisabled' => null, 'isAdopter' => null, 'returnURL' => $this->getTitle()->getFullURL(), 'logLink' => Linker::linkKnown(SpecialPage::getTitleFor('Log', 'editaccnt'), $this->msg('editaccount-log')->escaped()), 'userStatus' => null, 'emailStatus' => null, 'disabled' => null, 'changeEmailRequested' => null, 'editToken' => $user->getEditToken()));
if (is_object($this->mUser)) {
$userStatus = wfMsg('editaccount-status-realuser');
$this->mUser->load();
// get new email (unconfirmed)
$optionNewEmail = $this->mUser->getGlobalAttribute('new_email');
$changeEmailRequested = empty($optionNewEmail) ? '' : wfMsg('editaccount-email-change-requested', $optionNewEmail);
// emailStatus is the status of the email in the "Set new email address" field
$emailStatus = $this->mUser->isEmailConfirmed() ? wfMsg('editaccount-status-confirmed') : wfMsg('editaccount-status-unconfirmed');
$oTmpl->set_Vars(array('userEmail' => $this->mUser->getEmail(), 'userRealName' => $this->mUser->getRealName(), 'userId' => $this->mUser->getID(), 'userReg' => date('r', strtotime($this->mUser->getRegistration())), 'isUnsub' => $this->mUser->getGlobalPreference('unsubscribed'), 'isDisabled' => $this->mUser->getGlobalFlag('disabled'), 'isClosureRequested' => $this->isClosureRequested(), 'isAdopter' => $this->mUser->getGlobalFlag('AllowAdoption', 1), 'userStatus' => $userStatus, 'emailStatus' => $emailStatus, 'changeEmailRequested' => $changeEmailRequested));
}
// HTML output
$output->addHTML($oTmpl->render($template));
}
示例2: execute
//.........这里部分代码省略.........
}
$action = $wgRequest->getVal('wpAction');
#get name to work on. subpage is supported, but form submit name trumps
$userName = $wgRequest->getVal('wpUserName', $par);
if ($userName !== null) {
#got a name, clean it up
$userName = str_replace("_", " ", trim($userName));
$userName = ucfirst($userName);
# user names begin with a capital letter
// check if user name is an existing user
if (User::isValidUserName($userName)) {
$this->mUser = User::newFromName($userName);
$id = $this->mUser->idFromName($userName);
if (empty($action)) {
$action = 'displayuser';
}
if (empty($id)) {
if (!empty($wgEnableUserLoginExt)) {
$this->mTempUser = TempUser::getTempUserFromName($userName);
}
if ($this->mTempUser) {
$id = $this->mTempUser->getId();
$this->mUser = User::newFromId($id);
} else {
$this->mStatus = false;
$this->mStatusMsg = wfMsg('editaccount-nouser', $userName);
$action = '';
}
}
}
}
// FB:23860
if (!$this->mUser instanceof User) {
$action = '';
}
switch ($action) {
case 'setemail':
$newEmail = $wgRequest->getVal('wpNewEmail');
$this->mStatus = $this->setEmail($newEmail);
$template = 'displayuser';
break;
case 'setpass':
$newPass = $wgRequest->getVal('wpNewPass');
$this->mStatus = $this->setPassword($newPass);
$template = 'displayuser';
break;
case 'setrealname':
$newRealName = $wgRequest->getVal('wpNewRealName');
$this->mStatus = $this->setRealName($newRealName);
$template = 'displayuser';
break;
case 'closeaccount':
$template = 'closeaccount';
$this->mStatus = (bool) $this->mUser->getOption('requested-closure', 0);
$this->mStatusMsg = $this->mStatus ? wfMsg('editaccount-requested') : wfMsg('editaccount-not-requested');
break;
case 'closeaccountconfirm':
$this->mStatus = $this->closeAccount();
$template = $this->mStatus ? 'selectuser' : 'displayuser';
break;
case 'clearunsub':
$this->mStatus = $this->clearUnsubscribe();
$template = 'displayuser';
break;
case 'cleardisable':
$this->mStatus = $this->clearDisable();
$template = 'displayuser';
break;
case 'toggleadopter':
$this->mStatus = $this->toggleAdopterStatus();
$template = 'displayuser';
break;
case 'displayuser':
$template = 'displayuser';
break;
default:
$template = 'selectuser';
}
$wgOut->setPageTitle(wfMsg('editaccount-title'));
$oTmpl = new EasyTemplate(dirname(__FILE__) . '/templates/');
$oTmpl->set_Vars(array('status' => $this->mStatus, 'statusMsg' => $this->mStatusMsg, 'statusMsg2' => $this->mStatusMsg2, 'user' => $userName, 'userEmail' => null, 'userRealName' => null, 'userEncoded' => urlencode($userName), 'user_hsc' => htmlspecialchars($userName), 'userId' => null, 'userReg' => null, 'isUnsub' => null, 'isDisabled' => null, 'isAdopter' => null, 'returnURL' => $this->getTitle()->getFullURL(), 'userStatus' => null, 'emailStatus' => null, 'disabled' => null, 'changeEmailRequested' => null));
if (is_object($this->mUser)) {
if ($this->mTempUser) {
$this->mUser = $this->mTempUser->mapTempUserToUser(false);
$userStatus = wfMsg('editaccount-status-tempuser');
$oTmpl->set_Vars(array('disabled' => 'disabled="disabled"'));
} else {
$userStatus = wfMsg('editaccount-status-realuser');
}
$this->mUser->load();
// get new email (unconfirmed)
$optionNewEmail = $this->mUser->getOption('new_email');
$changeEmailRequested = empty($optionNewEmail) ? '' : wfMsg('editaccount-email-change-requested', $optionNewEmail);
// emailStatus is the status of the email in the "Set new email address" field
$emailStatus = $this->mUser->isEmailConfirmed() ? wfMsg('editaccount-status-confirmed') : wfMsg('editaccount-status-unconfirmed');
$oTmpl->set_Vars(array('userEmail' => $this->mUser->getEmail(), 'userRealName' => $this->mUser->getRealName(), 'userId' => $this->mUser->getID(), 'userReg' => date('r', strtotime($this->mUser->getRegistration())), 'isUnsub' => $this->mUser->getOption('unsubscribed'), 'isDisabled' => $this->mUser->getOption('disabled'), 'isAdopter' => $this->mUser->getOption('AllowAdoption', 1), 'userStatus' => $userStatus, 'emailStatus' => $emailStatus, 'changeEmailRequested' => $changeEmailRequested));
}
// HTML output
$wgOut->addHTML($oTmpl->render($template));
}