本文整理汇总了PHP中humhub\models\Setting::SetText方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::SetText方法的具体用法?PHP Setting::SetText怎么用?PHP Setting::SetText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类humhub\models\Setting
的用法示例。
在下文中一共展示了Setting::SetText方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.";
Setting::SetText('longText', $longText);
Setting::SetText('longText', $longText . "2", 'testModule');
$this->assertEquals(Setting::GetText('longText'), $longText);
$this->assertEquals(Setting::GetText('longText', 'testModule'), $longText . "2");
}
示例2: up
public function up()
{
$allowedExtensions = Setting::Get('allowedExtensions', 'embeddedmedia');
if ($allowedExtensions != "") {
Setting::Set('allowedExtensions', '', 'embeddedmedia');
Setting::SetText('allowedExtensions', $allowedExtensions, 'embeddedmedia');
}
$showFilesWidgetBlacklist = Setting::Get('showFilesWidgetBlacklist', 'embeddedmedia');
if ($showFilesWidgetBlacklist != "") {
Setting::Set('showFilesWidgetBlacklist', '', 'embeddedmedia');
Setting::SetText('showFilesWidgetBlacklist', $showFilesWidgetBlacklist, 'embeddedmedia');
}
}
示例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 = Setting::SetText('anonAccountsFirstNameOptions', $form->anonAccountsFirstNameOptions);
$form->anonAccountsLastNameOptions = Setting::SetText('anonAccountsLastNameOptions', $form->anonAccountsLastNameOptions);
// set flash message
Yii::$app->getSession()->setFlash('data-saved', 'Saved');
return $this->redirect(Url::toRoute('index'));
}
} else {
$form->anonAccountsFirstNameOptions = Setting::GetText('anonAccountsFirstNameOptions');
$form->anonAccountsLastNameOptions = Setting::GetText('anonAccountsLastNameOptions');
}
return $this->render('index', array('model' => $form));
}
示例4: actionIndex
/**
* Configuration Action for Super Admins
*/
public function actionIndex()
{
$form = new EditForm();
$form->title = Setting::Get('title', 'breakingnews');
$form->message = Setting::GetText('message', 'breakingnews');
$form->active = Setting::Get('active', 'breakingnews');
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
Setting::Set('title', $form->title, 'breakingnews');
Setting::SetText('message', $form->message, 'breakingnews');
if ($form->active) {
Setting::Set('active', true, 'breakingnews');
} else {
Setting::Set('active', false, 'breakingnews');
}
if ($form->reset) {
foreach (\humhub\modules\user\models\Setting::findAll(array('name' => 'seen', 'module_id' => 'breakingnews')) as $userSetting) {
$userSetting->delete();
}
}
return $this->redirect(Url::to(['/breakingnews/admin/index']));
}
return $this->render('index', ['model' => $form]);
}
示例5: actionFile
/**
* File Settings
*/
public function actionFile()
{
$form = new \humhub\modules\admin\models\forms\FileSettingsForm();
$form->imageMagickPath = Setting::Get('imageMagickPath', 'file');
$form->maxFileSize = Setting::Get('maxFileSize', 'file') / 1024 / 1024;
$form->maxPreviewImageWidth = Setting::Get('maxPreviewImageWidth', 'file');
$form->maxPreviewImageHeight = Setting::Get('maxPreviewImageHeight', 'file');
$form->hideImageFileInfo = Setting::Get('hideImageFileInfo', 'file');
$form->useXSendfile = Setting::Get('useXSendfile', 'file');
$form->allowedExtensions = Setting::GetText('allowedExtensions', 'file');
$form->showFilesWidgetBlacklist = Setting::GetText('showFilesWidgetBlacklist', 'file');
if ($form->load(Yii::$app->request->post()) && $form->validate()) {
$new = $form->maxFileSize * 1024 * 1024;
Setting::Set('imageMagickPath', $form->imageMagickPath, 'file');
Setting::Set('maxFileSize', $new, 'file');
Setting::Set('maxPreviewImageWidth', $form->maxPreviewImageWidth, 'file');
Setting::Set('maxPreviewImageHeight', $form->maxPreviewImageHeight, 'file');
Setting::Set('hideImageFileInfo', $form->hideImageFileInfo, 'file');
Setting::Set('useXSendfile', $form->useXSendfile, 'file');
Setting::SetText('allowedExtensions', strtolower($form->allowedExtensions), 'file');
Setting::SetText('showFilesWidgetBlacklist', $form->showFilesWidgetBlacklist, 'file');
// set flash message
Yii::$app->getSession()->setFlash('data-saved', Yii::t('AdminModule.controllers_SettingController', 'Saved'));
return Yii::$app->response->redirect(Url::toRoute('/admin/setting/file'));
}
// Determine PHP Upload Max FileSize
$maxUploadSize = \humhub\libs\Helpers::GetBytesOfPHPIniValue(ini_get('upload_max_filesize'));
if ($maxUploadSize > \humhub\libs\Helpers::GetBytesOfPHPIniValue(ini_get('post_max_size'))) {
$maxUploadSize = \humhub\libs\Helpers::GetBytesOfPHPIniValue(ini_get('post_max_size'));
}
$maxUploadSize = floor($maxUploadSize / 1024 / 1024);
// Determine currently used ImageLibary
$currentImageLibary = 'GD';
if (Setting::Get('imageMagickPath', 'file')) {
$currentImageLibary = 'ImageMagick';
}
return $this->render('file', array('model' => $form, 'maxUploadSize' => $maxUploadSize, 'currentImageLibary' => $currentImageLibary));
}
示例6: setProviders
/**
* Saves an array of available OEmbed providers
*
* @param array $providers
*/
public static function setProviders($providers)
{
Setting::SetText('oembedProviders', \yii\helpers\Json::encode($providers));
}