@@ -4,9 +4,9 @@ discard block |
||
4 | 4 | <meta charset="utf-8"> |
5 | 5 | <title> |
6 | 6 | <?php |
7 | - p(!empty($_['application'])?$_['application'].' - ':''); |
|
8 | - p($theme->getTitle()); |
|
9 | - ?> |
|
7 | + p(!empty($_['application'])?$_['application'].' - ':''); |
|
8 | + p($theme->getTitle()); |
|
9 | + ?> |
|
10 | 10 | </title> |
11 | 11 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
12 | 12 | <meta name="referrer" content="never"> |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | </div> |
43 | 43 | |
44 | 44 | <?php |
45 | - /** @var \OCP\AppFramework\Http\Template\PublicTemplateResponse $template */ |
|
46 | - if($template->getActionCount() !== 0) { |
|
47 | - $primary = $template->getPrimaryAction(); |
|
48 | - $others = $template->getOtherActions(); |
|
49 | - ?> |
|
45 | + /** @var \OCP\AppFramework\Http\Template\PublicTemplateResponse $template */ |
|
46 | + if($template->getActionCount() !== 0) { |
|
47 | + $primary = $template->getPrimaryAction(); |
|
48 | + $others = $template->getOtherActions(); |
|
49 | + ?> |
|
50 | 50 | <div class="header-right"> |
51 | 51 | <span id="header-primary-action" class="<?php if($template->getActionCount() === 1) { p($primary->getIcon()); } ?>"> |
52 | 52 | <a href="<?php p($primary->getLink()); ?>"> |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | <div id="header-actions-menu" class="popovermenu menu"> |
60 | 60 | <ul> |
61 | 61 | <?php |
62 | - /** @var \OCP\AppFramework\Http\Template\IMenuAction $action */ |
|
63 | - foreach($template->getOtherActions() as $action) { |
|
64 | - print_unescaped($action->render()); |
|
65 | - } |
|
66 | - ?> |
|
62 | + /** @var \OCP\AppFramework\Http\Template\IMenuAction $action */ |
|
63 | + foreach($template->getOtherActions() as $action) { |
|
64 | + print_unescaped($action->render()); |
|
65 | + } |
|
66 | + ?> |
|
67 | 67 | </ul> |
68 | 68 | </div> |
69 | 69 | </div> |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | <meta charset="utf-8"> |
5 | 5 | <title> |
6 | 6 | <?php |
7 | - p(!empty($_['application'])?$_['application'].' - ':''); |
|
7 | + p(!empty($_['application']) ? $_['application'].' - ' : ''); |
|
8 | 8 | p($theme->getTitle()); |
9 | 9 | ?> |
10 | 10 | </title> |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | <meta name="apple-itunes-app" content="app-id=<?php p($theme->getiTunesAppId()); ?>"> |
15 | 15 | <meta name="apple-mobile-web-app-capable" content="yes"> |
16 | 16 | <meta name="apple-mobile-web-app-status-bar-style" content="black"> |
17 | - <meta name="apple-mobile-web-app-title" content="<?php p((!empty($_['application']) && $_['appid']!='files')? $_['application']:$theme->getTitle()); ?>"> |
|
17 | + <meta name="apple-mobile-web-app-title" content="<?php p((!empty($_['application']) && $_['appid'] != 'files') ? $_['application'] : $theme->getTitle()); ?>"> |
|
18 | 18 | <meta name="mobile-web-app-capable" content="yes"> |
19 | 19 | <meta name="theme-color" content="<?php p($theme->getColorPrimary()); ?>"> |
20 | 20 | <link rel="icon" href="<?php print_unescaped(image_path($_['appid'], 'favicon.ico')); /* IE11+ supports png */ ?>"> |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | <?php emit_script_loading_tags($_); ?> |
26 | 26 | <?php print_unescaped($_['headers']); ?> |
27 | 27 | </head> |
28 | -<body id="<?php p($_['bodyid']);?>"> |
|
28 | +<body id="<?php p($_['bodyid']); ?>"> |
|
29 | 29 | <?php include('layout.noscript.warning.php'); ?> |
30 | 30 | <header> |
31 | 31 | <div id="header" class="<?php p($_['header-classes']); ?>"> |
@@ -43,24 +43,24 @@ discard block |
||
43 | 43 | |
44 | 44 | <?php |
45 | 45 | /** @var \OCP\AppFramework\Http\Template\PublicTemplateResponse $template */ |
46 | - if($template->getActionCount() !== 0) { |
|
46 | + if ($template->getActionCount() !== 0) { |
|
47 | 47 | $primary = $template->getPrimaryAction(); |
48 | 48 | $others = $template->getOtherActions(); |
49 | 49 | ?> |
50 | 50 | <div class="header-right"> |
51 | - <span id="header-primary-action" class="<?php if($template->getActionCount() === 1) { p($primary->getIcon()); } ?>"> |
|
51 | + <span id="header-primary-action" class="<?php if ($template->getActionCount() === 1) { p($primary->getIcon()); } ?>"> |
|
52 | 52 | <a href="<?php p($primary->getLink()); ?>"> |
53 | 53 | <span><?php p($primary->getLabel()) ?></span> |
54 | 54 | </a> |
55 | 55 | </span> |
56 | - <?php if($template->getActionCount()>1) { ?> |
|
56 | + <?php if ($template->getActionCount() > 1) { ?> |
|
57 | 57 | <div id="header-secondary-action"> |
58 | 58 | <span id="header-actions-toggle" class="menutoggle icon-more-white"></span> |
59 | 59 | <div id="header-actions-menu" class="popovermenu menu"> |
60 | 60 | <ul> |
61 | 61 | <?php |
62 | 62 | /** @var \OCP\AppFramework\Http\Template\IMenuAction $action */ |
63 | - foreach($template->getOtherActions() as $action) { |
|
63 | + foreach ($template->getOtherActions() as $action) { |
|
64 | 64 | print_unescaped($action->render()); |
65 | 65 | } |
66 | 66 | ?> |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | <div id="content" class="app-<?php p($_['appid']) ?>" role="main"> |
77 | 77 | <?php print_unescaped($_['content']); ?> |
78 | 78 | </div> |
79 | - <?php if($template->getFooterVisible()) { ?> |
|
79 | + <?php if ($template->getFooterVisible()) { ?> |
|
80 | 80 | <footer> |
81 | 81 | <p class="info"><?php print_unescaped($theme->getLongFooter()); ?></p> |
82 | 82 | </footer> |
@@ -34,125 +34,125 @@ |
||
34 | 34 | */ |
35 | 35 | class PublicTemplateResponse extends TemplateResponse { |
36 | 36 | |
37 | - private $headerTitle = ''; |
|
38 | - private $headerDetails = ''; |
|
39 | - private $headerActions = []; |
|
40 | - private $footerVisible = true; |
|
41 | - |
|
42 | - /** |
|
43 | - * PublicTemplateResponse constructor. |
|
44 | - * |
|
45 | - * @param string $appName |
|
46 | - * @param string $templateName |
|
47 | - * @param array $params |
|
48 | - * @since 14.0.0 |
|
49 | - */ |
|
50 | - public function __construct(string $appName, string $templateName, array $params = array()) { |
|
51 | - parent::__construct($appName, $templateName, $params, 'public'); |
|
52 | - \OC_Util::addScript('core', 'public/publicpage'); |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * @param string $title |
|
57 | - * @since 14.0.0 |
|
58 | - */ |
|
59 | - public function setHeaderTitle(string $title) { |
|
60 | - $this->headerTitle = $title; |
|
61 | - } |
|
62 | - |
|
63 | - /** |
|
64 | - * @return string |
|
65 | - * @since 14.0.0 |
|
66 | - */ |
|
67 | - public function getHeaderTitle(): string { |
|
68 | - return $this->headerTitle; |
|
69 | - } |
|
70 | - |
|
71 | - /** |
|
72 | - * @param string $details |
|
73 | - * @since 14.0.0 |
|
74 | - */ |
|
75 | - public function setHeaderDetails(string $details) { |
|
76 | - $this->headerDetails = $details; |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * @return string |
|
81 | - * @since 14.0.0 |
|
82 | - */ |
|
83 | - public function getHeaderDetails(): string { |
|
84 | - return $this->headerDetails; |
|
85 | - } |
|
86 | - |
|
87 | - /** |
|
88 | - * @param array $actions |
|
89 | - * @since 14.0.0 |
|
90 | - * @throws InvalidArgumentException |
|
91 | - */ |
|
92 | - public function setHeaderActions(array $actions) { |
|
93 | - foreach ($actions as $action) { |
|
94 | - if ($actions instanceof IMenuAction) { |
|
95 | - throw new InvalidArgumentException('Actions must be of type IMenuAction'); |
|
96 | - } |
|
97 | - $this->headerActions[] = $action; |
|
98 | - } |
|
99 | - usort($this->headerActions, function(IMenuAction $a, IMenuAction $b) { |
|
100 | - return $a->getPriority() > $b->getPriority(); |
|
101 | - }); |
|
102 | - } |
|
103 | - |
|
104 | - /** |
|
105 | - * @return IMenuAction |
|
106 | - * @since 14.0.0 |
|
107 | - * @throws \Exception |
|
108 | - */ |
|
109 | - public function getPrimaryAction(): IMenuAction { |
|
110 | - if ($this->getActionCount() > 0) { |
|
111 | - return $this->headerActions[0]; |
|
112 | - } |
|
113 | - throw new \Exception('No header actions have been set'); |
|
114 | - } |
|
115 | - |
|
116 | - /** |
|
117 | - * @return int |
|
118 | - * @since 14.0.0 |
|
119 | - */ |
|
120 | - public function getActionCount(): int { |
|
121 | - return count($this->headerActions); |
|
122 | - } |
|
123 | - |
|
124 | - /** |
|
125 | - * @return IMenuAction[] |
|
126 | - * @since 14.0.0 |
|
127 | - */ |
|
128 | - public function getOtherActions(): array { |
|
129 | - return array_slice($this->headerActions, 1); |
|
130 | - } |
|
131 | - |
|
132 | - /** |
|
133 | - * @since 14.0.0 |
|
134 | - */ |
|
135 | - public function setFooterVisible(bool $visible = false) { |
|
136 | - $this->footerVisible = $visible; |
|
137 | - } |
|
138 | - |
|
139 | - /** |
|
140 | - * @since 14.0.0 |
|
141 | - */ |
|
142 | - public function getFooterVisible(): bool { |
|
143 | - return $this->footerVisible; |
|
144 | - } |
|
145 | - |
|
146 | - /** |
|
147 | - * @return string |
|
148 | - * @since 14.0.0 |
|
149 | - */ |
|
150 | - public function render(): string { |
|
151 | - $params = array_merge($this->getParams(), [ |
|
152 | - 'template' => $this, |
|
153 | - ]); |
|
154 | - $this->setParams($params); |
|
155 | - return parent::render(); |
|
156 | - } |
|
37 | + private $headerTitle = ''; |
|
38 | + private $headerDetails = ''; |
|
39 | + private $headerActions = []; |
|
40 | + private $footerVisible = true; |
|
41 | + |
|
42 | + /** |
|
43 | + * PublicTemplateResponse constructor. |
|
44 | + * |
|
45 | + * @param string $appName |
|
46 | + * @param string $templateName |
|
47 | + * @param array $params |
|
48 | + * @since 14.0.0 |
|
49 | + */ |
|
50 | + public function __construct(string $appName, string $templateName, array $params = array()) { |
|
51 | + parent::__construct($appName, $templateName, $params, 'public'); |
|
52 | + \OC_Util::addScript('core', 'public/publicpage'); |
|
53 | + } |
|
54 | + |
|
55 | + /** |
|
56 | + * @param string $title |
|
57 | + * @since 14.0.0 |
|
58 | + */ |
|
59 | + public function setHeaderTitle(string $title) { |
|
60 | + $this->headerTitle = $title; |
|
61 | + } |
|
62 | + |
|
63 | + /** |
|
64 | + * @return string |
|
65 | + * @since 14.0.0 |
|
66 | + */ |
|
67 | + public function getHeaderTitle(): string { |
|
68 | + return $this->headerTitle; |
|
69 | + } |
|
70 | + |
|
71 | + /** |
|
72 | + * @param string $details |
|
73 | + * @since 14.0.0 |
|
74 | + */ |
|
75 | + public function setHeaderDetails(string $details) { |
|
76 | + $this->headerDetails = $details; |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * @return string |
|
81 | + * @since 14.0.0 |
|
82 | + */ |
|
83 | + public function getHeaderDetails(): string { |
|
84 | + return $this->headerDetails; |
|
85 | + } |
|
86 | + |
|
87 | + /** |
|
88 | + * @param array $actions |
|
89 | + * @since 14.0.0 |
|
90 | + * @throws InvalidArgumentException |
|
91 | + */ |
|
92 | + public function setHeaderActions(array $actions) { |
|
93 | + foreach ($actions as $action) { |
|
94 | + if ($actions instanceof IMenuAction) { |
|
95 | + throw new InvalidArgumentException('Actions must be of type IMenuAction'); |
|
96 | + } |
|
97 | + $this->headerActions[] = $action; |
|
98 | + } |
|
99 | + usort($this->headerActions, function(IMenuAction $a, IMenuAction $b) { |
|
100 | + return $a->getPriority() > $b->getPriority(); |
|
101 | + }); |
|
102 | + } |
|
103 | + |
|
104 | + /** |
|
105 | + * @return IMenuAction |
|
106 | + * @since 14.0.0 |
|
107 | + * @throws \Exception |
|
108 | + */ |
|
109 | + public function getPrimaryAction(): IMenuAction { |
|
110 | + if ($this->getActionCount() > 0) { |
|
111 | + return $this->headerActions[0]; |
|
112 | + } |
|
113 | + throw new \Exception('No header actions have been set'); |
|
114 | + } |
|
115 | + |
|
116 | + /** |
|
117 | + * @return int |
|
118 | + * @since 14.0.0 |
|
119 | + */ |
|
120 | + public function getActionCount(): int { |
|
121 | + return count($this->headerActions); |
|
122 | + } |
|
123 | + |
|
124 | + /** |
|
125 | + * @return IMenuAction[] |
|
126 | + * @since 14.0.0 |
|
127 | + */ |
|
128 | + public function getOtherActions(): array { |
|
129 | + return array_slice($this->headerActions, 1); |
|
130 | + } |
|
131 | + |
|
132 | + /** |
|
133 | + * @since 14.0.0 |
|
134 | + */ |
|
135 | + public function setFooterVisible(bool $visible = false) { |
|
136 | + $this->footerVisible = $visible; |
|
137 | + } |
|
138 | + |
|
139 | + /** |
|
140 | + * @since 14.0.0 |
|
141 | + */ |
|
142 | + public function getFooterVisible(): bool { |
|
143 | + return $this->footerVisible; |
|
144 | + } |
|
145 | + |
|
146 | + /** |
|
147 | + * @return string |
|
148 | + * @since 14.0.0 |
|
149 | + */ |
|
150 | + public function render(): string { |
|
151 | + $params = array_merge($this->getParams(), [ |
|
152 | + 'template' => $this, |
|
153 | + ]); |
|
154 | + $this->setParams($params); |
|
155 | + return parent::render(); |
|
156 | + } |
|
157 | 157 | |
158 | 158 | } |
159 | 159 | \ No newline at end of file |