本文整理汇总了PHP中tc函数的典型用法代码示例。如果您正苦于以下问题:PHP tc函数的具体用法?PHP tc怎么用?PHP tc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: installOrUpgrade
private function installOrUpgrade($pkg, $fromVersion)
{
$at = AttributeType::getByHandle('handle_https');
if (!is_object($at)) {
$at = AttributeType::add('handle_https', tc('AttributeTypeName', 'HTTPS handling'), $pkg);
}
$akc = AttributeKeyCategory::getByHandle('collection');
if (is_object($akc)) {
if (!$akc->hasAttributeKeyTypeAssociated($at)) {
$akc->associateAttributeKeyType($at);
}
}
if (empty($fromVersion)) {
$ak = CollectionAttributeKey::getByHandle('handle_https');
if (!is_object($ak)) {
$hhh = Loader::helper('https_handling', 'handle_https');
/* @var $hhh HttpsHandlingHelper */
$httpDomain = defined('BASE_URL') ? BASE_URL : Config::get('BASE_URL');
if (!$httpDomain) {
$httpDomain = 'http://' . $hhh->getRequestDomain();
}
$httpsDomain = defined('BASE_URL_SSL') ? BASE_URL_SSL : Config::get('BASE_URL_SSL');
if (!$httpsDomain) {
$httpsDomain = 'https://' . $hhh->getRequestDomain();
}
$ak = CollectionAttributeKey::add($at, array('akHandle' => 'handle_https', 'akName' => tc('AttributeKeyName', 'Page HTTP/HTTPS'), 'akIsSearchable' => 1, 'akIsSearchableIndexed' => 1, 'akIsAutoCreated' => 1, 'akIsEditable' => 1, 'akIsInternal' => 0, 'akEnabled' => 0, 'akDefaultRequirement' => HttpsHandlingHelper::SSLHANDLING_DOESNOT_MATTER, 'akCustomDomains' => 0, 'akHTTPDomain' => $httpDomain, 'akHTTPSDomain' => $httpsDomain), $pkg);
}
}
}
示例2: filterByKeywords
public function filterByKeywords($kw)
{
static $reverseLookup = array();
$db = Loader::db();
$locale = Localization::activeLocale();
if (!array_key_exists($locale, $reverseLookup)) {
$reverseLookup[$locale] = false;
if (Localization::activeLocale() != 'en_US' || ENABLE_TRANSLATE_LOCALE_EN_US) {
$limit = defined('GROUPNAME_REVERSELOOKUP_LIMIT') ? GROUPNAME_REVERSELOOKUP_LIMIT : 100;
$count = $db->GetOne('select count(*) from Groups');
if ($count > 0 && $count <= $limit) {
$reverseLookup[$locale] = array();
$rs = $db->Query('select gID, gName, gDescription from Groups');
while ($row = $rs->FetchRow()) {
$reverseLookup[$locale][$row['gID']] = array('name' => tc('GroupName', $row['gName']), 'description' => tc('GroupDescription', $row['gDescription']));
}
$rs->Close();
}
}
}
if ($reverseLookup[$locale]) {
$foundIDs = array();
foreach ($reverseLookup[$locale] as $gID => $gTranslated) {
if (stripos($gTranslated['name'], $kw) !== false || stripos($gTranslated['description'], $kw) !== false) {
$foundIDs[] = $gID;
}
}
if (count($foundIDs)) {
$this->filter(false, '(Groups.gID in (' . implode(', ', $foundIDs) . '))');
return;
}
}
$this->filter(false, "(Groups.gName like " . $db->qstr('%' . $kw . '%') . " or Groups.gDescription like " . $db->qstr('%' . $kw . '%') . ")");
}
示例3: actionAdmin
public function actionAdmin()
{
$this->getMaxSorter();
$this->getMinSorter();
Yii::app()->user->setFlash('warning', Yii::t('module_lang', 'moduleAdminHelp', array('{link}' => CHtml::link(tc('Currency'), array('/currency/backend/main/admin')))));
parent::actionAdmin();
}
示例4: getServiceLink
public function getServiceLink(Page $c = null)
{
if (!is_object($c)) {
$c = \Page::getCurrentPage();
}
if (is_object($c) && !$c->isError()) {
$url = urlencode($c->getCollectionLink(true));
switch ($this->getHandle()) {
case 'facebook':
return "https://www.facebook.com/sharer/sharer.php?u={$url}";
case 'twitter':
return "https://www.twitter.com/intent/tweet?url={$url}";
case 'linkedin':
$title = urlencode($c->getCollectionName());
return "https://www.linkedin.com/shareArticle?mini-true&url={$url}&title={$title}";
case 'pinterest':
return "https://www.pinterest.com/pin/create/button?url={$url}";
case 'google_plus':
return "https://plus.google.com/share?url={$url}";
case 'reddit':
return "https://www.reddit.com/submit?url={$url}";
case 'print':
return "javascript:window.print();";
case 'email':
$body = rawurlencode(t("Check out this article on %s:\n\n%s\n%s", tc('SiteName', Config::get('concrete.site')), $c->getCollectionName(), urldecode($url)));
$subject = rawurlencode(t('Thought you\'d enjoy this article.'));
return "mailto:?body={$body}&subject={$subject}";
}
}
}
示例5: jsonOk
public static function jsonOk($msg = 'Success', $params = array())
{
$msg = $msg == 'Success' ? tc('Success') : $msg;
$params = CMap::mergeArray(array('status' => self::STATUS_OK, 'msg' => $msg), $params);
echo CJSON::encode($params);
Yii::app()->end();
}
示例6: actionUpdate
public function actionUpdate($id)
{
$model = $this->loadModel($id);
$model->scenario = 'update';
$this->performAjaxValidation($model);
if (isset($_POST[$this->modelName])) {
$model->attributes = $_POST[$this->modelName];
if (isset($_POST[$this->modelName]['password']) && $_POST[$this->modelName]['password']) {
if (demo()) {
Yii::app()->user->setFlash('error', tc('Sorry, this action is not allowed on the demo server.'));
unset($model->password, $model->salt);
$this->redirect(array('update', 'id' => $model->id));
} else {
$model->scenario = 'changePass';
}
} else {
unset($model->password, $model->salt);
}
if ($model->validate()) {
if ($model->scenario == 'changePass') {
$model->setPassword();
}
if ($model->save(false)) {
$this->redirect(array('view', 'id' => $model->id));
}
}
}
$this->render('update', array('model' => $model));
}
示例7: actionIndex
public function actionIndex()
{
$model = $this->loadModel(Yii::app()->user->id);
if (isset($_POST[$this->modelName])) {
$model->scenario = 'changeAdminPass';
$model->old_password = $_POST[$this->modelName]['old_password'];
if ($model->validatePassword($model->old_password)) {
if (demo()) {
Yii::app()->user->setFlash('error', tc('Sorry, this action is not allowed on the demo server.'));
$this->redirect(array('index'));
}
$model->attributes = $_POST[$this->modelName];
if ($model->validate()) {
$model->setPassword();
$model->save(false);
Yii::app()->user->setFlash('success', Yii::t('module_usercpanel', 'Your password successfully changed.'));
$this->redirect(array('index'));
}
} else {
Yii::app()->user->setFlash('error', Yii::t('module_adminpass', 'Wrong admin password! Try again.'));
$this->redirect(array('index'));
}
}
$this->render('index', array('model' => $model));
}
示例8: actionUpdate
public function actionUpdate($id)
{
$model = $this->loadModel($id);
if (isset($_POST["{$this->modelName}"])) {
$model->attributes = $_POST["{$this->modelName}"];
$newImage = isset($_FILES['Themes']) && $_FILES['Themes']['name']['upload_img'];
if ($newImage) {
// delete old image
$model->delImage();
$model->scenario = 'upload';
}
if ($model->validate()) {
if ($newImage) {
$model->upload = CUploadedFile::getInstance($model, 'upload_img');
$model->bg_image = md5(uniqid()) . '.' . $model->upload->extensionName;
}
if ($model->save()) {
if ($newImage) {
$model->upload->saveAs(Yii::getPathOfAlias($model->path) . '/' . $model->bg_image);
Yii::app()->user->setFlash('success', tt('Image successfully added', 'themes'));
} else {
Yii::app()->user->setFlash('success', tc('Success'));
}
$this->refresh();
}
}
}
$this->render('update', array('model' => $model));
}
示例9: setUp
public function setUp()
{
parent::setUp();
$g1 = Group::add(tc("GroupName", "Guest"), tc("GroupDescription", "The guest group represents unregistered visitors to your site."), false, false, GUEST_GROUP_ID);
$g2 = Group::add(tc("GroupName", "Registered Users"), tc("GroupDescription", "The registered users group represents all user accounts."), false, false, REGISTERED_GROUP_ID);
$g3 = Group::add(tc("GroupName", "Administrators"), "", false, false, ADMIN_GROUP_ID);
}
示例10: label
public function label($customText = false) {
if ($customText == false) {
$text = tc('AttributeKeyName', $this->attributeKey->getAttributeKeyName());
} else {
$text = $customText;
}
print Loader::helper('form')->label($this->field('value'), $text);
}
示例11: registerClientScriptJQuerySimpleCaptchaImage
public function registerClientScriptJQuerySimpleCaptchaImage()
{
Yii::app()->clientScript->registerCssFile(Yii::app()->getBaseUrl(true) . '/common/js/antispam/jquerySimpleCCaptcha/jquery.simpleCaptcha.css');
Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl(true) . '/common/js/antispam/jquerySimpleCCaptcha/jquery.simpleCaptcha.js');
$cs = Yii::app()->clientScript;
$id = $this->imageOptions['id'];
$js = "";
$js .= "\n\$(document).ready(function() {\n\t\t\tvar parentBlockTmp = \$('#" . $this->imageOptions['id'] . "').parent();\n\t\t\t//var verifyCodeInput = \$(parentBlockTmp).find('input[type=text]');\n\t\t\tvar verifyCodeInput = \$(parentBlockTmp).find('input[id\$=\"_verifyCode\"]');\n\n\t\t\tif (verifyCodeInput && typeof verifyCodeInput !== 'undefined') {\n\t\t\t\tverifyCodeInput.hide();\n\t\t\t}\n\n\t\t\t\$('#" . $this->imageOptions['id'] . "')\n\t\t\t\t.simpleCaptcha({\n\t\t\t\t\tnumImages: 4,\n\t\t\t\t\tintroText: '" . tc('jquerySimpleCaptchaIntroText') . "',\n\t\t\t\t\tallowRefresh : false,\n\t\t\t\t\tscriptPath: '" . $this->getController()->createUrl('/antispam/jquerysimpleccaptcha/renderimages') . "',\n\t\t\t\t\tlanguage : '" . Yii::app()->language . "',\n\t\t\t\t\tverifyCodeInput : verifyCodeInput\n\t\t\t\t});\n\n\t\t});\n";
$cs->registerScript('Yii.CCaptcha#' . $id, $js);
}
示例12: __construct
public function __construct()
{
parent::__construct();
$otypes = AttributeType::getList('file');
$types = array();
foreach ($otypes as $at) {
$types[$at->getAttributeTypeID()] = tc('AttributeTypeName', $at->getAttributeTypeName());
}
$this->set('types', $types);
}
示例13: getAccessEntityTypeDisplayName
/** Returns the display name for this access entity type (localized and escaped accordingly to $format)
* @param string $format = 'html'
* Escape the result in html format (if $format is 'html').
* If $format is 'text' or any other value, the display name won't be escaped.
* @return string
*/
public function getAccessEntityTypeDisplayName($format = 'html')
{
$value = tc('PermissionAccessEntityTypeName', $this->getAccessEntityTypeName());
switch ($format) {
case 'html':
return h($value);
case 'text':
default:
return $value;
}
}
示例14: getSelectAttributeOptionDisplayValue
/** Returns the display name for this select option value (localized and escaped accordingly to $format)
* @param string $format = 'html'
* Escape the result in html format (if $format is 'html').
* If $format is 'text' or any other value, the display name won't be escaped.
* @return string
*/
public function getSelectAttributeOptionDisplayValue($format = 'html')
{
$value = tc('SelectAttributeValue', $this->getSelectAttributeOptionValue(false));
switch ($format) {
case 'html':
return h($value);
case 'text':
default:
return $value;
}
}
示例15: getTreeDisplayName
/** Returns the display name for this tree (localized and escaped accordingly to $format)
* @param string $format = 'html' Escape the result in html format (if $format is 'html'). If $format is 'text' or any other value, the display name won't be escaped.
* @return string
*/
public function getTreeDisplayName($format = 'html')
{
$value = tc('TreeName', $this->topicTreeName);
switch ($format) {
case 'html':
return h($value);
case 'text':
default:
return $value;
}
}