1
|
|
|
<?php
|
2
|
|
|
|
3
|
|
|
class GeneralSettings extends CiiSettingsModel
|
|
|
|
|
4
|
|
|
{
|
5
|
|
|
protected $name = NULL;
|
6
|
|
|
|
7
|
|
|
protected $dateFormat = 'F jS, Y';
|
8
|
|
|
|
9
|
|
|
protected $timeFormat = 'H:i';
|
10
|
|
|
|
11
|
|
|
protected $defaultLanguage = 'en_US';
|
12
|
|
|
|
13
|
|
|
protected $forceSecureSSL = false;
|
14
|
|
|
|
15
|
|
|
protected $bcrypt_cost = 13;
|
16
|
|
|
|
17
|
|
|
protected $searchPaginationSize = 10;
|
18
|
|
|
|
19
|
|
|
protected $categoryPaginationSize = 10;
|
20
|
|
|
|
21
|
|
|
protected $contentPaginationSize = 10;
|
22
|
|
|
|
23
|
|
|
protected $useDisqusComments = 0;
|
24
|
|
|
|
25
|
|
|
protected $disqus_shortname = NULL;
|
26
|
|
|
|
27
|
|
|
//protected $useDiscourseComments = 0;
|
|
|
|
|
28
|
|
|
|
29
|
|
|
//protected $discourseUrl = '';
|
|
|
|
|
30
|
|
|
|
31
|
|
|
public function groups()
|
32
|
|
|
{
|
33
|
|
|
return array(
|
34
|
|
|
Yii::t('ciims.models.general', 'Site Settings') => array('name', 'forceSecureSSL', 'bcrypt_cost', 'categoryPaginationSize','contentPaginationSize','searchPaginationSize'),
|
35
|
|
|
Yii::t('ciims.models.general', 'Disqus') => array('useDisqusComments', 'disqus_shortname'),
|
36
|
|
|
//Yii::t('ciims.models.general', 'Discourse') => array('useDiscourseComments', 'discourseUrl'),
|
|
|
|
|
37
|
|
|
Yii::t('ciims.models.general', 'Display Settings') => array('dateFormat', 'timeFormat', 'defaultLanguage'),
|
38
|
|
|
);
|
39
|
|
|
}
|
40
|
|
|
|
41
|
|
|
/**
|
42
|
|
|
* Validation rules
|
43
|
|
|
* @return array
|
44
|
|
|
*/
|
45
|
|
|
public function rules()
|
46
|
|
|
{
|
47
|
|
|
return array(
|
48
|
|
|
array('name, dateFormat, timeFormat, defaultLanguage', 'required'),
|
49
|
|
|
array('name', 'length', 'max' => 255),
|
50
|
|
|
array('dateFormat, timeFormat, defaultLanguage', 'length', 'max' => 25),
|
51
|
|
|
array('useDisqusComments, forceSecureSSL', 'boolean'),
|
52
|
|
|
array('disqus_shortname', 'length', 'max' => 255),
|
53
|
|
|
array('bcrypt_cost', 'numerical', 'integerOnly'=>true, 'min' => 13),
|
54
|
|
|
array('searchPaginationSize, categoryPaginationSize, contentPaginationSize', 'numerical', 'integerOnly' => true, 'min' => 10),
|
55
|
|
|
//array('url', 'url')
|
|
|
|
|
56
|
|
|
);
|
57
|
|
|
}
|
58
|
|
|
|
59
|
|
|
/**
|
60
|
|
|
* Attribute labels
|
61
|
|
|
* @return array
|
62
|
|
|
*/
|
63
|
|
|
public function attributeLabels()
|
64
|
|
|
{
|
65
|
|
|
return array(
|
66
|
|
|
'name' => Yii::t('ciims.models.general', 'Site Name'),
|
67
|
|
|
'dateFormat' => Yii::t('ciims.models.general', 'Date Format'),
|
68
|
|
|
'timeFormat' => Yii::t('ciims.models.general', 'Time Format'),
|
69
|
|
|
'defaultLanguage' => Yii::t('ciims.models.general', 'Default Language'),
|
70
|
|
|
'forceSecureSSL' => Yii::t('ciims.models.general', 'Force SSL for Secure Areas'),
|
71
|
|
|
'bcrypt_cost' => Yii::t('ciims.models.general', 'Password Strength Settings'),
|
72
|
|
|
'searchPaginationSize' => Yii::t('ciims.models.general', 'Search Post Count'),
|
73
|
|
|
'categoryPaginationSize' => Yii::t('ciims.models.general', 'Category Post Count'),
|
74
|
|
|
'contentPaginationSize' => Yii::t('ciims.models.general', 'Content Post Cost'),
|
75
|
|
|
|
76
|
|
|
// Discourse
|
77
|
|
|
'useDisqusComments' => Yii::t('ciims.models.general', 'Use Disqus Comments'),
|
78
|
|
|
'disqus_shortname' => Yii::t('ciims.models.general', 'Disqus Shortcode'),
|
79
|
|
|
|
80
|
|
|
// Discourse
|
81
|
|
|
//'useDiscourseComments' => Yii::t('ciims.models.general', 'Use Discourse Comments'),
|
|
|
|
|
82
|
|
|
//'discourseUrl' => Yii::t('ciims.models.general', 'Discourse URL'),
|
|
|
|
|
83
|
|
|
);
|
84
|
|
|
}
|
85
|
|
|
}
|
86
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.