1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the bootstrap-bundle package. |
5
|
|
|
* |
6
|
|
|
* (c) 2018 WEBEWEB |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace WBW\Bundle\BootstrapBundle\Controller; |
13
|
|
|
|
14
|
|
|
use Symfony\Component\Security\Core\User\User; |
15
|
|
|
use Symfony\Component\Security\Core\User\UserInterface; |
16
|
|
|
use WBW\Bundle\SyntaxHighlighterBundle\API\SyntaxHighlighterConfig; |
17
|
|
|
use WBW\Bundle\SyntaxHighlighterBundle\API\SyntaxHighlighterDefaults; |
18
|
|
|
use WBW\Bundle\SyntaxHighlighterBundle\Provider\SyntaxHighlighterStringsProvider; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Abstract wiki controller. |
22
|
|
|
* |
23
|
|
|
* @author webeweb <https://github.com/webeweb/> |
24
|
|
|
* @package WBW\Bundle\BootstrapBundle\Controller |
25
|
|
|
*/ |
26
|
|
|
abstract class AbstractWikiController extends AbstractBootstrapController { |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Get a user. |
30
|
|
|
* |
31
|
|
|
* @return UserInterface Returns the user. |
32
|
|
|
*/ |
33
|
|
|
protected function getSampleUser() { |
34
|
|
|
return new User("anonymous", "", ["ROLE_SUPER_ADMIN", "ROLE_ADMIN", "ROLE_USER"]); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Get a user role colors. |
39
|
|
|
* |
40
|
|
|
* @return array Returns the user role colors. |
41
|
|
|
*/ |
42
|
|
|
protected function getSampleUserRoleColors() { |
43
|
|
|
return [ |
44
|
|
|
"ROLE_SUPER_ADMIN" => "#F44336", |
45
|
|
|
"ROLE_ADMIN" => "#E91E63", |
46
|
|
|
"ROLE_USER" => "#9E9E9E", |
47
|
|
|
]; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Get a user role translations. |
52
|
|
|
* |
53
|
|
|
* @return array Returns the user role translations. |
54
|
|
|
*/ |
55
|
|
|
protected function getSampleUserRoleTranslations() { |
56
|
|
|
return [ |
57
|
|
|
"ROLE_SUPER_ADMIN" => "Super administrator", |
58
|
|
|
"ROLE_ADMIN" => "Administrator", |
59
|
|
|
"ROLE_USER" => "User", |
60
|
|
|
]; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Get the Syntax Highlighter config. |
65
|
|
|
* |
66
|
|
|
* @return SyntaxHighlighterConfig Returns the SyntaxHighlighter config. |
67
|
|
|
*/ |
68
|
|
|
protected function getSyntaxHighlighterConfig() { |
69
|
|
|
|
70
|
|
|
// Get the SyntaxHighlighter strings provider. |
71
|
|
|
$provider = $this->get(SyntaxHighlighterStringsProvider::SERVICE_NAME); |
72
|
|
|
|
73
|
|
|
// Initialize the SyntaxHighlighter config. |
74
|
|
|
$config = new SyntaxHighlighterConfig(); |
75
|
|
|
$config->setStrings($provider->getSyntaxHighlighterStrings()); |
76
|
|
|
|
77
|
|
|
// Return the SyntaxHighlighter config. |
78
|
|
|
return $config; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Get the Syntax Highlighter defaults. |
83
|
|
|
* |
84
|
|
|
* @return SyntaxHighlighterDefaults Returns the SyntaxHighlighter defaults. |
85
|
|
|
*/ |
86
|
|
|
protected function getSyntaxHighlighterDefaults() { |
87
|
|
|
|
88
|
|
|
// Initialize the SyntaxHighlighter defaults. |
89
|
|
|
$defaults = new SyntaxHighlighterDefaults(); |
90
|
|
|
|
91
|
|
|
// Return the SyntaxHighlighter defaults. |
92
|
|
|
return $defaults; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
} |
96
|
|
|
|