本文整理汇总了PHP中tt函数的典型用法代码示例。如果您正苦于以下问题:PHP tt函数的具体用法?PHP tt怎么用?PHP tt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionAdd
public function actionAdd($isFancy = 0)
{
$model = new Reviews();
if (isset($_POST[$this->modelName])) {
$model->attributes = $_POST[$this->modelName];
if ($model->validate()) {
if ($model->save(false)) {
$model->name = CHtml::encode($model->name);
$model->body = CHtml::encode($model->body);
$notifier = new Notifier();
$notifier->raiseEvent('onNewReview', $model);
if (Yii::app()->user->getState('isAdmin')) {
Yii::app()->user->setFlash('success', tt('success_send_not_moderation'));
} else {
Yii::app()->user->setFlash('success', tt('success_send'));
}
$this->redirect(array('index'));
}
$model->unsetAttributes(array('name', 'body', 'verifyCode'));
} else {
Yii::app()->user->setFlash('error', tt('failed_send'));
}
$model->unsetAttributes(array('verifyCode'));
}
if ($isFancy) {
$this->excludeJs();
$this->renderPartial('add', array('model' => $model), false, true);
} else {
$this->render('add', array('model' => $model));
}
}
示例2: index
public function index()
{
// Load dependencies
$this->load->model('catalog/category');
$this->load->model('common/log');
$data = array();
$this->document->setTitle(tt('Page not found'));
// Generate categories menu
$categories = $this->model_catalog_category->getCategories(null, $this->language->getId());
$data['categories'] = array();
foreach ($categories as $category) {
// Get child categories
$child = array();
$child_categories = $this->model_catalog_category->getCategories($category->category_id, $this->language->getId(), true);
foreach ($child_categories as $child_category) {
if ($child_category->total_products) {
$child[] = array('category_id' => $child_category->category_id, 'title' => $child_category->title, 'href' => $this->url->link('catalog/category', 'category_id=' . $child_category->category_id), 'child' => array());
}
}
// Get parent categories
if ($child) {
$data['categories'][] = array('category_id' => $category->category_id, 'title' => $category->title, 'href' => $this->url->link('catalog/category', 'category_id=' . $category->category_id), 'child' => $child);
}
}
// Add error to the log
$this->model_common_log->createLog404($this->auth->getId(), $this->request->getRequestString(), $this->request->getRequestReferrer());
$data['footer'] = $this->load->controller('common/footer');
$data['header'] = $this->load->controller('common/header');
$data['href_common_information_faq'] = $this->url->link('common/information/faq');
$data['href_catalog_search'] = $this->url->link('catalog/search');
$data['module_breadcrumbs'] = $this->load->controller('module/breadcrumbs', array(array('name' => tt('Home'), 'href' => $this->url->link('common/home'), 'active' => true)));
$this->response->addHeader($this->request->getServerProtocol() . '/1.1 404 Not Found');
$this->response->setOutput($this->load->view('error/not_found.tpl', $data));
}
示例3: team
public function team()
{
$this->document->setTitle(tt('Team'));
$data['footer'] = $this->load->controller('common/footer');
$data['header'] = $this->load->controller('common/header');
$data['module_breadcrumbs'] = $this->load->controller('module/breadcrumbs', array(array('name' => tt('Home'), 'href' => $this->url->link('common/home'), 'active' => false), array('name' => tt('Team'), 'href' => $this->url->link('common/information/team'), 'active' => true)));
// Contributors list
$github = curl_init(GITHUB_API_URL_CONTRIBUTORS);
curl_setopt($github, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
curl_setopt($github, CURLOPT_USERAGENT, PROJECT_NAME);
curl_setopt($github, CURLOPT_RETURNTRANSFER, true);
$contributors = curl_exec($github);
$data['contributions'] = 0;
$data['contributors'] = array();
if ($contributors) {
foreach (json_decode($contributors, true) as $contributor) {
if (isset($contributor['id'])) {
$data['contributions'] += $contributor['contributions'];
$data['contributors'][] = array('username' => $contributor['login'], 'href_avatar' => $contributor['avatar_url'], 'href_profile' => $contributor['html_url'], 'contributions' => $contributor['contributions']);
} else {
if (isset($contributor['message'])) {
$this->security_log->write($contributor['message']);
}
}
}
}
$this->response->setOutput($this->load->view('common/information/team.tpl', $data));
}
示例4: actionSaveSort
public function actionSaveSort()
{
$objTypeId = Yii::app()->request->getParam('id', NULL);
$sort = Yii::app()->request->getParam('sort');
if (count($sort) >= param('searchMaxField', 15)) {
HAjax::jsonError(tt('Search max field ') . param('searchMaxField', 3));
}
if ($objTypeId !== NULL && $sort && is_array($sort)) {
$elements = SearchForm::getSearchFields();
$sql = "DELETE FROM {{search_form}} WHERE obj_type_id=:id AND status!=:status";
Yii::app()->db->createCommand($sql)->execute(array(':id' => $objTypeId, ':status' => SearchFormModel::STATUS_NOT_REMOVE));
$i = 3;
foreach ($sort as $field) {
if (!isset($elements[$field])) {
continue;
}
$search = new SearchFormModel();
$search->attributes = array('obj_type_id' => $objTypeId, 'field' => $field, 'status' => $elements[$field]['status'], 'sorter' => $i, 'formdesigner_id' => isset($elements[$field]['formdesigner_id']) ? $elements[$field]['formdesigner_id'] : 0);
$search->save();
$i++;
}
// delete assets js cache
ConfigurationModel::clearGenerateJSAssets();
HAjax::jsonOk();
}
HAjax::jsonError();
}
示例5: index
public function index()
{
$this->document->setTitle(tt('BitsyBay - Sell and Buy Digital Content with BitCoin'), false);
if (isset($this->request->get['route'])) {
$this->document->addLink(HTTP_SERVER, 'canonical');
}
if ($this->auth->isLogged()) {
$data['title'] = sprintf(tt('Welcome, %s!'), $this->auth->getUsername());
$data['user_is_logged'] = true;
} else {
$data['title'] = tt('Welcome to the BitsyBay store!');
$data['user_is_logged'] = false;
}
$total_products = $this->model_catalog_product->getTotalProducts(array());
$data['total_products'] = sprintf(tt('%s %s'), $total_products, plural($total_products, array(tt('offer'), tt('offers'), tt('offers'))));
$total_categories = $this->model_catalog_category->getTotalCategories();
$data['total_categories'] = sprintf(tt('%s %s'), $total_categories, plural($total_categories, array(tt('category'), tt('categories'), tt('categories'))));
$total_sellers = $this->model_account_user->getTotalSellers();
$data['total_sellers'] = sprintf(tt('%s %s'), $total_sellers, plural($total_sellers, array(tt('seller'), tt('sellers'), tt('sellers'))));
$total_buyers = $this->model_account_user->getTotalUsers();
$data['total_buyers'] = sprintf(tt('%s %s'), $total_buyers, plural($total_buyers, array(tt('buyer'), tt('buyers'), tt('buyers'))));
$redirect = base64_encode($this->url->getCurrentLink($this->request->getHttps()));
$data['login_action'] = $this->url->link('account/account/login', 'redirect=' . $redirect, 'SSL');
$data['href_account_create'] = $this->url->link('account/account/create', 'redirect=' . $redirect, 'SSL');
$data['module_search'] = $this->load->controller('module/search', array('class' => 'col-lg-8 col-lg-offset-2'));
$data['module_latest'] = $this->load->controller('module/latest', array('limit' => 8));
$data['footer'] = $this->load->controller('common/footer');
$data['header'] = $this->load->controller('common/header');
$this->response->setOutput($this->load->view('common/home.tpl', $data));
}
示例6: actionAdd
public function actionAdd($isFancy = 0)
{
$model = new Vacancy();
if (isset($_POST[$this->modelName]) && BlockIp::checkAllowIp(Yii::app()->controller->currentUserIpLong)) {
$model->attributes = $_POST[$this->modelName];
if ($model->validate()) {
$model->user_ip = Yii::app()->controller->currentUserIp;
$model->user_ip_ip2_long = Yii::app()->controller->currentUserIpLong;
if ($model->save(false)) {
$model->name = CHtml::encode($model->name);
$model->body = CHtml::encode($model->body);
$notifier = new Notifier();
$notifier->raiseEvent('onNewReview', $model);
if (Yii::app()->user->checkAccess('vacancy_admin')) {
Yii::app()->user->setFlash('success', tt('success_send_not_moderation'));
} else {
Yii::app()->user->setFlash('success', tt('success_send'));
}
$this->redirect(array('index'));
}
$model->unsetAttributes(array('name', 'body', 'verifyCode'));
} else {
Yii::app()->user->setFlash('error', tt('failed_send'));
}
$model->unsetAttributes(array('verifyCode'));
}
if ($isFancy) {
$this->excludeJs();
$this->renderPartial('add', array('model' => $model), false, true);
} else {
$this->render('add', array('model' => $model));
}
}
示例7: actionSearch
public function actionSearch($type = 'all')
{
if (!param('useShowUserInfo')) {
throw new CHttpException(403, tt('Displays information about the users is disabled by the administrator', 'users'));
}
$usersListPage = Menu::model()->findByPk(Menu::USERS_LIST_ID);
if ($usersListPage) {
if ($usersListPage->active == 0) {
throw404();
}
}
$this->showSearchForm = false;
$existTypes = User::getTypeList('withAll');
$criteria = new CDbCriteria();
$type = in_array($type, array_keys($existTypes)) ? $type : 'all';
//$criteria->compare('active', 1);
if ($type != 'all') {
$criteria->compare('type', $type);
}
//$criteria->compare('isAdmin', 0);
$criteria->with = array('countAdRel');
$sort = new CSort();
$sort->sortVar = 'sort';
$sort->defaultOrder = 'date_created DESC';
$sort->multiSort = true;
$sort->attributes = array('username' => array('label' => tc('by username'), 'default' => 'desc'), 'date_created' => array('label' => tc('by date of registration'), 'default' => 'desc'));
$dataProvider = new CActiveDataProvider(User::model()->active(), array('criteria' => $criteria, 'sort' => $sort, 'pagination' => array('pageSize' => 12)));
$this->render('search', array('dataProvider' => $dataProvider, 'type' => $type));
}
示例8: actionCreate
public function actionCreate()
{
$model = new FormDesigner();
$model->scenario = 'advanced';
$model->type = FormDesigner::TYPE_TEXT;
$translate = new TranslateMessage();
if (isset($_POST['FormDesigner'])) {
$model->attributes = $_POST['FormDesigner'];
if ($model->validate()) {
// magic begin
$this->fieldName = translit($model->getStrByLang('label'), '_', true);
$this->fieldName = substr($this->fieldName, 0, 12);
if ($this->setFieldInTable($_POST['FormDesigner']['type'])) {
$model->field = $this->fieldName;
$translate->attributes = $_POST['TranslateMessage'];
$translate->category = 'common';
$translate->message = 'Search by ' . $this->fieldName;
if ($translate->save()) {
$model->save();
Yii::app()->cache->flush();
Yii::app()->user->setFlash('success', tt('The new field is successfully created.'));
$this->redirect(Yii::app()->createUrl('/formdesigner/backend/main/admin'));
}
} else {
$model->addError('', tt('Failed to create field'));
}
}
}
$this->render('create', array('model' => $model, 'translate' => $translate));
}
示例9: doEditAppInfo
public function doEditAppInfo()
{
$id = I('post.app_id', null);
if (!is_null(I('post.app_title', null))) {
$data['app_title'] = tt(I('post.app_title'));
}
if (!is_null('post.app_author', null)) {
$data['app_author'] = tt(I('post.app_author'));
}
if (!is_null('post.app_admin_layout', null)) {
$data['app_admin_layout'] = intval(I('post.app_admin_layout'));
}
if (!is_null('post.app_admin_entrance', null)) {
$data['app_admin_entrance'] = tt(I('post.app_admin_entrance'));
}
if (!is_null('post.app_version', null)) {
$data['app_version'] = tt(I('post.app_version'));
}
if (!is_null('post.app_desc', null)) {
$data['app_desc'] = tt(I('post.app_desc'));
}
$data['app_id'] = intval(I('post.app_id'));
$res = D('Admin/App')->save($data);
if (!$res) {
$this->error(L('ERR_SAVE_FAIL'));
} else {
$this->success(L('MSG_SAVE_SUCCESS'), U('Admin/Admin/dispApps'));
}
}
示例10: post
/**
* @brief Channels admin page.
*
* @param App &$a
*/
function post()
{
$channels = x($_POST, 'channel') ? $_POST['channel'] : array();
check_form_security_token_redirectOnErr('/admin/channels', 'admin_channels');
$xor = db_getfunc('^');
if (x($_POST, 'page_channels_block')) {
foreach ($channels as $uid) {
q("UPDATE channel SET channel_pageflags = ( channel_pageflags {$xor} %d ) where channel_id = %d", intval(PAGE_CENSORED), intval($uid));
\Zotlabs\Daemon\Master::Summon(array('Directory', $uid, 'nopush'));
}
notice(sprintf(tt("%s channel censored/uncensored", "%s channels censored/uncensored", count($channels)), count($channels)));
}
if (x($_POST, 'page_channels_code')) {
foreach ($channels as $uid) {
q("UPDATE channel SET channel_pageflags = ( channel_pageflags {$xor} %d ) where channel_id = %d", intval(PAGE_ALLOWCODE), intval($uid));
}
notice(sprintf(tt("%s channel code allowed/disallowed", "%s channels code allowed/disallowed", count($channels)), count($channels)));
}
if (x($_POST, 'page_channels_delete')) {
foreach ($channels as $uid) {
channel_remove($uid, true);
}
notice(sprintf(tt("%s channel deleted", "%s channels deleted", count($channels)), count($channels)));
}
goaway(z_root() . '/admin/channels');
}
示例11: index
public function index()
{
$this->document->setTitle(tt('BitsyBay - Sell and Buy Digital Creative with BitCoin'), false);
$this->document->setDescription(tt('BTC Marketplace for royalty-free photos, arts, templates, codes, books and other digital creative with BitCoin. Only quality and legal content from them authors. Free seller fee up to 2016!'));
$this->document->setKeywords(tt('bitsybay, bitcoin, btc, indie, marketplace, store, buy, sell, royalty-free, photos, arts, illustrations, 3d, templates, codes, extensions, books, content, digital, creative, quality, legal'));
if (isset($this->request->get['route'])) {
$this->document->addLink(URL_BASE, 'canonical');
}
if ($this->auth->isLogged()) {
$data['title'] = sprintf(tt('Welcome, %s!'), $this->auth->getUsername());
$data['user_is_logged'] = true;
} else {
$data['title'] = tt('Welcome to the BitsyBay store!');
$data['user_is_logged'] = false;
}
$total_products = $this->model_catalog_product->getTotalProducts(array());
$data['total_products'] = sprintf(tt('%s %s'), $total_products, plural($total_products, array(tt('offer'), tt('offers'), tt('offers'))));
$total_categories = $this->model_catalog_category->getTotalCategories();
$data['total_categories'] = sprintf(tt('%s %s'), $total_categories, plural($total_categories, array(tt('category'), tt('categories'), tt('categories'))));
$total_sellers = $this->model_account_user->getTotalSellers();
$data['total_sellers'] = sprintf(tt('%s %s'), $total_sellers, plural($total_sellers, array(tt('sellers'), tt('sellers'), tt('sellers'))));
$total_buyers = $this->model_account_user->getTotalUsers();
$data['total_buyers'] = sprintf(tt('%s %s'), $total_buyers, plural($total_buyers, array(tt('buyers'), tt('buyers'), tt('buyers'))));
$redirect = base64_encode($this->url->getCurrentLink());
$data['login_action'] = $this->url->link('account/account/login', 'redirect=' . $redirect);
$data['href_account_create'] = $this->url->link('account/account/create', 'redirect=' . $redirect);
$data['module_search'] = $this->load->controller('module/search', array('class' => 'col-lg-8 col-lg-offset-2'));
$data['module_latest'] = $this->load->controller('module/latest', array('limit' => 4));
$data['footer'] = $this->load->controller('common/footer');
$data['header'] = $this->load->controller('common/header');
$this->response->setOutput($this->load->view('common/home.tpl', $data));
}
示例12: actionCreate
public function actionCreate()
{
$this->setActiveMenu('add_ad');
$this->modelName = 'Apartment';
$model = new $this->modelName();
$user = User::model()->findByPk(Yii::app()->user->id);
if (preg_match("/null\\.io/i", $user->email)) {
Yii::app()->user->setFlash('error', tt('You can not add listings till you specify your valid email.', 'socialauth'));
$this->redirect(array('/usercpanel/main/index', 'from' => 'userads'));
} elseif (!$user->phone) {
Yii::app()->user->setFlash('error', tt('You can not add listings till you specify your phone number.', 'socialauth'));
$this->redirect(array('/usercpanel/main/index', 'from' => 'userads'));
}
$model->active = Apartment::STATUS_DRAFT;
$model->owner_active = Apartment::STATUS_ACTIVE;
if (issetModule('tariffPlans') && issetModule('paidservices')) {
$return = TariffPlans::checkAllowUserActivateAd(Yii::app()->user->id, true, '>=');
if ($return === false) {
$model->owner_active = Apartment::STATUS_INACTIVE;
}
}
$model->setDefaultType();
$model->save(false);
$this->redirect(array('update', 'id' => $model->id));
}
示例13: getLocationArray
public static function getLocationArray()
{
$locations = Location::model()->findAll();
$list = CHtml::listData($locations, 'id', 'name');
$chooseTranslate = tt("Choose location", 'apartments');
array_unshift($list, $chooseTranslate);
return $list;
}
示例14: faq
public function faq()
{
$this->document->setTitle(tt('General F.A.Q'));
$data['footer'] = $this->load->controller('common/footer');
$data['header'] = $this->load->controller('common/header');
$data['module_breadcrumbs'] = $this->load->controller('module/breadcrumbs', array(array('name' => tt('Home'), 'href' => $this->url->link('common/home'), 'active' => false), array('name' => tt('General F.A.Q'), 'href' => $this->url->link('common/information/faq'), 'active' => true)));
$this->response->setOutput($this->load->view('common/information/faq.tpl', $data));
}
示例15: logoutrecover
public function logoutrecover()
{
if (Session::get('fpwd_timestamp', null) === null) {
tt('No direct access.. Go back');
}
Session::forget('fpwd_userinfo');
Session::forget('fpwd_timestamp');
return Redirect::route('home');
}