Completed
Push — master ( 4a6e31...2a2ab1 )
by Morris
18:03
created

ExternalShareMenuAction::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 11
nc 1
nop 0
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * @copyright Copyright (c) 2018 Julius Härtl <[email protected]>
4
 *
5
 * @author Julius Härtl <[email protected]>
6
 *
7
 * @license GNU AGPL version 3 or any later version
8
 *
9
 * This program is free software: you can redistribute it and/or modify
10
 * it under the terms of the GNU Affero General Public License as
11
 * published by the Free Software Foundation, either version 3 of the
12
 * License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU Affero General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU Affero General Public License
20
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
 *
22
 */
23
24
namespace OCP\AppFramework\Http\Template;
25
26
use OCP\AppFramework\Http\Template\SimpleMenuAction;
27
use OCP\Util;
28
/**
29
 * Class LinkMenuAction
30
 *
31
 * @package OCP\AppFramework\Http\Template
32
 * @since 14.0.0
33
 */
34
class ExternalShareMenuAction extends SimpleMenuAction {
35
36
	/** @var string */
37
	private $owner;
38
39
	/** @var string */
40
	private $displayname;
41
42
	/** @var string */
43
	private $shareName;
44
45
	/**
46
	 * ExternalShareMenuAction constructor.
47
	 *
48
	 * @param string $label
49
	 * @param string $icon
50
	 * @param string $owner
51
	 * @param string $displayname
52
	 * @param string $shareName
53
	 * @since 14.0.0
54
	 */
55
	public function __construct(string $label, string $icon, string $owner, string $displayname, string $shareName) {
56
		parent::__construct('save', $label, $icon);
57
		$this->owner = $owner;
58
		$this->displayname = $displayname;
59
		$this->shareName = $shareName;
60
	}
61
62
	/**
63
	 * @since 14.0.0
64
	 */
65
	public function render(): string {
66
		return '<li>' .
67
			'<a id="save-external-share" data-protected="false" data-owner-display-name="' . Util::sanitizeHTML($this->displayname) . '" data-owner="' . Util::sanitizeHTML($this->owner) . '" data-name="' . Util::sanitizeHTML($this->shareName) . '">' .
68
			'<span class="icon ' . Util::sanitizeHTML($this->getIcon()) . '"></span>' .
69
			'<label for="remote_address">' . Util::sanitizeHTML($this->getLabel()) . '</label>' .
70
			'<form class="save-form hidden" action="#">' .
71
			'<input type="text" id="remote_address" placeholder="[email protected]">' .
72
			'<input type="submit" value=" " id="save-button-confirm" class="icon-confirm" disabled="disabled"></button>' .
73
			'</form>' .
74
			'</a>' .
75
			'</li>';
76
	}
77
}
78