本文整理汇总了PHP中HSetting::SetText方法的典型用法代码示例。如果您正苦于以下问题:PHP HSetting::SetText方法的具体用法?PHP HSetting::SetText怎么用?PHP HSetting::SetText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HSetting
的用法示例。
在下文中一共展示了HSetting::SetText方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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'), "");
}
示例2: up
public function up()
{
$allowedExtensions = HSetting::Get('allowedExtensions', 'file');
if ($allowedExtensions != "") {
HSetting::Set('allowedExtensions', '', 'file');
HSetting::SetText('allowedExtensions', $allowedExtensions, 'file');
}
$showFilesWidgetBlacklist = HSetting::Get('showFilesWidgetBlacklist', 'file');
if ($showFilesWidgetBlacklist != "") {
HSetting::Set('showFilesWidgetBlacklist', '', 'file');
HSetting::SetText('showFilesWidgetBlacklist', $showFilesWidgetBlacklist, 'file');
}
}
示例3: actionIndex
/**
* Configuration Action for Super Admins
*/
public function actionIndex()
{
$form = new AnonAccountsForm();
if (isset($_POST['AnonAccountsForm'])) {
$form->attributes = $_POST['AnonAccountsForm'];
if ($form->validate()) {
$form->anonAccountsFirstNameOptions = HSetting::SetText('anonAccountsFirstNameOptions', $form->anonAccountsFirstNameOptions);
$form->anonAccountsLastNameOptions = HSetting::SetText('anonAccountsLastNameOptions', $form->anonAccountsLastNameOptions);
// set flash message
Yii::app()->user->setFlash('data-saved', Yii::t('AdminModule.controllers_SettingController', 'Saved'));
$this->redirect(Yii::app()->createUrl('//anon_accounts/admin/index'));
}
} else {
$form->anonAccountsFirstNameOptions = HSetting::GetText('anonAccountsFirstNameOptions');
$form->anonAccountsLastNameOptions = HSetting::GetText('anonAccountsLastNameOptions');
}
$this->render('index', array('model' => $form));
}
示例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: 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));
}
示例6: 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));
}
示例7: setProviders
/**
* Saves an array of available OEmbed providers
*
* @param array $providers
*/
public static function setProviders($providers)
{
HSetting::SetText('oembedProviders', CJSON::encode($providers));
}
示例8: 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;
}