forked from RSol/yii2-articles
/
Articles.php
111 lines (84 loc) · 3.12 KB
/
Articles.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
/**
* @copyright Copyright © Gogodigital Srls
* @company Gogodigital Srls - Wide ICT Solutions
* @website http://www.gogodigital.it
* @github https://github.com/vladkukushkin/yii2-articles
* @license GNU GENERAL PUBLIC LICENSE VERSION 3
* @package yii2-articles
* @version 0.6.2
*/
namespace vladkukushkin\articles;
use Yii;
class Articles extends \yii\base\Module
{
public $controllerNamespace = 'vladkukushkin\articles\controllers';
// Select User Class
public $userClass = 'dektrium\user\models\User';
// Select Article Languages
public $languages = [ "en-GB" => "en-GB" ];
// Select Editor: no-editor, ckeditor, imperavi, tinymce, markdown
public $editor = "ckeditor";
// Select Path To Upload Category Image
public $categoryImagePath = "@webroot/img/articles/categories/";
// Select URL To Upload Category Image
public $categoryImageURL = "@web/img/articles/categories/";
// Select Path To Upload Category Thumb
public $categoryThumbPath = "@webroot/img/articles/categories/thumb/";
// Select URL To Upload Category Image
public $categoryThumbURL = "@web/img/articles/categories/thumb/";
// Select Path To Upload Item Image
public $itemImagePath = "@webroot/img/articles/items/";
// Select URL To Upload Item Image
public $itemImageURL = "@web/img/articles/items/";
// Select Path To Upload Item Thumb
public $itemThumbPath = "@webroot/img/articles/items/thumb/";
// Select URL To Upload Item Thumb
public $itemThumbURL = "@web/img/articles/items/thumb/";
// Select Image Name: categoryname, original, casual
public $imageNameType = "categoryname";
// Select Image Types allowed
public $imageType = "image/jpg,image/jpeg,image/gif,image/png";
// Select Path To Upload Attachments
public $attachPath = "@webroot/attachments/";
// Select URL To Upload Attachment
public $attachURL = "@web/attachments/";
// Select Attachment Types allowed
public $attachType = "application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, .csv, .pdf, text/plain, .jpg, .jpeg, .gif, .png";
// Show Titles in the views
public $showTitles = true;
// Thumbnails Options
public $thumbOptions = [
'small' => ['quality' => 100, 'width' => 200, 'height' => 150],
'medium' => ['quality' => 100, 'width' => 300, 'height' => 200],
'large' => ['quality' => 100, 'width' => 400, 'height' => 300],
'extra' => ['quality' => 100, 'width' => 600, 'height' => 400],
];
// Url Rules
public $urlRules = [
'<id:\d+>/<alias:[A-Za-z0-9 -_.]+>' => 'articles/categories/view',
'<cat>/<id:\d+>/<alias:[A-Za-z0-9 -_.]+>' => 'articles/items/view',
];
/**
* @inheritdoc
*/
public function init()
{
parent::init();
$this->registerTranslations();
Yii::$container->set($this->userClass);
}
/**
* Translating module message
*/
public function registerTranslations()
{
if (!isset(Yii::$app->i18n->translations['articles*']))
{
Yii::$app->i18n->translations['articles*'] = [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => __DIR__ . '/messages',
];
}
}
}