本文整理汇总了PHP中HSetting::GetText方法的典型用法代码示例。如果您正苦于以下问题:PHP HSetting::GetText方法的具体用法?PHP HSetting::GetText怎么用?PHP HSetting::GetText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HSetting
的用法示例。
在下文中一共展示了HSetting::GetText方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Executes the widget.
*/
public function run()
{
$blacklisted_objects = explode(',', HSetting::GetText('showFilesWidgetBlacklist', 'file'));
if (!in_array(get_class($this->object), $blacklisted_objects)) {
$files = File::getFilesOfObject($this->object);
$this->render('showFiles', array('files' => $files, 'maxPreviewImageWidth' => HSetting::Get('maxPreviewImageWidth', 'file'), 'maxPreviewImageHeight' => HSetting::Get('maxPreviewImageHeight', 'file'), 'hideImageFileInfo' => HSetting::Get('hideImageFileInfo', 'file')));
}
}
示例2: testTextSettings
public function testTextSettings()
{
$longText = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.";
HSetting::SetText('longText', $longText);
HSetting::SetText('longText', $longText . "2", 'testModule');
$this->assertEquals(HSetting::GetText('longText'), $longText);
$this->assertEquals(HSetting::GetText('longText', 'testModule'), $longText . "2");
$this->assertEquals(HSetting::Get('longText'), "");
}
示例3: actionRand
/**
* Prototyping the random name generator
*/
public function actionRand()
{
$assetPrefix = Yii::app()->assetManager->publish(dirname(__FILE__) . '/../resources', true, 0, defined('YII_DEBUG'));
Yii::app()->clientScript->registerScriptFile($assetPrefix . '/md5.min.js');
Yii::app()->clientScript->registerScriptFile($assetPrefix . '/jdenticon-1.3.0.min.js');
$firstNameOptions = explode("\n", HSetting::GetText('anonAccountsFirstNameOptions'));
$randomFirstName = ucfirst($firstNameOptions[array_rand($firstNameOptions)]);
$lastNameOptions = explode("\n", HSetting::GetText('anonAccountsLastNameOptions'));
$randomLastName = ucfirst($lastNameOptions[array_rand($lastNameOptions)]);
////// Save DataURL as Image ///////
// @TODO: Pull this from $_POST
// $data = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAGVklEQVR4Xu3dPXDURhQH8LdnUofKbUgJheN0KSAmpamS2inOPc6QOp7BmSF1mDi9j8J1UuEyJrigi3EBZaB1BfUZL7Oy5VHk1X69/5NW8dLe6d2+/emtTrfPQlH5l9UMqKxGUwZDBSSzk6CAFJDMZiCz4ZQKKSCZzUBmwykVMjaQZ0fHGjzmJytLi1NwTJFwfx8dTzXRDjL4ytKiswi8FQIGGQ1GjYBGyQlkdBgSKLmARGF89WDvxien6gtNelmROpxP9MsXj1ffcJYObkxUpeQAEoxhJu3aB9pRiu62J19r2j9ZoPVYGGRMBMrQIMEYdzb2pqT0r0Tqencl6Hek1Y/Pt1dnIdUiEZOLMiRIMMbZcqL/cWPUBPrdfKK+9FWKREzENWUokGAMk+Ttjb2/bMtUVxWY5etge/UbV5VIxGx+XmqlDAEShXF2JtO/IUtQ8z3zCX3eVSUSMW3jS0HpGyQKwyR55/7Tb2mi/ogFoVP93fPf7/1pO04iZtf4YlH6BInGqJarH/a2FNHDWBBN9PPBb6tbtuMkYrrGF4PSF0gSxv+hQmIv9H2AJGOYZCTWe4mYIRUcUinSICyMOsnbG0/3lVIrIUmb92itnx1s37t089g8XiJmyPh8KJIgEIyLKvlAh6ToU2/Smt7PF2g56D4EHNM7tvM3uFCkQGAYdZLVXTXRYyeKpvdE9CDqTh0ck4siAQLHq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UieYBiZghRJIPMBNHkWgekIgZAmHeY3sYJuJ5WZcepSRRKRLNAxIxORjmWBEQ9PIl0TwgEZOLIQqCRJFoHoiP6X84cwjIkA9ShlxTUJtezcmSiInAEK+QepCcawpqW7g5YRIxfSC+yqiPF7uGtAeYiiLRPCAR0wUSitFbhXAqReJslojZBRKD0TtIyoVeYr2XiGkDicUYBCQFBdE40Z4wiZjNz0jBGAwkFgXxdIg2iETM+jNSMQYFiUXhPh3CtqRIxORgDA4Si8J5OkTXRRcZk4uRBUgsinm/RPMANyYCIxuQFBTfjVifr6MwsgIZKwoSIzuQsaGgMSAgfS4N5bOIBunLKhPfPQMFJLOzo4AUkMxmILPhlAopIJnNQGbDKRWSGchHZ+U6znsxaNkAAAAASUVORK5CYII=";
// $filePath = dirname(__FILE__) . '/../resources/test.png';
// $fp = fopen($filePath,"w");
// fwrite($fp, file_get_contents($data));
// fclose($fp);
////////////////////////////////////
$model = new AnonAccountRegisterForm();
if (isset($_POST['AnonAccountRegisterForm'])) {
// Pre-set the random first and last name
$model->firstName = trim($randomFirstName);
$model->lastName = trim($randomLastName);
// Load attributes into the model
$model->attributes = $_POST['AnonAccountRegisterForm'];
// Make the username from the first and lastnames
$model->username = strtolower($model->firstName . "_" . $model->lastName);
// Validate
if ($model->validate()) {
// Create temporary file
$temp_file_name = tempnam(sys_get_temp_dir(), 'img') . '.png';
$fp = fopen($temp_file_name, "w");
fwrite($fp, file_get_contents($model->image));
fclose($fp);
// Store profile image for user
$profileImage = new ProfileImage($model->guid);
$profileImage->setNew($temp_file_name);
// Remove temporary file
unlink($temp_file_name);
// Finished. Redirect away!
$this->redirect($this->createUrl('//anon_accounts/admin/rand', array()));
} else {
echo "Error processing account register form";
}
}
$this->render('test', array('firstName' => $randomFirstName, 'lastName' => $randomLastName, 'model' => $model));
}
示例4: actionIndex
/**
* Configuration Action for Super Admins
*/
public function actionIndex()
{
$form = new ExtendSearchSettingsForm();
if (isset($_POST['ExtendSearchSettingsForm'])) {
$form->attributes = $_POST['ExtendSearchSettingsForm'];
if ($form->validate()) {
// Validate JSON by running it through json_decode
if (empty(json_decode($form->extendSearchJSON))) {
$form->addError('extendSearchJSON', 'JSON is invalid or empty.');
} else {
$form->extendSearchJSON = HSetting::SetText('extendSearchJSON', $form->extendSearchJSON);
Yii::app()->user->setFlash('data-saved', Yii::t('AdminModule.controllers_SettingController', 'Saved'));
$this->redirect(Yii::app()->createUrl('//extend_search/admin/index'));
}
}
} else {
$form->extendSearchJSON = HSetting::GetText('extendSearchJSON');
}
$this->render('index', array('model' => $form));
}
示例5: actionIndex
public function actionIndex()
{
$_POST = Yii::app()->input->stripClean($_POST);
$assetPrefix = Yii::app()->assetManager->publish(dirname(__FILE__) . '/../resources', true, 0, defined('YII_DEBUG'));
Yii::app()->clientScript->registerScriptFile($assetPrefix . '/md5.min.js');
Yii::app()->clientScript->registerScriptFile($assetPrefix . '/jdenticon-1.3.0.min.js');
$needApproval = HSetting::Get('needApproval', 'authentication_internal');
if (!Yii::app()->user->isGuest) {
throw new CHttpException(401, 'Your are already logged in! - Logout first!');
}
// Check for valid user invite
$userInvite = UserInvite::model()->findByAttributes(array('token' => Yii::app()->request->getQuery('token')));
if (!$userInvite) {
throw new CHttpException(404, 'Token not found!');
}
if ($userInvite->language) {
Yii::app()->setLanguage($userInvite->language);
}
$userModel = new User('register');
$userModel->email = $userInvite->email;
$userPasswordModel = new UserPassword('newPassword');
$profileModel = $userModel->profile;
$profileModel->scenario = 'register';
///////////////////////////////////////////////////////
// Generate a random first name
$firstNameOptions = explode("\n", HSetting::GetText('anonAccountsFirstNameOptions'));
$randomFirstName = trim(ucfirst($firstNameOptions[array_rand($firstNameOptions)]));
// Generate a random last name
$lastNameOptions = explode("\n", HSetting::GetText('anonAccountsLastNameOptions'));
$randomLastName = trim(ucfirst($lastNameOptions[array_rand($lastNameOptions)]));
// Pre-set the random first and last name
$profileModel->lastname = $randomLastName;
$profileModel->firstname = $randomFirstName;
// Make the username from the first and lastnames (only first 25 chars)
$userModel->username = substr(str_replace(" ", "_", strtolower($profileModel->firstname . "_" . $profileModel->lastname)), 0, 25);
///////////////////////////////////////////////////////
// Build Form Definition
$definition = array();
$definition['elements'] = array();
$groupModels = Group::model()->findAll(array('order' => 'name'));
$defaultUserGroup = HSetting::Get('defaultUserGroup', 'authentication_internal');
$groupFieldType = "dropdownlist";
if ($defaultUserGroup != "") {
$groupFieldType = "hidden";
} else {
if (count($groupModels) == 1) {
$groupFieldType = "hidden";
$defaultUserGroup = $groupModels[0]->id;
}
}
// Add Identicon Form
$identiconForm = new IdenticonForm();
$definition['elements']['IdenticonForm'] = array('type' => 'form', 'elements' => array('image' => array('type' => 'hidden', 'class' => 'form-control', 'id' => 'image')));
// Add Profile Form
$definition['elements']['Profile'] = array_merge(array('type' => 'form'), $profileModel->getFormDefinition());
// Add User Form
$definition['elements']['User'] = array('type' => 'form', 'title' => 'Password', 'elements' => array('username' => array('type' => 'hidden', 'class' => 'form-control', 'maxlength' => 25), 'email' => array('type' => 'hidden', 'class' => 'form-control'), 'group_id' => array('type' => $groupFieldType, 'class' => 'form-control', 'items' => CHtml::listData($groupModels, 'id', 'name'), 'value' => $defaultUserGroup)));
// Add User Password Form
$definition['elements']['UserPassword'] = array('type' => 'form', 'elements' => array('newPassword' => array('type' => 'password', 'class' => 'form-control', 'maxlength' => 255), 'newPasswordConfirm' => array('type' => 'password', 'class' => 'form-control', 'maxlength' => 255)));
// Get Form Definition
$definition['buttons'] = array('save' => array('type' => 'submit', 'class' => 'btn btn-primary', 'label' => Yii::t('UserModule.controllers_AuthController', 'Create account')));
$form = new HForm($definition);
$form['User']->model = $userModel;
$form['UserPassword']->model = $userPasswordModel;
$form['Profile']->model = $profileModel;
$form['IdenticonForm']->model = $identiconForm;
/// ----- WE DONT WANT TO SAVE YET -------
if ($form->submitted('save') && $form->validate() && $identiconForm->validate()) {
$this->forcePostRequest();
// Registe User
$form['User']->model->email = $userInvite->email;
$form['User']->model->language = Yii::app()->getLanguage();
if ($form['User']->model->save()) {
// Save User Profile
$form['Profile']->model->user_id = $form['User']->model->id;
$form['Profile']->model->save();
// Save User Password
$form['UserPassword']->model->user_id = $form['User']->model->id;
$form['UserPassword']->model->setPassword($form['UserPassword']->model->newPassword);
$form['UserPassword']->model->save();
// Autologin user
if (!$needApproval) {
$user = $form['User']->model;
$newIdentity = new UserIdentity($user->username, '');
$newIdentity->fakeAuthenticate();
Yii::app()->user->login($newIdentity);
// Prepend Data URI scheme (stripped out for safety)
$identiconForm->image = str_replace("[removed]", "data:image/png;base64,", $identiconForm->image);
// Upload new Profile Picture for user
$this->uploadProfilePicture(Yii::app()->user->guid, $identiconForm->image);
// Redirect to dashboard
$this->redirect(array('//dashboard/dashboard'));
return;
}
$this->render('createAccount_success', array('form' => $form, 'needApproval' => $needApproval));
return;
}
}
$this->render('createAccount', array('form' => $form, 'identiconForm' => $identiconForm, 'needAproval' => $needApproval));
}
示例6: Modal
?>
<!-- start: Modal (every lightbox will/should use this construct to show content)-->
<div class="modal" id="globalModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div class="loader">
<div class="sk-spinner sk-spinner-three-bounce">
<div class="sk-bounce1"></div>
<div class="sk-bounce2"></div>
<div class="sk-bounce3"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- end: Modal -->
<script type="text/javascript">
// Replace the standard checkbox and radio buttons
$('body').find(':checkbox, :radio').flatelements();
</script>
<?php
echo HSetting::GetText('trackingHtmlCode');
?>
</body>
</html>
示例7: actionStatistic
/**
* Statistic Settings
*/
public function actionStatistic()
{
Yii::import('admin.forms.*');
$form = new StatisticSettingsForm();
// uncomment the following code to enable ajax-based validation
if (isset($_POST['ajax']) && $_POST['ajax'] === 'statistic-settings-form') {
echo CActiveForm::validate($form);
Yii::app()->end();
}
if (isset($_POST['StatisticSettingsForm'])) {
#$_POST['StatisticSettingsForm'] = Yii::app()->input->stripClean($_POST['StatisticSettingsForm']);
$form->attributes = $_POST['StatisticSettingsForm'];
if ($form->validate()) {
$form->trackingHtmlCode = HSetting::SetText('trackingHtmlCode', $form->trackingHtmlCode);
// set flash message
Yii::app()->user->setFlash('data-saved', Yii::t('AdminModule.controllers_SettingController', 'Saved'));
$this->redirect(Yii::app()->createUrl('//admin/setting/statistic'));
}
} else {
$form->trackingHtmlCode = HSetting::GetText('trackingHtmlCode');
}
$this->render('statistic', array('model' => $form));
}
示例8: actionFile
/**
* File Settings
*/
public function actionFile()
{
Yii::import('admin.forms.*');
$form = new FileSettingsForm();
$form->imageMagickPath = HSetting::Get('imageMagickPath', 'file');
$form->maxFileSize = HSetting::Get('maxFileSize', 'file') / 1024 / 1024;
$form->maxPreviewImageWidth = HSetting::Get('maxPreviewImageWidth', 'file');
$form->maxPreviewImageHeight = HSetting::Get('maxPreviewImageHeight', 'file');
$form->hideImageFileInfo = HSetting::Get('hideImageFileInfo', 'file');
$form->useXSendfile = HSetting::Get('useXSendfile', 'file');
$form->allowedExtensions = HSetting::GetText('allowedExtensions', 'file');
$form->showFilesWidgetBlacklist = HSetting::GetText('showFilesWidgetBlacklist', 'file');
// Ajax Validation
if (isset($_POST['ajax']) && $_POST['ajax'] === 'file-settings-form') {
echo CActiveForm::validate($form);
Yii::app()->end();
}
if (isset($_POST['FileSettingsForm'])) {
$form->attributes = $_POST['FileSettingsForm'];
if ($form->validate()) {
$form->imageMagickPath = HSetting::Set('imageMagickPath', $form->imageMagickPath, 'file');
$form->maxFileSize = HSetting::Set('maxFileSize', $form->maxFileSize * 1024 * 1024, 'file');
$form->maxPreviewImageWidth = HSetting::Set('maxPreviewImageWidth', $form->maxPreviewImageWidth, 'file');
$form->maxPreviewImageHeight = HSetting::Set('maxPreviewImageHeight', $form->maxPreviewImageHeight, 'file');
$form->hideImageFileInfo = HSetting::Set('hideImageFileInfo', $form->hideImageFileInfo, 'file');
$form->useXSendfile = HSetting::Set('useXSendfile', $form->useXSendfile, 'file');
$form->allowedExtensions = HSetting::SetText('allowedExtensions', strtolower($form->allowedExtensions), 'file');
$form->showFilesWidgetBlacklist = HSetting::SetText('showFilesWidgetBlacklist', $form->showFilesWidgetBlacklist, 'file');
// set flash message
Yii::app()->user->setFlash('data-saved', Yii::t('AdminModule.controllers_SettingController', 'Saved'));
$this->redirect(Yii::app()->createUrl('//admin/setting/file'));
}
}
// Determine PHP Upload Max FileSize
$maxUploadSize = Helpers::GetBytesOfPHPIniValue(ini_get('upload_max_filesize'));
if ($maxUploadSize > Helpers::GetBytesOfPHPIniValue(ini_get('post_max_size'))) {
$maxUploadSize = Helpers::GetBytesOfPHPIniValue(ini_get('post_max_size'));
}
$maxUploadSize = floor($maxUploadSize / 1024 / 1024);
// Determine currently used ImageLibary
$currentImageLibary = 'GD';
if (HSetting::Get('imageMagickPath', 'file')) {
$currentImageLibary = 'ImageMagick';
}
$this->render('file', array('model' => $form, 'maxUploadSize' => $maxUploadSize, 'currentImageLibary' => $currentImageLibary));
}
示例9: getProviders
/**
* Returns all available OEmbed providers
*
* @return array
*/
public static function getProviders()
{
$providers = HSetting::GetText('oembedProviders');
if ($providers != "") {
return CJSON::decode($providers);
}
return array();
}
示例10: generateQueryStr
/**
* Generates a query string based on the provided
* JSON of Models and Attributes
*/
private function generateQueryStr($keyword)
{
// First, if there's no extendSearchJSON HSetting, add it
$form = new ExtendSearchSettingsForm();
if (empty(HSetting::GetText('extendSearchJSON'))) {
HSetting::SetText('extendSearchJSON', $form->default_extendSearchJSON);
}
// Generate Query String
$str = "{$keyword}* AND ";
$extendSearchJSON = json_decode(HSetting::GetText('extendSearchJSON'));
$extendSearchArray = (array) $extendSearchJSON;
$numberOfItems = count($extendSearchArray) - 1;
$itemCount = 0;
foreach ($extendSearchJSON as $key => $extendSearchItem) {
$str .= "(model:{$key} ";
if (count($extendSearchItem) > 0) {
$numberOfAttributes = count($extendSearchItem) - 1;
$attributeCount = 0;
$str .= "AND (";
foreach ($extendSearchItem as $attribute) {
$str .= "{$attribute}: {$keyword}* ";
if ($attributeCount < $numberOfAttributes) {
$str .= " OR ";
}
$attributeCount++;
}
$str .= ")) ";
} else {
$str .= ") ";
}
if ($itemCount < $numberOfItems) {
$str .= " OR ";
}
$itemCount++;
}
return $str;
}
示例11: validateExtension
public function validateExtension($attribute, $params)
{
$allowedExtensions = HSetting::GetText('allowedExtensions', 'file');
if ($allowedExtensions != "") {
$extension = $this->getExtension();
$extension = trim(strtolower($extension));
$allowed = array_map('trim', explode(",", HSetting::GetText('allowedExtensions', 'file')));
if (!in_array($extension, $allowed)) {
$this->addError($attribute, Yii::t('FileModule.models_File', 'This file type is not allowed!'));
}
}
}