1 | <?php |
||||
2 | |||||
3 | namespace SilverStripe\Comments\Tests\Stubs; |
||||
4 | |||||
5 | use SilverStripe\Comments\Extensions\CommentsExtension; |
||||
6 | use SilverStripe\Control\Director; |
||||
7 | use SilverStripe\Dev\TestOnly; |
||||
8 | use SilverStripe\ORM\DataObject; |
||||
9 | use SilverStripe\Security\Member; |
||||
10 | use SilverStripe\Security\Permission; |
||||
11 | |||||
12 | class CommentableItem extends DataObject implements TestOnly |
||||
13 | { |
||||
14 | private static $db = array( |
||||
0 ignored issues
–
show
introduced
by
![]() |
|||||
15 | 'Title' => 'Varchar' |
||||
16 | ); |
||||
17 | |||||
18 | private static $extensions = array( |
||||
0 ignored issues
–
show
|
|||||
19 | CommentsExtension::class |
||||
20 | ); |
||||
21 | |||||
22 | private static $table_name = 'CommentableItem'; |
||||
0 ignored issues
–
show
|
|||||
23 | |||||
24 | public function RelativeLink() |
||||
25 | { |
||||
26 | return 'CommentableItemController'; |
||||
27 | } |
||||
28 | |||||
29 | public function canView($member = null) |
||||
30 | { |
||||
31 | return true; |
||||
32 | } |
||||
33 | |||||
34 | // This is needed for canModerateComments |
||||
35 | public function canEdit($member = null) |
||||
36 | { |
||||
37 | if ($member instanceof Member) { |
||||
38 | $memberID = $member->ID; |
||||
39 | } elseif (is_numeric($member)) { |
||||
40 | $memberID = $member; |
||||
41 | } else { |
||||
42 | $memberID = Member::currentUserID(); |
||||
0 ignored issues
–
show
The function
SilverStripe\Security\Member::currentUserID() has been deprecated: 5.0.0 use Security::getCurrentUser()
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead. ![]() |
|||||
43 | } |
||||
44 | |||||
45 | if ($memberID && Permission::checkMember($memberID, array('ADMIN', 'CMS_ACCESS_CommentAdmin'))) { |
||||
46 | return true; |
||||
47 | } |
||||
48 | return false; |
||||
49 | } |
||||
50 | |||||
51 | public function Link() |
||||
52 | { |
||||
53 | return $this->RelativeLink(); |
||||
54 | } |
||||
55 | |||||
56 | public function AbsoluteLink() |
||||
57 | { |
||||
58 | return Director::absoluteURL($this->RelativeLink()); |
||||
59 | } |
||||
60 | } |
||||
61 |