PluginProbe
wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin / 6.5.1.7
wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin v6.5.1.7
6.5.1.7 6.5.1.6 6.5.1.5 6.5.1.4 6.5.1.3 6.5.1.2 6.5.1.1 6.5.0.9 6.5.0.8 6.5.0.7 6.5.0.6 trunk 3.4.2.40 3.4.2.41 3.4.2.42 3.4.2.43 3.4.2.44 3.4.2.45 3.4.2.46 3.4.2.47 3.4.2.48 3.4.2.49 3.4.2.50 6.3.2 6.3.3.1 All 47 releases
wpdatatables / lib / phpoffice / phpspreadsheet / src / PhpSpreadsheet / Document / Security.php

Security.php in wpDataTables – WordPress Data Table, Dynamic Tables & Table Charts Plugin 6.5.1.7, at lib/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Document/Security.php

153 lines 3.0 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 public function isSecurityEnabled(): bool
55 {
56 return $this->lockRevision ||
57 $this->lockStructure ||
58 $this->lockWindows;
59 }
60
61 public function getLockRevision(): bool
62 {
63 return $this->lockRevision;
64 }
65
66 public function setLockRevision(?bool $locked): self
67 {
68 if ($locked !== null) {
69 $this->lockRevision = $locked;
70 }
71
72 return $this;
73 }
74
75 public function getLockStructure(): bool
76 {
77 return $this->lockStructure;
78 }
79
80 public function setLockStructure(?bool $locked): self
81 {
82 if ($locked !== null) {
83 $this->lockStructure = $locked;
84 }
85
86 return $this;
87 }
88
89 public function getLockWindows(): bool
90 {
91 return $this->lockWindows;
92 }
93
94 public function setLockWindows(?bool $locked): self
95 {
96 if ($locked !== null) {
97 $this->lockWindows = $locked;
98 }
99
100 return $this;
101 }
102
103 public function getRevisionsPassword(): string
104 {
105 return $this->revisionsPassword;
106 }
107
108 /**
109 * Set RevisionsPassword.
110 *
111 * @param string $password
112 * @param bool $alreadyHashed If the password has already been hashed, set this to true
113 *
114 * @return $this
115 */
116 public function setRevisionsPassword(?string $password, bool $alreadyHashed = false)
117 {
118 if ($password !== null) {
119 if (!$alreadyHashed) {
120 $password = PasswordHasher::hashPassword($password);
121 }
122 $this->revisionsPassword = $password;
123 }
124
125 return $this;
126 }
127
128 public function getWorkbookPassword(): string
129 {
130 return $this->workbookPassword;
131 }
132
133 /**
134 * Set WorkbookPassword.
135 *
136 * @param string $password
137 * @param bool $alreadyHashed If the password has already been hashed, set this to true
138 *
139 * @return $this
140 */
141 public function setWorkbookPassword(?string $password, bool $alreadyHashed = false)
142 {
143 if ($password !== null) {
144 if (!$alreadyHashed) {
145 $password = PasswordHasher::hashPassword($password);
146 }
147 $this->workbookPassword = $password;
148 }
149
150 return $this;
151 }
152 }
153