|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @copyright Copyright (c) 2016 Joas Schilling <[email protected]> |
|
4
|
|
|
* |
|
5
|
|
|
* @license GNU AGPL version 3 or any later version |
|
6
|
|
|
* |
|
7
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
8
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
9
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
10
|
|
|
* License, or (at your option) any later version. |
|
11
|
|
|
* |
|
12
|
|
|
* This program is distributed in the hope that it will be useful, |
|
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15
|
|
|
* GNU Affero General Public License for more details. |
|
16
|
|
|
* |
|
17
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
18
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
19
|
|
|
* |
|
20
|
|
|
*/ |
|
21
|
|
|
|
|
22
|
|
|
namespace OCA\Files\Activity\Settings; |
|
23
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
use OCP\Activity\ISetting; |
|
26
|
|
|
use OCP\IL10N; |
|
27
|
|
|
|
|
28
|
|
View Code Duplication |
class FileCreated implements ISetting { |
|
|
|
|
|
|
29
|
|
|
|
|
30
|
|
|
/** @var IL10N */ |
|
31
|
|
|
protected $l; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @param IL10N $l |
|
35
|
|
|
*/ |
|
36
|
|
|
public function __construct(IL10N $l) { |
|
37
|
|
|
$this->l = $l; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @return string Lowercase a-z and underscore only identifier |
|
42
|
|
|
* @since 11.0.0 |
|
43
|
|
|
*/ |
|
44
|
|
|
public function getIdentifier() { |
|
45
|
|
|
return 'file_created'; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @return string A translated string |
|
50
|
|
|
* @since 11.0.0 |
|
51
|
|
|
*/ |
|
52
|
|
|
public function getName() { |
|
53
|
|
|
return $this->l->t('A new file or folder has been <strong>created</strong>'); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @return int whether the filter should be rather on the top or bottom of |
|
58
|
|
|
* the admin section. The filters are arranged in ascending order of the |
|
59
|
|
|
* priority values. It is required to return a value between 0 and 100. |
|
60
|
|
|
* @since 11.0.0 |
|
61
|
|
|
*/ |
|
62
|
|
|
public function getPriority() { |
|
63
|
|
|
return 0; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @return bool True when the option can be changed for the stream |
|
68
|
|
|
* @since 11.0.0 |
|
69
|
|
|
*/ |
|
70
|
|
|
public function canChangeStream() { |
|
71
|
|
|
return true; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @return bool True when the option can be changed for the stream |
|
76
|
|
|
* @since 11.0.0 |
|
77
|
|
|
*/ |
|
78
|
|
|
public function isDefaultEnabledStream() { |
|
79
|
|
|
return true; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* @return bool True when the option can be changed for the mail |
|
84
|
|
|
* @since 11.0.0 |
|
85
|
|
|
*/ |
|
86
|
|
|
public function canChangeMail() { |
|
87
|
|
|
return true; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* @return bool True when the option can be changed for the stream |
|
92
|
|
|
* @since 11.0.0 |
|
93
|
|
|
*/ |
|
94
|
|
|
public function isDefaultEnabledMail() { |
|
95
|
|
|
return false; |
|
96
|
|
|
} |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.