-
Notifications
You must be signed in to change notification settings - Fork 451
/
AvatarCropperInstance.php
115 lines (96 loc) · 2.11 KB
/
AvatarCropperInstance.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
namespace Concrete\Core\User\Component;
use Concrete\Core\Config\Repository\Repository;
use HtmlObject\Element;
class AvatarCropperInstance
{
/**
* @var string
*/
protected $accessToken;
/**
* @var int
*/
protected $width;
/**
* @var int
*/
protected $height;
/**
* @var string
*/
protected $uploadUrl;
/**
* @return mixed
*/
public function getAccessToken()
{
return $this->accessToken;
}
/**
* @param mixed $accessToken
*/
public function setAccessToken($accessToken): void
{
$this->accessToken = $accessToken;
}
/**
* @return string
*/
public function getUploadUrl(): string
{
return $this->uploadUrl;
}
/**
* @param string $uploadUrl
*/
public function setUploadUrl(string $uploadUrl): void
{
$this->uploadUrl = $uploadUrl;
}
/**
* @return int
*/
public function getWidth(): int
{
return $this->width;
}
/**
* @param int $width
*/
public function setWidth(int $width): void
{
$this->width = $width;
}
/**
* @return int
*/
public function getHeight(): int
{
return $this->height;
}
/**
* @param int $height
*/
public function setHeight(int $height): void
{
$this->height = $height;
}
public function getTag(): Element
{
$lang = [
'header' => t('Change Profile Picture'),
'upload' => t('Click to choose or a drag a profile picture.'),
'reset' => t('Reset Image'),
'save' => t('Save'),
'saveInProgress' => t('Saving...'),
];
$tag = new Element('avatar-cropper');
$tag->setAttribute(':lang', json_encode($lang));
$tag->setAttribute('upload-url', $this->getUploadUrl());
$tag->setAttribute('access-token', $this->getAccessToken());
$tag->setAttribute(':width', $this->getWidth());
$tag->setAttribute(':height', $this->getHeight());
return $tag;
}
}