本文整理汇总了PHP中T函数的典型用法代码示例。如果您正苦于以下问题:PHP T函数的具体用法?PHP T怎么用?PHP T使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了T函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ToString
public function ToString()
{
$String = '';
ob_start();
?>
<div class="Box">
<h4><?php
echo T('In this Discussion');
?>
</h4>
<ul class="PanelInfo">
<?php
foreach ($this->_UserData->Result() as $User) {
?>
<li>
<strong><?php
echo UserAnchor($User, 'UserLink');
?>
</strong>
<?php
echo Gdn_Format::Date($User->DateLastActive);
?>
</li>
<?php
}
?>
</ul>
</div>
<?php
$String = ob_get_contents();
@ob_end_clean();
return $String;
}
示例2: SettingsController_Sitemaps_Create
public function SettingsController_Sitemaps_Create($Sender)
{
$Sender->Permission('Garden.Settings.Manage');
$Sender->SetData('Title', T('Sitemap Settings'));
$Sender->AddSideMenu();
$Sender->Render('Settings', '', 'plugins/Sitemaps');
}
示例3: Index
/**
* Display the embedded forum.
*
* @since 2.0.18
* @access public
*/
public function Index()
{
$this->AddSideMenu('dashboard/embed');
$this->Title('Embed Vanilla');
$this->Form = new Gdn_Form();
$Validation = new Gdn_Validation();
$ConfigurationModel = new Gdn_ConfigurationModel($Validation);
$ConfigurationModel->SetField(array('Garden.TrustedDomains'));
$this->Form->SetModel($ConfigurationModel);
if ($this->Form->AuthenticatedPostBack() === FALSE) {
// Format trusted domains as a string
$TrustedDomains = GetValue('Garden.TrustedDomains', $ConfigurationModel->Data);
if (is_array($TrustedDomains)) {
$TrustedDomains = implode("\n", $TrustedDomains);
}
$ConfigurationModel->Data['Garden.TrustedDomains'] = $TrustedDomains;
// Apply the config settings to the form.
$this->Form->SetData($ConfigurationModel->Data);
} else {
// Format the trusted domains as an array based on newlines & spaces
$TrustedDomains = $this->Form->GetValue('Garden.TrustedDomains');
$TrustedDomains = explode(' ', str_replace("\n", ' ', $TrustedDomains));
$TrustedDomains = array_unique(array_map('trim', $TrustedDomains));
$this->Form->SetFormValue('Garden.TrustedDomains', $TrustedDomains);
if ($this->Form->Save() !== FALSE) {
$this->InformMessage(T("Your settings have been saved."));
}
// Reformat array as string so it displays properly in the form
$this->Form->SetFormValue('Garden.TrustedDomains', implode("\n", $TrustedDomains));
}
$this->Render();
}
示例4: ToString
public function ToString()
{
if ($this->_UserData->NumRows() == 0) {
return '';
}
$String = '';
ob_start();
?>
<div class="Box">
<?php
echo panelHeading(T('In this Discussion'));
?>
<ul class="PanelInfo">
<?php
foreach ($this->_UserData->Result() as $User) {
?>
<li>
<?php
echo Anchor(Wrap(Wrap(Gdn_Format::Date($User->DateLastActive, 'html')), 'span', array('class' => 'Aside')) . ' ' . Wrap(Wrap(GetValue('Name', $User), 'span', array('class' => 'Username')), 'span'), UserUrl($User));
?>
</li>
<?php
}
?>
</ul>
</div>
<?php
$String = ob_get_contents();
@ob_end_clean();
return $String;
}
示例5: index
public function index($currency = '')
{
$data['result'] = get_result('currency');
$data['currency'] = $currency;
$this->assign($data);
$this->display(T('Common@Widget/Currency/index'));
}
示例6: user
function user($attr = null, $value = null)
{
if (!isset($_SESSION['login_user'])) {
return false;
}
if ($attr == 'local_map' && !isset($_SESSION['login_user']['local_map'])) {
$_SESSION['login_user']['local_map'] = T('local_map')->with('admin_id', user('id'))->select();
}
if ($attr === null) {
return true;
}
if ($value === null) {
// read user info
if ($attr == 'type_label') {
switch ($_SESSION['login_user']['type']) {
case 'ngo':
return '公益组织';
break;
case 'ind':
return '公益人';
break;
case 'csr':
return '企业';
break;
case 'fund':
return '基金会';
break;
}
}
return $_SESSION['login_user'][$attr];
} else {
//write user info
$_SESSION['login_user'][$attr] = $value;
}
}
示例7: PluginController_ShareThis_Create
/**
* Settings page.
*/
public function PluginController_ShareThis_Create($Sender)
{
$Sender->Permission('Garden.Settings.Manage');
$Sender->Title('ShareThis');
$Sender->AddSideMenu('plugin/sharethis');
$Sender->Form = new Gdn_Form();
$PublisherNumber = C('Plugin.ShareThis.PublisherNumber', 'Publisher Number');
$ViaHandle = C('Plugin.ShareThis.ViaHandle', '');
$CopyNShare = C('Plugin.ShareThis.CopyNShare', false);
$Validation = new Gdn_Validation();
$ConfigurationModel = new Gdn_ConfigurationModel($Validation);
$ConfigArray = array('Plugin.ShareThis.PublisherNumber', 'Plugin.ShareThis.ViaHandle', 'Plugin.ShareThis.CopyNShare');
if ($Sender->Form->AuthenticatedPostBack() === FALSE) {
$ConfigArray['Plugin.ShareThis.PublisherNumber'] = $PublisherNumber;
$ConfigArray['Plugin.ShareThis.ViaHandle'] = $ViaHandle;
$ConfigArray['Plugin.ShareThis.CopyNShare'] = $CopyNShare;
}
$ConfigurationModel->SetField($ConfigArray);
$Sender->Form->SetModel($ConfigurationModel);
// If seeing the form for the first time...
if ($Sender->Form->AuthenticatedPostBack() === FALSE) {
// Apply the config settings to the form.
$Sender->Form->SetData($ConfigurationModel->Data);
} else {
// Define some validation rules for the fields being saved
$ConfigurationModel->Validation->ApplyRule('Plugin.ShareThis.PublisherNumber', 'Required');
if ($Sender->Form->Save() !== FALSE) {
$Sender->InformMessage(T("Your changes have been saved."));
}
}
$Sender->Render('sharethis', '', 'plugins/ShareThis');
}
示例8: CheckPassword
/**
* Check a password against a stored password.
*
* The stored password can be plain, a md5 hash or a phpass hash.
* If the password wasn't a phppass hash, the Weak property is set to True.
*
* @param string $Password
* @param string $StoredHash
* @param string $Method
* @param string $Username
* @return boolean
*/
function CheckPassword($Password, $StoredHash, $Method = FALSE, $Username = NULL) {
$Result = FALSE;
switch(strtolower($Method)) {
case 'django':
$Result = $this->CheckDjango($Password, $StoredHash);
break;
case 'phpbb':
require_once(PATH_LIBRARY.'/vendors/phpbb/phpbbhash.php');
$Result = phpbb_check_hash($Password, $StoredHash);
break;
case 'reset':
throw new Gdn_UserException(sprintf(T('You need to reset your password.', 'You need to reset your password. This is most likely because an administrator recently changed your account information. Click <a href="%s">here</a> to reset your password.'), Url('entry/passwordrequest')));
break;
case 'smf':
$Result = (sha1(strtolower($Username).$Password) == $StoredHash);
break;
case 'vbulletin':
// assume vbulletin's password hash has a fixed length of 32, the salt length will vary between version 3 and 4
$SaltLength = strlen($StoredHash) - 32;
$Salt = trim(substr($StoredHash, -$SaltLength, $SaltLength));
$VbStoredHash = substr($StoredHash, 0, strlen($StoredHash) - $SaltLength);
$VbHash = md5(md5($Password).$Salt);
$Result = $VbHash == $VbStoredHash;
break;
case 'vanilla':
default:
$Result = $this->CheckVanilla($Password, $StoredHash);
}
return $Result;
}
示例9: actionLogin
/**
* @brief 执行登录逻辑
*
* @return
*/
public function actionLogin()
{
// 如果用户已经登录
if ($this->isLogin()) {
return $this->showJSON(true);
}
$form = $this->form('post');
$username = trim($form['username']);
$password = $form['password'];
if (!$username || !$password) {
return $this->showJSON('请填写用户名和密码');
}
// 验证用户一卡通和密码是否匹配
if (!$this->verify($username, $password)) {
return $this->showJSON('卡号密码不匹配');
}
// 以一卡通号获取gapper用户信息
try {
$info = self::getRPC()->gapper->user->getUserByIdentity(self::$identitySource, $username);
} catch (\Exception $e) {
}
if ($info['id']) {
// 用户已经存在,正常登录
$result = \Gini\Gapper\Client::loginByUserName($info['username']);
if ($result) {
return $this->showJSON(true);
}
return $this->showJSON(T('Login failed! Please try again.'));
}
}
示例10: savepsw
function savepsw()
{
$objData = array('psw' => $this->_post('psw', ''));
//内容规则检查
T('content/validate');
$validate = array(array('psw', 'min_length', '密码长度必须大于4位', 4));
if (!validate::check($validate, $objData)) {
$this->JsonReturn(validate::getError());
}
if ($objData['psw'] != $this->_post('repsw')) {
$this->JsonReturn('两次密码不一致,请检查');
}
if ($objData['psw']) {
$psw = D('admin')->setUserPassword($objData['psw']);
if ($psw != steadmin::$adminInfo['psw']) {
D('steadmin')->update(array('psw' => $psw), array('user_id' => steadmin::$adminInfo['user_id']));
D('steadmin')->setUserLogin(array('user_id' => steadmin::$adminInfo['user_id'], 'psw' => $psw), 0, false);
//===记录操作日志====
parent::saveSySLog(2, array(), 0, array('user_id' => steadmin::$adminInfo['user_id']), '修改密码-编辑');
//===记录操作日志====
$this->JsonReturn('操作成功', null, 1);
}
}
$this->JsonReturn('密码未变更', null, 0);
}
示例11: display
/**
* 模板显示 调用内置的模板引擎显示方法,
* @access protected
* @param string $templateFile 指定要调用的模板文件
* @return void
*/
protected function display($template)
{
$file = T('Addons://' . parse_name($_GET['_addons'], 1) . '@./' . ucfirst($_GET['_controller']) . '/' . $_GET['_action']);
define('IS_ADDON', true);
parent::display($file);
// 重要:要避免陷入$this->display()循环
}
示例12: render
public function render($uid = 0, $page = 1, $tab = null, $count = 10)
{
!$uid && ($uid = is_login());
//查询条件
$map['uid'] = $uid;
$NewsModel = new NewsModel();
/* 获取当前分类下资讯列表 */
if ($uid != is_login()) {
$map['status'] = 1;
$map['dead_line'] = array('gt', time());
}
list($list, $totalCount) = $NewsModel->getListByPage($map, $page, 'update_time desc', '*', $count);
foreach ($list as &$val) {
if ($val['status'] == 1) {
$val['audit_status'] = '<span style="color: green;">审核通过</span>';
} elseif ($val['status'] == 2) {
$val['audit_status'] = '<span style="color:#4D9EFF;">待审核</span>';
} elseif ($val['status'] == -1) {
$val['audit_status'] = '<span style="color: #b5b5b5;">审核失败</span>';
}
}
unset($val);
/* 模板赋值并渲染模板 */
$this->assign('news_list', $list);
$this->assign('totalCount', $totalCount);
$this->display(T('News@Widget/ucenterblock'));
}
示例13: index
public function index($product_id, $Month = '', $moudel = '')
{
if (!$product_id) {
$product_id = 0;
}
$map['product_id'] = $product_id;
$result = get_result('product_price', $map);
if ($Month) {
$Montht = $Month;
} else {
$Montht = date('Y-m-d');
}
$Monthts = date('t', strtotime($Montht));
foreach ($result as $k => $row) {
$data[] = array('id' => $row['id'], 'title' => $row['type1_price'], 'start' => date('Y-m-d', $row['day']), 'name' => date('Y-m-d H:i', $row['day']), 'textColor' => '#0FDECF');
}
for ($im = 1; $im <= $Monthts; $im++) {
$map['day'] = strtotime(date('Y-m-d', $row['day']));
$description_info = get_info('product_description', $map);
if ($description_info) {
$data[] = array('id' => $description_info['id'], 'title' => $row['type1_price'], 'start' => date('Y-m-d', $description_info['day']), 'name' => date('Y-m-d H:i', $description_info['day']), 'textColor' => '#0FDECF');
} else {
$data[] = array('id' => '0', 'title' => '设定价格', 'start' => date('Y-m', strtotime($Montht)) . "-" . $im, 'name' => date('Y-m', strtotime($Montht)) . "-" . $im, 'textColor' => '#0FDECF');
}
}
$datas['data'] = json_encode($data);
$this->assign($map);
$this->assign($datas);
$this->display(T('Common@Widget/ProductPrice/index'));
}
示例14: lineAction
public function lineAction()
{
header("Content-Type:text/html; charset=UTF-8");
$res = $this->achievementAction(10000);
$rebate = D('Rebate');
$key = 1;
$res = $rebate->init($key);
$Page = new \Think\Page(count($res), 10);
// 实例化分页类 传入总记录数和每页显示的
$Page->setConfig('theme', '%FIRST% %UP_PAGE% %HEADER% %DOWN_PAGE% %END%');
$Page->setConfig('header', '<span class="rows">共 %TOTAL_ROW% 个返点</span>%LINK_PAGE%<span class="currentrows">当前第 %NOW_PAGE% 页</span>');
$show = $Page->show();
// 分页显示输出
$this->assign('page', $show);
// 赋值分页输出
foreach ($res as $key => $value) {
$res[$key]['actionUrl']['edit'] = U('Rebate/Edit/line?id=' . $value['id']);
$res[$key]['actionUrl']['delete'] = U('Rebate/Delete/line?id=' . $value['id']);
}
$this->assign('rebate', $res);
$this->assign('urlAdd', U('Rebate/Add/line'));
$TPL = T('Rebate@Index/index');
$this->assign('YZRight', $this->fetch($TPl));
$this->display(YZ_TEMPLATE);
}
示例15: reward
private function reward()
{
//$event_arr = array('login_everyday','post_comment','been_comment','post_share','post_video','forward_share','been_like','been_like_album','add_like','add_like_album','email_active','create_avatar');
$this->ajax_check_login();
$ptx_event_log = spClass('ptx_event_log');
$start_time = time() - 5 * 24 * 3600;
$ptx_event_log->clean_log($this->current_user['user_id'], $start_time);
$conditions['to_user_id'] = $this->current_user['user_id'];
$conditions['event_type'] = 'reward';
$conditions['is_read'] = '0';
$conditions['event_code'] = array('login_everyday', 'post_comment', 'post_share', 'post_video', 'forward_share', 'add_like', 'add_like_album', 'email_active', 'create_avatar');
$logs = $ptx_event_log->search_no_page($conditions);
$credit_strategy = $this->settings['credit_strategy'];
$messages = array();
foreach ($logs as $log) {
$msg = T($log['event_code']) . ' ';
for ($i = 1; $i <= 3; $i++) {
if ($ext_credits = $credit_strategy[$log['event_code'] . '_credits_' . $i]) {
$msg .= T("ext_credits_{$i}") . ' +' . $ext_credits . ' ';
}
}
$messages[] = $msg;
}
$conditions_update['to_user_id'] = $this->current_user['user_id'];
$conditions_update['event_type'] = 'reward';
$conditions_update['is_read'] = '0';
$ptx_event_log->update($conditions_update, array('is_read' => 1));
$this->ajax_success_response($messages, 'tip');
}