本文整理汇总了PHP中HSetting::get方法的典型用法代码示例。如果您正苦于以下问题:PHP HSetting::get方法的具体用法?PHP HSetting::get怎么用?PHP HSetting::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HSetting
的用法示例。
在下文中一共展示了HSetting::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateExtension
/**
* Validate the file extensions.
*/
public function validateExtension($attribute, $params)
{
$allowedExtensions = HSetting::get('allowedExtensions', 'album');
if ($allowedExtensions != "") {
$extension = $this->getExtension();
$extension = trim(strtolower($extension));
$allowed = array_map('trim', explode(",", $allowedExtensions));
if (!in_array($extension, $allowed)) {
$this->addError($attribute, 'This file type is not allowed!');
}
}
}
示例2: actionIndex
public function actionIndex()
{
$model = new AlbumSettings();
$model->allowedExtensions = HSetting::get('allowedExtensions', 'album');
if (isset($_POST['AlbumSettings'])) {
$model->attributes = $_POST['AlbumSettings'];
if ($model->validate()) {
HSetting::set('allowedExtensions', $model->allowedExtensions, 'album');
// set flash message
Yii::app()->user->setFlash('data-saved', 'Saved');
$this->redirect(Yii::app()->createUrl('//album/setting'));
}
}
$this->render('index', compact('model'));
}
示例3: run
<div class="panel panel-default">
<div class="panel-heading"><?php
echo Yii::t('AdminModule.views_setting_cronjob', '<strong>CronJob</strong> settings');
?>
</div>
<div class="panel-body">
<p>
<strong>Status:</strong><br/>
<?php
$lastRunHourly = HSetting::get('cronLastHourlyRun');
$lastRunDaily = HSetting::get('cronLastDailyRun');
if ($lastRunHourly == "") {
$lastRunHourly = "<span style='color:red'>" . Yii::t('AdminModule.views_setting_cronjob', 'Never') . "</span>";
} else {
$lastRunHourly = HHtml::timeago($lastRunHourly);
}
if ($lastRunDaily == "") {
$lastRunDaily = "<span style='color:red'>" . Yii::t('AdminModule.views_setting_cronjob', 'Never') . "</span>";
} else {
$lastRunDaily = HHtml::timeago($lastRunDaily);
}
?>
<?php
echo Yii::t('AdminModule.views_setting_cronjob', 'Last run (hourly):');
?>
<?php
echo $lastRunHourly;
?>
<br/>