PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.11.0
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.11.0
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
visualizer / vendor / phpoffice / phpspreadsheet / src / PhpSpreadsheet / Document / Security.php

Security.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.11.0, at vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Document/Security.php

206 lines 3.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace PhpOffice\PhpSpreadsheet\Document;
4
5 use PhpOffice\PhpSpreadsheet\Shared\PasswordHasher;
6
7 class Security
8 {
9 /**
10 * LockRevision.
11 *
12 * @var bool
13 */
14 private $lockRevision = false;
15
16 /**
17 * LockStructure.
18 *
19 * @var bool
20 */
21 private $lockStructure = false;
22
23 /**
24 * LockWindows.
25 *
26 * @var bool
27 */
28 private $lockWindows = false;
29
30 /**
31 * RevisionsPassword.
32 *
33 * @var string
34 */
35 private $revisionsPassword = '';
36
37 /**
38 * WorkbookPassword.
39 *
40 * @var string
41 */
42 private $workbookPassword = '';
43
44 /**
45 * Create a new Document Security instance.
46 */
47 public function __construct()
48 {
49 }
50
51 /**
52 * Is some sort of document security enabled?
53 *
54 * @return bool
55 */
56 public function isSecurityEnabled()
57 {
58 return $this->lockRevision ||
59 $this->lockStructure ||
60 $this->lockWindows;
61 }
62
63 /**
64 * Get LockRevision.
65 *
66 * @return bool
67 */
68 public function getLockRevision()
69 {
70 return $this->lockRevision;
71 }
72
73 /**
74 * Set LockRevision.
75 *
76 * @param bool $pValue
77 *
78 * @return Security
79 */
80 public function setLockRevision($pValue)
81 {
82 $this->lockRevision = $pValue;
83
84 return $this;
85 }
86
87 /**
88 * Get LockStructure.
89 *
90 * @return bool
91 */
92 public function getLockStructure()
93 {
94 return $this->lockStructure;
95 }
96
97 /**
98 * Set LockStructure.
99 *
100 * @param bool $pValue
101 *
102 * @return Security
103 */
104 public function setLockStructure($pValue)
105 {
106 $this->lockStructure = $pValue;
107
108 return $this;
109 }
110
111 /**
112 * Get LockWindows.
113 *
114 * @return bool
115 */
116 public function getLockWindows()
117 {
118 return $this->lockWindows;
119 }
120
121 /**
122 * Set LockWindows.
123 *
124 * @param bool $pValue
125 *
126 * @return Security
127 */
128 public function setLockWindows($pValue)
129 {
130 $this->lockWindows = $pValue;
131
132 return $this;
133 }
134
135 /**
136 * Get RevisionsPassword (hashed).
137 *
138 * @return string
139 */
140 public function getRevisionsPassword()
141 {
142 return $this->revisionsPassword;
143 }
144
145 /**
146 * Set RevisionsPassword.
147 *
148 * @param string $pValue
149 * @param bool $pAlreadyHashed If the password has already been hashed, set this to true
150 *
151 * @return Security
152 */
153 public function setRevisionsPassword($pValue, $pAlreadyHashed = false)
154 {
155 if (!$pAlreadyHashed) {
156 $pValue = PasswordHasher::hashPassword($pValue);
157 }
158 $this->revisionsPassword = $pValue;
159
160 return $this;
161 }
162
163 /**
164 * Get WorkbookPassword (hashed).
165 *
166 * @return string
167 */
168 public function getWorkbookPassword()
169 {
170 return $this->workbookPassword;
171 }
172
173 /**
174 * Set WorkbookPassword.
175 *
176 * @param string $pValue
177 * @param bool $pAlreadyHashed If the password has already been hashed, set this to true
178 *
179 * @return Security
180 */
181 public function setWorkbookPassword($pValue, $pAlreadyHashed = false)
182 {
183 if (!$pAlreadyHashed) {
184 $pValue = PasswordHasher::hashPassword($pValue);
185 }
186 $this->workbookPassword = $pValue;
187
188 return $this;
189 }
190
191 /**
192 * Implement PHP __clone to create a deep clone, not just a shallow copy.
193 */
194 public function __clone()
195 {
196 $vars = get_object_vars($this);
197 foreach ($vars as $key => $value) {
198 if (is_object($value)) {
199 $this->$key = clone $value;
200 } else {
201 $this->$key = $value;
202 }
203 }
204 }
205 }
206