PluginProbe
Hostinger Tools / 3.0.34
Hostinger Tools v3.0.34
3.0.77 3.0.76 3.0.75 3.0.74 3.0.73 3.0.72 3.0.71 3.0.70 3.0.69 3.0.68 3.0.67 3.0.66 1.8.1 1.8.2 1.8.3 1.9.1 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.4 All 108 releases
hostinger / includes / Admin / Options / PluginOptions.php

PluginOptions.php in Hostinger Tools 3.0.34, at includes/Admin/Options/PluginOptions.php

164 lines 3.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Hostinger\Admin\Options;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 die;
6 }
7
8 /**
9 * Class for handling plugin options
10 */
11 class PluginOptions {
12 /**
13 * @var bool
14 */
15 private bool $maintenance_mode = false;
16
17 /**
18 * @var string
19 */
20 private string $bypass_code = '';
21
22 /**
23 * @var bool
24 */
25 private bool $disable_xml_rpc = false;
26
27 /**
28 * @var bool
29 */
30 private bool $force_https = false;
31
32 /**
33 * @var bool
34 */
35 private bool $force_www = false;
36
37 /**
38 * @var bool
39 */
40 private bool $disable_authentication_password = false;
41
42 /**
43 * @param array $settings plugin settings array.
44 */
45 public function __construct( array $settings = array() ) {
46 $this->maintenance_mode = ! empty( $settings['maintenance_mode'] );
47 $this->bypass_code = ! empty( $settings['bypass_code'] ) ? $settings['bypass_code'] : '';
48 $this->disable_xml_rpc = ! empty( $settings['disable_xml_rpc'] );
49 $this->force_https = ! empty( $settings['force_https'] );
50 $this->force_www = ! empty( $settings['force_www'] );
51 $this->disable_authentication_password = ! empty( $settings['disable_authentication_password'] );
52 }
53
54 /**
55 * @return bool
56 */
57 public function get_maintenance_mode(): bool {
58 return $this->maintenance_mode;
59 }
60
61 /**
62 * @param bool $maintenance_mode
63 *
64 * @return void
65 */
66 public function set_maintenance_mode( bool $maintenance_mode ): void {
67 $this->maintenance_mode = $maintenance_mode;
68 }
69
70 /**
71 * @return string
72 */
73 public function get_bypass_code(): string {
74 return $this->bypass_code;
75 }
76
77 /**
78 * @param string $bypass_code
79 *
80 * @return void
81 */
82 public function set_bypass_code( string $bypass_code ): void {
83 $this->bypass_code = $bypass_code;
84 }
85
86 /**
87 * @return bool
88 */
89 public function get_disable_xml_rpc(): bool {
90 return $this->disable_xml_rpc;
91 }
92
93 /**
94 * @param bool $disable_xml_rpc
95 *
96 * @return void
97 */
98 public function set_disable_xml_rpc( bool $disable_xml_rpc ): void {
99 $this->disable_xml_rpc = $disable_xml_rpc;
100 }
101
102 /**
103 * @return bool
104 */
105 public function get_force_https(): bool {
106 return $this->force_https;
107 }
108
109 /**
110 * @param bool $force_https
111 *
112 * @return void
113 */
114 public function set_force_https( bool $force_https ): void {
115 $this->force_https = $force_https;
116 }
117
118 /**
119 * @return bool
120 */
121 public function get_force_www(): bool {
122 return $this->force_www;
123 }
124
125 /**
126 * @param bool $force_www
127 *
128 * @return void
129 */
130 public function set_force_www( bool $force_www ): void {
131 $this->force_www = $force_www;
132 }
133
134 /**
135 * @return bool
136 */
137 public function get_disable_authentication_password(): bool {
138 return $this->disable_authentication_password;
139 }
140
141 /**
142 * @param bool $authentication_password
143 *
144 * @return void
145 */
146 public function set_disable_authentication_password( bool $authentication_password ): void {
147 $this->disable_authentication_password = $authentication_password;
148 }
149
150 /**
151 * @return array
152 */
153 public function to_array(): array {
154 return array(
155 'maintenance_mode' => $this->get_maintenance_mode(),
156 'bypass_code' => $this->get_bypass_code(),
157 'disable_xml_rpc' => $this->get_disable_xml_rpc(),
158 'force_https' => $this->get_force_https(),
159 'force_www' => $this->get_force_www(),
160 'disable_authentication_password' => $this->get_disable_authentication_password(),
161 );
162 }
163 }
164