PluginProbe
Hostinger Tools / 3.0.8
Hostinger Tools v3.0.8
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.8, at includes/Admin/Options/PluginOptions.php

141 lines 2.6 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 * @param array $settings plugin settings array.
39 */
40 public function __construct( array $settings = array() ) {
41 $this->maintenance_mode = ! empty( $settings['maintenance_mode'] );
42 $this->bypass_code = ! empty( $settings['bypass_code'] ) ? $settings['bypass_code'] : '';
43 $this->disable_xml_rpc = ! empty( $settings['disable_xml_rpc'] );
44 $this->force_https = ! empty( $settings['force_https'] );
45 $this->force_www = ! empty( $settings['force_www'] );
46 }
47
48 /**
49 * @return bool
50 */
51 public function get_maintenance_mode(): bool {
52 return $this->maintenance_mode;
53 }
54
55 /**
56 * @param bool $maintenance_mode
57 *
58 * @return void
59 */
60 public function set_maintenance_mode( bool $maintenance_mode ): void {
61 $this->maintenance_mode = $maintenance_mode;
62 }
63
64 /**
65 * @return string
66 */
67 public function get_bypass_code(): string {
68 return $this->bypass_code;
69 }
70
71 /**
72 * @param string $bypass_code
73 *
74 * @return void
75 */
76 public function set_bypass_code( string $bypass_code ): void {
77 $this->bypass_code = $bypass_code;
78 }
79
80 /**
81 * @return bool
82 */
83 public function get_disable_xml_rpc(): bool {
84 return $this->disable_xml_rpc;
85 }
86
87 /**
88 * @param bool $disable_xml_rpc
89 *
90 * @return void
91 */
92 public function set_disable_xml_rpc( bool $disable_xml_rpc ): void {
93 $this->disable_xml_rpc = $disable_xml_rpc;
94 }
95
96 /**
97 * @return bool
98 */
99 public function get_force_https(): bool {
100 return $this->force_https;
101 }
102
103 /**
104 * @param bool $force_https
105 *
106 * @return void
107 */
108 public function set_force_https( bool $force_https ): void {
109 $this->force_https = $force_https;
110 }
111
112 /**
113 * @return bool
114 */
115 public function get_force_www(): bool {
116 return $this->force_www;
117 }
118
119 /**
120 * @param bool $force_www
121 *
122 * @return void
123 */
124 public function set_force_www( bool $force_www ): void {
125 $this->force_www = $force_www;
126 }
127
128 /**
129 * @return array
130 */
131 public function to_array(): array {
132 return array(
133 'maintenance_mode' => $this->get_maintenance_mode(),
134 'bypass_code' => $this->get_bypass_code(),
135 'disable_xml_rpc' => $this->get_disable_xml_rpc(),
136 'force_https' => $this->get_force_https(),
137 'force_www' => $this->get_force_www(),
138 );
139 }
140 }
141