Completed
Push — master ( 04cf01...daa767 )
by Barry
06:08
created
src/Admin/Settings/Settings.php 1 patch
Spacing   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 	 * @return string
11 11
 	 */
12 12
 	public static function get_url() {
13
-		return admin_url( 'edit.php?post_type=dlm_download&page=download-monitor-settings' );
13
+		return admin_url('edit.php?post_type=dlm_download&page=download-monitor-settings');
14 14
 	}
15 15
 
16 16
 	/**
@@ -23,26 +23,26 @@  discard block
 block discarded – undo
23 23
 		$settings = $this->get_settings();
24 24
 
25 25
 		// register our options and settings
26
-		foreach ( $settings as $tab_key => $tab ) {
27
-			foreach ( $tab['sections'] as $section_key => $section ) {
26
+		foreach ($settings as $tab_key => $tab) {
27
+			foreach ($tab['sections'] as $section_key => $section) {
28 28
 
29 29
 				$option_group = "dlm_" . $tab_key . "_" . $section_key;
30 30
 
31
-				foreach ( $section['fields'] as $field ) {
32
-					if ( ! empty( $field['name'] ) && ! in_array( $field['type'], apply_filters( 'dlm_settings_display_only_fields', array( 'action_button' ) ) ) ) {
33
-						if ( isset( $field['std'] ) ) {
34
-							add_option( $field['name'], $field['std'] );
31
+				foreach ($section['fields'] as $field) {
32
+					if ( ! empty($field['name']) && ! in_array($field['type'], apply_filters('dlm_settings_display_only_fields', array('action_button')))) {
33
+						if (isset($field['std'])) {
34
+							add_option($field['name'], $field['std']);
35 35
 						}
36
-						register_setting( $option_group, $field['name'] );
36
+						register_setting($option_group, $field['name']);
37 37
 					}
38 38
 				}
39 39
 
40 40
 				// on the overview page, we also register the enabled setting for every gateway. This makes the checkboxes to enable gateways work.
41
-				if ( 'overview' == $section_key ) {
42
-					$gateways = Services::get()->service( 'payment_gateway' )->get_all_gateways();
43
-					if ( ! empty( $gateways ) ) {
44
-						foreach ( $gateways as $gateway ) {
45
-							register_setting( $option_group, 'dlm_gateway_' . esc_attr( $gateway->get_id() ) . '_enabled' );
41
+				if ('overview' == $section_key) {
42
+					$gateways = Services::get()->service('payment_gateway')->get_all_gateways();
43
+					if ( ! empty($gateways)) {
44
+						foreach ($gateways as $gateway) {
45
+							register_setting($option_group, 'dlm_gateway_' . esc_attr($gateway->get_id()) . '_enabled');
46 46
 						}
47 47
 					}
48 48
 				}
@@ -62,55 +62,55 @@  discard block
 block discarded – undo
62 62
 
63 63
 		$settings = array(
64 64
 			'general'   => array(
65
-				'title'    => __( 'General', 'download-monitor' ),
65
+				'title'    => __('General', 'download-monitor'),
66 66
 				'sections' => array(
67 67
 					'general' => array(
68 68
 						'fields' => array(
69 69
 							array(
70 70
 								'name'    => 'dlm_default_template',
71 71
 								'std'     => '',
72
-								'label'   => __( 'Default Template', 'download-monitor' ),
73
-								'desc'    => __( 'Choose which template is used for <code>[download]</code> shortcodes by default (this can be overridden by the <code>format</code> argument).', 'download-monitor' ),
72
+								'label'   => __('Default Template', 'download-monitor'),
73
+								'desc'    => __('Choose which template is used for <code>[download]</code> shortcodes by default (this can be overridden by the <code>format</code> argument).', 'download-monitor'),
74 74
 								'type'    => 'select',
75
-								'options' => download_monitor()->service( 'template_handler' )->get_available_templates()
75
+								'options' => download_monitor()->service('template_handler')->get_available_templates()
76 76
 							),
77 77
 							array(
78 78
 								'name'  => 'dlm_custom_template',
79 79
 								'type'  => 'text',
80 80
 								'std'   => '',
81
-								'label' => __( 'Custom Template', 'download-monitor' ),
82
-								'desc'  => __( 'Leaving this blank will use the default <code>content-download.php</code> template file. If you enter, for example, <code>button</code>, the <code>content-download-button.php</code> template will be used instead. You can add custom templates inside your theme folder.', 'download-monitor' )
81
+								'label' => __('Custom Template', 'download-monitor'),
82
+								'desc'  => __('Leaving this blank will use the default <code>content-download.php</code> template file. If you enter, for example, <code>button</code>, the <code>content-download-button.php</code> template will be used instead. You can add custom templates inside your theme folder.', 'download-monitor')
83 83
 							),
84 84
 							array(
85 85
 								'name'     => 'dlm_xsendfile_enabled',
86 86
 								'std'      => '',
87
-								'label'    => __( 'X-Accel-Redirect / X-Sendfile', 'download-monitor' ),
88
-								'cb_label' => __( 'Enable', 'download-monitor' ),
89
-								'desc'     => __( 'If supported, <code>X-Accel-Redirect</code> / <code>X-Sendfile</code> can be used to serve downloads instead of PHP (server requires <code>mod_xsendfile</code>).', 'download-monitor' ),
87
+								'label'    => __('X-Accel-Redirect / X-Sendfile', 'download-monitor'),
88
+								'cb_label' => __('Enable', 'download-monitor'),
89
+								'desc'     => __('If supported, <code>X-Accel-Redirect</code> / <code>X-Sendfile</code> can be used to serve downloads instead of PHP (server requires <code>mod_xsendfile</code>).', 'download-monitor'),
90 90
 								'type'     => 'checkbox'
91 91
 							),
92 92
 							array(
93 93
 								'name'     => 'dlm_hotlink_protection_enabled',
94 94
 								'std'      => '',
95
-								'label'    => __( 'Prevent hotlinking', 'download-monitor' ),
96
-								'cb_label' => __( 'Enable', 'download-monitor' ),
97
-								'desc'     => __( 'If enabled, the download handler will check the PHP referer to see if it originated from your site and if not, redirect them to the homepage.', 'download-monitor' ),
95
+								'label'    => __('Prevent hotlinking', 'download-monitor'),
96
+								'cb_label' => __('Enable', 'download-monitor'),
97
+								'desc'     => __('If enabled, the download handler will check the PHP referer to see if it originated from your site and if not, redirect them to the homepage.', 'download-monitor'),
98 98
 								'type'     => 'checkbox'
99 99
 							),
100 100
 							array(
101 101
 								'name'     => 'dlm_allow_x_forwarded_for',
102 102
 								'std'      => '0',
103
-								'label'    => __( 'Allow Proxy IP Override', 'download-monitor' ),
104
-								'cb_label' => __( 'Enable', 'download-monitor' ),
105
-								'desc'     => __( 'If enabled, Download Monitor will use the X_FORWARDED_FOR HTTP header set by proxies as the IP address. Note that anyone can set this header, making it less secure.', 'download-monitor' ),
103
+								'label'    => __('Allow Proxy IP Override', 'download-monitor'),
104
+								'cb_label' => __('Enable', 'download-monitor'),
105
+								'desc'     => __('If enabled, Download Monitor will use the X_FORWARDED_FOR HTTP header set by proxies as the IP address. Note that anyone can set this header, making it less secure.', 'download-monitor'),
106 106
 								'type'     => 'checkbox'
107 107
 							),
108 108
 							array(
109 109
 								'name'     => 'dlm_wp_search_enabled',
110 110
 								'std'      => '',
111
-								'label'    => __( 'Include in Search', 'download-monitor' ),
112
-								'cb_label' => __( 'Enable', 'download-monitor' ),
113
-								'desc'     => __( "If enabled, downloads will be included in the site's internal search results.", 'download-monitor' ),
111
+								'label'    => __('Include in Search', 'download-monitor'),
112
+								'cb_label' => __('Enable', 'download-monitor'),
113
+								'desc'     => __("If enabled, downloads will be included in the site's internal search results.", 'download-monitor'),
114 114
 								'type'     => 'checkbox'
115 115
 							),
116 116
 						)
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 				)
119 119
 			),
120 120
 			'endpoints' => array(
121
-				'title'    => __( 'Endpoint', 'download-monitor' ),
121
+				'title'    => __('Endpoint', 'download-monitor'),
122 122
 				'sections' => array(
123 123
 					'endpoints' => array(
124 124
 						'fields' => array(
@@ -126,19 +126,19 @@  discard block
 block discarded – undo
126 126
 								'name'        => 'dlm_download_endpoint',
127 127
 								'type'        => 'text',
128 128
 								'std'         => 'download',
129
-								'placeholder' => __( 'download', 'download-monitor' ),
130
-								'label'       => __( 'Download Endpoint', 'download-monitor' ),
131
-								'desc'        => sprintf( __( 'Define what endpoint should be used for download links. By default this will be <code>%s</code>.', 'download-monitor' ), home_url( '/download/' ) )
129
+								'placeholder' => __('download', 'download-monitor'),
130
+								'label'       => __('Download Endpoint', 'download-monitor'),
131
+								'desc'        => sprintf(__('Define what endpoint should be used for download links. By default this will be <code>%s</code>.', 'download-monitor'), home_url('/download/'))
132 132
 							),
133 133
 							array(
134 134
 								'name'    => 'dlm_download_endpoint_value',
135 135
 								'std'     => 'ID',
136
-								'label'   => __( 'Endpoint Value', 'download-monitor' ),
137
-								'desc'    => sprintf( __( 'Define what unique value should be used on the end of your endpoint to identify the downloadable file. e.g. ID would give a link like <code>%s</code>', 'download-monitor' ), home_url( '/download/10/' ) ),
136
+								'label'   => __('Endpoint Value', 'download-monitor'),
137
+								'desc'    => sprintf(__('Define what unique value should be used on the end of your endpoint to identify the downloadable file. e.g. ID would give a link like <code>%s</code>', 'download-monitor'), home_url('/download/10/')),
138 138
 								'type'    => 'select',
139 139
 								'options' => array(
140
-									'ID'   => __( 'Download ID', 'download-monitor' ),
141
-									'slug' => __( 'Download slug', 'download-monitor' )
140
+									'ID'   => __('Download ID', 'download-monitor'),
141
+									'slug' => __('Download slug', 'download-monitor')
142 142
 								)
143 143
 							)
144 144
 						)
@@ -146,45 +146,45 @@  discard block
 block discarded – undo
146 146
 				)
147 147
 			),
148 148
 			'hash'      => array(
149
-				'title'    => __( 'Hashes', 'download-monitor' ),
149
+				'title'    => __('Hashes', 'download-monitor'),
150 150
 				'sections' => array(
151 151
 					'hash' => array(
152 152
 						'fields' => array(
153 153
 							array(
154 154
 								'name' => 'dlm_hash_desc',
155
-								'text' => sprintf( __( 'Hashes can optionally be output via shortcodes, but may cause performance issues with large files. %sYou can read more about hashes here%s', 'download-monitor' ), '<a href="https://www.download-monitor.com/kb/download-hashes/" target="_blank">', '</a>' ),
155
+								'text' => sprintf(__('Hashes can optionally be output via shortcodes, but may cause performance issues with large files. %sYou can read more about hashes here%s', 'download-monitor'), '<a href="https://www.download-monitor.com/kb/download-hashes/" target="_blank">', '</a>'),
156 156
 								'type' => 'desc'
157 157
 							),
158 158
 							array(
159 159
 								'name'     => 'dlm_generate_hash_md5',
160 160
 								'std'      => '0',
161
-								'label'    => __( 'MD5 hashes', 'download-monitor' ),
162
-								'cb_label' => __( 'Generate MD5 hash for uploaded files', 'download-monitor' ),
161
+								'label'    => __('MD5 hashes', 'download-monitor'),
162
+								'cb_label' => __('Generate MD5 hash for uploaded files', 'download-monitor'),
163 163
 								'desc'     => '',
164 164
 								'type'     => 'checkbox'
165 165
 							),
166 166
 							array(
167 167
 								'name'     => 'dlm_generate_hash_sha1',
168 168
 								'std'      => '0',
169
-								'label'    => __( 'SHA1 hashes', 'download-monitor' ),
170
-								'cb_label' => __( 'Generate SHA1 hash for uploaded files', 'download-monitor' ),
169
+								'label'    => __('SHA1 hashes', 'download-monitor'),
170
+								'cb_label' => __('Generate SHA1 hash for uploaded files', 'download-monitor'),
171 171
 								'desc'     => '',
172 172
 								'type'     => 'checkbox'
173 173
 							),
174 174
 							array(
175 175
 								'name'     => 'dlm_generate_hash_sha256',
176 176
 								'std'      => '0',
177
-								'label'    => __( 'SHA256 hashes', 'download-monitor' ),
178
-								'cb_label' => __( 'Generate SHA256 hash for uploaded files', 'download-monitor' ),
179
-								'desc'     => __( 'Hashes can optionally be output via shortcodes, but may cause performance issues with large files.', 'download-monitor' ),
177
+								'label'    => __('SHA256 hashes', 'download-monitor'),
178
+								'cb_label' => __('Generate SHA256 hash for uploaded files', 'download-monitor'),
179
+								'desc'     => __('Hashes can optionally be output via shortcodes, but may cause performance issues with large files.', 'download-monitor'),
180 180
 								'type'     => 'checkbox'
181 181
 							),
182 182
 							array(
183 183
 								'name'     => 'dlm_generate_hash_crc32b',
184 184
 								'std'      => '0',
185
-								'label'    => __( 'CRC32B hashes', 'download-monitor' ),
186
-								'cb_label' => __( 'Generate CRC32B hash for uploaded files', 'download-monitor' ),
187
-								'desc'     => __( 'Hashes can optionally be output via shortcodes, but may cause performance issues with large files.', 'download-monitor' ),
185
+								'label'    => __('CRC32B hashes', 'download-monitor'),
186
+								'cb_label' => __('Generate CRC32B hash for uploaded files', 'download-monitor'),
187
+								'desc'     => __('Hashes can optionally be output via shortcodes, but may cause performance issues with large files.', 'download-monitor'),
188 188
 								'type'     => 'checkbox'
189 189
 							)
190 190
 						)
@@ -192,44 +192,44 @@  discard block
 block discarded – undo
192 192
 				)
193 193
 			),
194 194
 			'logging'   => array(
195
-				'title'    => __( 'Logging', 'download-monitor' ),
195
+				'title'    => __('Logging', 'download-monitor'),
196 196
 				'sections' => array(
197 197
 					'logging' => array(
198 198
 						'fields' => array(
199 199
 							array(
200 200
 								'name'     => 'dlm_enable_logging',
201
-								'cb_label' => __( 'Enable', 'download-monitor' ),
201
+								'cb_label' => __('Enable', 'download-monitor'),
202 202
 								'std'      => '1',
203
-								'label'    => __( 'Download Log', 'download-monitor' ),
204
-								'desc'     => __( 'Log download attempts, IP addresses and more.', 'download-monitor' ),
203
+								'label'    => __('Download Log', 'download-monitor'),
204
+								'desc'     => __('Log download attempts, IP addresses and more.', 'download-monitor'),
205 205
 								'type'     => 'checkbox'
206 206
 							),
207 207
 							array(
208 208
 								'name'    => 'dlm_logging_ip_type',
209 209
 								'std'     => '',
210
-								'label'   => __( 'IP Address Logging', 'download-monitor' ),
211
-								'desc'    => __( 'Define if and how you like to store IP addresses of users that download your files in your logs.', 'download-monitor' ),
210
+								'label'   => __('IP Address Logging', 'download-monitor'),
211
+								'desc'    => __('Define if and how you like to store IP addresses of users that download your files in your logs.', 'download-monitor'),
212 212
 								'type'    => 'select',
213 213
 								'options' => array(
214
-									'full'       => __( 'Store full IP address', 'download-monitor' ),
215
-									'anonymized' => __( 'Store anonymized IP address (remove last 3 digits)', 'download-monitor' ),
216
-									'none'       => __( 'Store no IP address', 'download-monitor' )
214
+									'full'       => __('Store full IP address', 'download-monitor'),
215
+									'anonymized' => __('Store anonymized IP address (remove last 3 digits)', 'download-monitor'),
216
+									'none'       => __('Store no IP address', 'download-monitor')
217 217
 								)
218 218
 							),
219 219
 							array(
220 220
 								'name'     => 'dlm_logging_ua',
221 221
 								'std'      => '1',
222
-								'label'    => __( 'User Agent Logging', 'download-monitor' ),
223
-								'cb_label' => __( 'Enable', 'download-monitor' ),
224
-								'desc'     => __( 'If enabled, the user agent (browser) the user uses to download the file will be stored in your logs.', 'download-monitor' ),
222
+								'label'    => __('User Agent Logging', 'download-monitor'),
223
+								'cb_label' => __('Enable', 'download-monitor'),
224
+								'desc'     => __('If enabled, the user agent (browser) the user uses to download the file will be stored in your logs.', 'download-monitor'),
225 225
 								'type'     => 'checkbox'
226 226
 							),
227 227
 							array(
228 228
 								'name'     => 'dlm_count_unique_ips',
229 229
 								'std'      => '',
230
-								'label'    => __( 'Count unique IPs only', 'download-monitor' ),
231
-								'cb_label' => __( 'Enable', 'download-monitor' ),
232
-								'desc'     => sprintf( __( 'If enabled, the counter for each download will only increment and create a log entry once per IP address. Note that this option only works if %s is set to %s.', 'download-monitor' ), '<strong>' . __( 'IP Address Logging', 'download-monitor' ) . '</strong>', '<strong>' . __( 'Store full IP address', 'download-monitor' ) . '</strong>' ),
230
+								'label'    => __('Count unique IPs only', 'download-monitor'),
231
+								'cb_label' => __('Enable', 'download-monitor'),
232
+								'desc'     => sprintf(__('If enabled, the counter for each download will only increment and create a log entry once per IP address. Note that this option only works if %s is set to %s.', 'download-monitor'), '<strong>' . __('IP Address Logging', 'download-monitor') . '</strong>', '<strong>' . __('Store full IP address', 'download-monitor') . '</strong>'),
233 233
 								'type'     => 'checkbox'
234 234
 							),
235 235
 						)
@@ -237,31 +237,31 @@  discard block
 block discarded – undo
237 237
 				)
238 238
 			),
239 239
 			'access'    => array(
240
-				'title'    => __( 'Access', 'download-monitor' ),
240
+				'title'    => __('Access', 'download-monitor'),
241 241
 				'sections' => array(
242 242
 					'access' => array(
243 243
 						'fields' => array(
244 244
 							array(
245 245
 								'name'        => 'dlm_no_access_error',
246
-								'std'         => sprintf( __( 'You do not have permission to access this download. %sGo to homepage%s', 'download-monitor' ), '<a href="' . home_url() . '">', '</a>' ),
246
+								'std'         => sprintf(__('You do not have permission to access this download. %sGo to homepage%s', 'download-monitor'), '<a href="' . home_url() . '">', '</a>'),
247 247
 								'placeholder' => '',
248
-								'label'       => __( 'No access message', 'download-monitor' ),
249
-								'desc'        => __( "The message that will be displayed to visitors when they don't have access to a file.", 'download-monitor' ),
248
+								'label'       => __('No access message', 'download-monitor'),
249
+								'desc'        => __("The message that will be displayed to visitors when they don't have access to a file.", 'download-monitor'),
250 250
 								'type'        => 'textarea'
251 251
 							),
252 252
 							array(
253 253
 								'name'        => 'dlm_ip_blacklist',
254 254
 								'std'         => '192.168.0.0/24',
255
-								'label'       => __( 'Blacklist IPs', 'download-monitor' ),
256
-								'desc'        => __( 'List IP Addresses to blacklist, 1 per line. Use IP/CIDR netmask format for ranges. IPv4 examples: <code>198.51.100.1</code> or <code>198.51.100.0/24</code>. IPv6 examples: <code>2001:db8::1</code> or <code>2001:db8::/32</code>.', 'download-monitor' ),
255
+								'label'       => __('Blacklist IPs', 'download-monitor'),
256
+								'desc'        => __('List IP Addresses to blacklist, 1 per line. Use IP/CIDR netmask format for ranges. IPv4 examples: <code>198.51.100.1</code> or <code>198.51.100.0/24</code>. IPv6 examples: <code>2001:db8::1</code> or <code>2001:db8::/32</code>.', 'download-monitor'),
257 257
 								'placeholder' => '',
258 258
 								'type'        => 'textarea'
259 259
 							),
260 260
 							array(
261 261
 								'name'        => 'dlm_user_agent_blacklist',
262 262
 								'std'         => 'Googlebot',
263
-								'label'       => __( 'Blacklist user agents', 'download-monitor' ),
264
-								'desc'        => __( 'List browser user agents to blacklist, 1 per line.  Partial matches are sufficient. Regex matching is allowed by surrounding the pattern with forward slashes, e.g. <code>/^Mozilla.+Googlebot/</code>', 'download-monitor' ),
263
+								'label'       => __('Blacklist user agents', 'download-monitor'),
264
+								'desc'        => __('List browser user agents to blacklist, 1 per line.  Partial matches are sufficient. Regex matching is allowed by surrounding the pattern with forward slashes, e.g. <code>/^Mozilla.+Googlebot/</code>', 'download-monitor'),
265 265
 								'placeholder' => '',
266 266
 								'type'        => 'textarea'
267 267
 							),
@@ -270,31 +270,31 @@  discard block
 block discarded – undo
270 270
 				)
271 271
 			),
272 272
 			'pages'     => array(
273
-				'title'    => __( 'Pages', 'download-monitor' ),
273
+				'title'    => __('Pages', 'download-monitor'),
274 274
 				'sections' => array(
275 275
 					'pages' => array(
276 276
 						'fields' => array(
277 277
 							array(
278 278
 								'name'    => 'dlm_no_access_page',
279 279
 								'std'     => '',
280
-								'label'   => __( 'No Access Page', 'download-monitor' ),
281
-								'desc'    => __( "Choose what page is displayed when the user has no access to a file. Don't forget to add the <code>[dlm_no_access]</code> shortcode to the page.", 'download-monitor' ),
280
+								'label'   => __('No Access Page', 'download-monitor'),
281
+								'desc'    => __("Choose what page is displayed when the user has no access to a file. Don't forget to add the <code>[dlm_no_access]</code> shortcode to the page.", 'download-monitor'),
282 282
 								'type'    => 'lazy_select',
283 283
 								'options' => array()
284 284
 							),
285 285
 							array(
286 286
 								'name'    => 'dlm_page_cart',
287 287
 								'std'     => '',
288
-								'label'   => __( 'Cart page', 'download-monitor' ),
289
-								'desc'    => __( 'Your cart page, make sure it has the <code>[dlm_cart]</code> shortcode.', 'download-monitor' ),
288
+								'label'   => __('Cart page', 'download-monitor'),
289
+								'desc'    => __('Your cart page, make sure it has the <code>[dlm_cart]</code> shortcode.', 'download-monitor'),
290 290
 								'type'    => 'lazy_select',
291 291
 								'options' => array()
292 292
 							),
293 293
 							array(
294 294
 								'name'    => 'dlm_page_checkout',
295 295
 								'std'     => '',
296
-								'label'   => __( 'Checkout page', 'download-monitor' ),
297
-								'desc'    => __( 'Your checkout page, make sure it has the <code>[dlm_checkout]</code> shortcode.', 'download-monitor' ),
296
+								'label'   => __('Checkout page', 'download-monitor'),
297
+								'desc'    => __('Your checkout page, make sure it has the <code>[dlm_checkout]</code> shortcode.', 'download-monitor'),
298 298
 								'type'    => 'lazy_select',
299 299
 								'options' => array()
300 300
 							),
@@ -303,60 +303,60 @@  discard block
 block discarded – undo
303 303
 				)
304 304
 			),
305 305
 			'shop'      => array(
306
-				'title'    => __( 'Shop', 'download-monitor' ),
306
+				'title'    => __('Shop', 'download-monitor'),
307 307
 				'sections' => array(
308 308
 					'general' => array(
309
-						'title'  => __( 'General', 'download-monitor' ),
309
+						'title'  => __('General', 'download-monitor'),
310 310
 						'fields' => array(
311 311
 							array(
312 312
 								'name'    => 'dlm_base_country',
313 313
 								'std'     => 'US',
314
-								'label'   => __( 'Base Country', 'download-monitor' ),
315
-								'desc'    => __( 'Where is your store located?', 'download-monitor' ),
314
+								'label'   => __('Base Country', 'download-monitor'),
315
+								'desc'    => __('Where is your store located?', 'download-monitor'),
316 316
 								'type'    => 'select',
317
-								'options' => Services::get()->service( "country" )->get_countries()
317
+								'options' => Services::get()->service("country")->get_countries()
318 318
 							),
319 319
 							array(
320 320
 								'name'    => 'dlm_currency',
321 321
 								'std'     => 'USD',
322
-								'label'   => __( 'Currency', 'download-monitor' ),
323
-								'desc'    => __( 'In what currency are you selling?', 'download-monitor' ),
322
+								'label'   => __('Currency', 'download-monitor'),
323
+								'desc'    => __('In what currency are you selling?', 'download-monitor'),
324 324
 								'type'    => 'select',
325 325
 								'options' => $this->get_currency_list_with_symbols()
326 326
 							),
327 327
 							array(
328 328
 								'name'    => 'dlm_currency_pos',
329 329
 								'std'     => 'left',
330
-								'label'   => __( 'Currency Position', 'download-monitor' ),
331
-								'desc'    => __( 'The position of the currency symbol.', 'download-monitor' ),
330
+								'label'   => __('Currency Position', 'download-monitor'),
331
+								'desc'    => __('The position of the currency symbol.', 'download-monitor'),
332 332
 								'type'    => 'select',
333 333
 								'options' => array(
334
-									'left'        => sprintf( __( 'Left (%s)', 'download-monitor' ), Services::get()->service( 'format' )->money( 9.99, array( 'currency_position' => 'left' ) ) ),
335
-									'right'       => sprintf( __( 'Right (%s)', 'download-monitor' ), Services::get()->service( 'format' )->money( 9.99, array( 'currency_position' => 'right' ) ) ),
336
-									'left_space'  => sprintf( __( 'Left with space (%s)', 'download-monitor' ), Services::get()->service( 'format' )->money( 9.99, array( 'currency_position' => 'left_space' ) ) ),
337
-									'right_space' => sprintf( __( 'Right with space (%s)', 'download-monitor' ), Services::get()->service( 'format' )->money( 9.99, array( 'currency_position' => 'right_space' ) ) )
334
+									'left'        => sprintf(__('Left (%s)', 'download-monitor'), Services::get()->service('format')->money(9.99, array('currency_position' => 'left'))),
335
+									'right'       => sprintf(__('Right (%s)', 'download-monitor'), Services::get()->service('format')->money(9.99, array('currency_position' => 'right'))),
336
+									'left_space'  => sprintf(__('Left with space (%s)', 'download-monitor'), Services::get()->service('format')->money(9.99, array('currency_position' => 'left_space'))),
337
+									'right_space' => sprintf(__('Right with space (%s)', 'download-monitor'), Services::get()->service('format')->money(9.99, array('currency_position' => 'right_space')))
338 338
 								)
339 339
 							),
340 340
 							array(
341 341
 								'name'  => 'dlm_decimal_separator',
342 342
 								'type'  => 'text',
343 343
 								'std'   => '.',
344
-								'label' => __( 'Decimal Separator', 'download-monitor' ),
345
-								'desc'  => __( 'The decimal separator of displayed prices.', 'download-monitor' )
344
+								'label' => __('Decimal Separator', 'download-monitor'),
345
+								'desc'  => __('The decimal separator of displayed prices.', 'download-monitor')
346 346
 							),
347 347
 							array(
348 348
 								'name'  => 'dlm_thousand_separator',
349 349
 								'type'  => 'text',
350 350
 								'std'   => ',',
351
-								'label' => __( 'Thousand Separator', 'download-monitor' ),
352
-								'desc'  => __( 'The thousand separator of displayed prices.', 'download-monitor' )
351
+								'label' => __('Thousand Separator', 'download-monitor'),
352
+								'desc'  => __('The thousand separator of displayed prices.', 'download-monitor')
353 353
 							),
354 354
 							array(
355 355
 								'name'     => 'dlm_disable_cart',
356 356
 								'std'      => '',
357
-								'label'    => __( 'Disable Cart', 'download-monitor' ),
358
-								'cb_label' => __( 'Disable', 'download-monitor' ),
359
-								'desc'     => __( 'If checked, your customers will be send to your checkout page directly.', 'download-monitor' ),
357
+								'label'    => __('Disable Cart', 'download-monitor'),
358
+								'cb_label' => __('Disable', 'download-monitor'),
359
+								'desc'     => __('If checked, your customers will be send to your checkout page directly.', 'download-monitor'),
360 360
 								'type'     => 'checkbox'
361 361
 							),
362 362
 						)
@@ -364,27 +364,27 @@  discard block
 block discarded – undo
364 364
 				)
365 365
 			),
366 366
 			'payments'  => array(
367
-				'title'    => __( 'Payment Methods', 'download-monitor' ),
367
+				'title'    => __('Payment Methods', 'download-monitor'),
368 368
 				'sections' => $this->get_payment_methods_sections()
369 369
 			),
370 370
 			'misc'      => array(
371
-				'title'    => __( 'Misc', 'download-monitor' ),
371
+				'title'    => __('Misc', 'download-monitor'),
372 372
 				'sections' => array(
373 373
 					'misc' => array(
374 374
 						'fields' => array(
375 375
 							array(
376 376
 								'name'     => 'dlm_clean_on_uninstall',
377 377
 								'std'      => '0',
378
-								'label'    => __( 'Remove Data on Uninstall?', 'download-monitor' ),
379
-								'cb_label' => __( 'Enable', 'download-monitor' ),
380
-								'desc'     => __( 'Check this box if you would like to completely remove all Download Monitor data when the plugin is deleted.', 'download-monitor' ),
378
+								'label'    => __('Remove Data on Uninstall?', 'download-monitor'),
379
+								'cb_label' => __('Enable', 'download-monitor'),
380
+								'desc'     => __('Check this box if you would like to completely remove all Download Monitor data when the plugin is deleted.', 'download-monitor'),
381 381
 								'type'     => 'checkbox'
382 382
 							),
383 383
 							array(
384 384
 								'name'  => 'dlm_clear_transients',
385 385
 								'std'   => '0',
386
-								'label' => __( 'Clear all transients', 'download-monitor' ),
387
-								'desc'  => __( 'Remove all Download Monitor transients, this can solve version caching issues.', 'download-monitor' ),
386
+								'label' => __('Clear all transients', 'download-monitor'),
387
+								'desc'  => __('Remove all Download Monitor transients, this can solve version caching issues.', 'download-monitor'),
388 388
 								'type'  => 'action_button',
389 389
 								'link'  => self::get_url() . '#settings-misc'
390 390
 							),
@@ -395,10 +395,10 @@  discard block
 block discarded – undo
395 395
 		);
396 396
 
397 397
 		// this is here to maintain backwards compatibility, use 'dlm_settings' instead
398
-		$settings = apply_filters( 'download_monitor_settings', $settings );
398
+		$settings = apply_filters('download_monitor_settings', $settings);
399 399
 
400 400
 		// This is the correct filter
401
-		$settings = apply_filters( 'dlm_settings', $settings );
401
+		$settings = apply_filters('dlm_settings', $settings);
402 402
 
403 403
 		return $settings;
404 404
 	}
@@ -407,9 +407,9 @@  discard block
 block discarded – undo
407 407
 	 * Register lazy load setting fields callbacks
408 408
 	 */
409 409
 	public function register_lazy_load_callbacks() {
410
-		add_filter( 'dlm_settings_lazy_select_dlm_page_cart', array( $this, 'lazy_select_dlm_no_access_page' ) );
411
-		add_filter( 'dlm_settings_lazy_select_dlm_page_checkout', array( $this, 'lazy_select_dlm_no_access_page' ) );
412
-		add_filter( 'dlm_settings_lazy_select_dlm_no_access_page', array( $this, 'lazy_select_dlm_no_access_page' ) );
410
+		add_filter('dlm_settings_lazy_select_dlm_page_cart', array($this, 'lazy_select_dlm_no_access_page'));
411
+		add_filter('dlm_settings_lazy_select_dlm_page_checkout', array($this, 'lazy_select_dlm_no_access_page'));
412
+		add_filter('dlm_settings_lazy_select_dlm_no_access_page', array($this, 'lazy_select_dlm_no_access_page'));
413 413
 	}
414 414
 
415 415
 	/**
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 	 *
420 420
 	 * @return array
421 421
 	 */
422
-	public function lazy_select_dlm_no_access_page( $options ) {
422
+	public function lazy_select_dlm_no_access_page($options) {
423 423
 		return $this->get_pages();
424 424
 	}
425 425
 
@@ -432,12 +432,12 @@  discard block
 block discarded – undo
432 432
 	 *
433 433
 	 * @return array
434 434
 	 */
435
-	public function backwards_compatibility_settings( $settings ) {
435
+	public function backwards_compatibility_settings($settings) {
436 436
 
437
-		foreach ( $settings as $tab_key => $tab ) {
437
+		foreach ($settings as $tab_key => $tab) {
438 438
 
439 439
 			// if 'sections' is not set, it's most likely old format
440
-			if ( ! isset( $tab['sections'] ) ) {
440
+			if ( ! isset($tab['sections'])) {
441 441
 
442 442
 				$new_tab = array(
443 443
 					'title'    => $tab[0], // old format just had title as first key
@@ -463,15 +463,15 @@  discard block
 block discarded – undo
463 463
 	private function get_pages() {
464 464
 
465 465
 		// pages
466
-		$pages = array( array( 'key' => 0, 'lbl' => __( 'Select Page', 'download-monitor' ) ) );
466
+		$pages = array(array('key' => 0, 'lbl' => __('Select Page', 'download-monitor')));
467 467
 
468 468
 		// get pages from db
469 469
 		$db_pages = get_pages();
470 470
 
471 471
 		// check and loop
472
-		if ( count( $db_pages ) > 0 ) {
473
-			foreach ( $db_pages as $db_page ) {
474
-				$pages[] = array( 'key' => $db_page->ID, 'lbl' => $db_page->post_title );
472
+		if (count($db_pages) > 0) {
473
+			foreach ($db_pages as $db_page) {
474
+				$pages[] = array('key' => $db_page->ID, 'lbl' => $db_page->post_title);
475 475
 			}
476 476
 		}
477 477
 
@@ -487,15 +487,15 @@  discard block
 block discarded – undo
487 487
 	private function get_currency_list_with_symbols() {
488 488
 
489 489
 		/** @var \Never5\DownloadMonitor\Shop\Helper\Currency $currency_helper */
490
-		$currency_helper = Services::get()->service( "currency" );
490
+		$currency_helper = Services::get()->service("currency");
491 491
 
492 492
 		$currencies = $currency_helper->get_available_currencies();
493 493
 
494 494
 		//get_currency_symbol
495 495
 
496
-		if ( ! empty( $currencies ) ) {
497
-			foreach ( $currencies as $k => $v ) {
498
-				$currencies[ $k ] = $v . " (" . $currency_helper->get_currency_symbol( $k ) . ")";
496
+		if ( ! empty($currencies)) {
497
+			foreach ($currencies as $k => $v) {
498
+				$currencies[$k] = $v . " (" . $currency_helper->get_currency_symbol($k) . ")";
499 499
 			}
500 500
 		}
501 501
 
@@ -509,34 +509,34 @@  discard block
 block discarded – undo
509 509
 	 */
510 510
 	private function get_payment_methods_sections() {
511 511
 
512
-		$gateways = Services::get()->service( 'payment_gateway' )->get_all_gateways();
512
+		$gateways = Services::get()->service('payment_gateway')->get_all_gateways();
513 513
 
514 514
 		// formatted array of gateways with id=>title map (used in select fields)
515 515
 		$gateways_formatted = array();
516
-		if ( ! empty( $gateways ) ) {
517
-			foreach ( $gateways as $gateway ) {
518
-				$gateways_formatted[ $gateway->get_id() ] = $gateway->get_title();
516
+		if ( ! empty($gateways)) {
517
+			foreach ($gateways as $gateway) {
518
+				$gateways_formatted[$gateway->get_id()] = $gateway->get_title();
519 519
 			}
520 520
 		}
521 521
 
522 522
 		/** Generate the overview sections */
523 523
 		$sections = array(
524 524
 			'overview' => array(
525
-				'title'  => __( 'Overview', 'download-monitor' ),
525
+				'title'  => __('Overview', 'download-monitor'),
526 526
 				'fields' => array(
527 527
 					array(
528 528
 						'name'     => '',
529 529
 						'std'      => 'USD',
530
-						'label'    => __( 'Enabled Gateways', 'download-monitor' ),
531
-						'desc'     => __( 'Check all payment methods you want to enable on your webshop.', 'download-monitor' ),
530
+						'label'    => __('Enabled Gateways', 'download-monitor'),
531
+						'desc'     => __('Check all payment methods you want to enable on your webshop.', 'download-monitor'),
532 532
 						'type'     => 'gateway_overview',
533 533
 						'gateways' => $gateways
534 534
 					),
535 535
 					array(
536 536
 						'name'    => 'dlm_default_gateway',
537 537
 						'std'     => 'paypal',
538
-						'label'   => __( 'Default Gateway', 'download-monitor' ),
539
-						'desc'    => __( 'This payment method will be pre-selected on your checkout page.', 'download-monitor' ),
538
+						'label'   => __('Default Gateway', 'download-monitor'),
539
+						'desc'    => __('This payment method will be pre-selected on your checkout page.', 'download-monitor'),
540 540
 						'type'    => 'select',
541 541
 						'options' => $gateways_formatted
542 542
 					),
@@ -545,26 +545,26 @@  discard block
 block discarded – undo
545 545
 		);
546 546
 
547 547
 		/** Generate sections for all gateways */
548
-		if ( ! empty( $gateways ) ) {
548
+		if ( ! empty($gateways)) {
549 549
 			/** @var \Never5\DownloadMonitor\Shop\Checkout\PaymentGateway\PaymentGateway $gateway */
550
-			foreach ( $gateways as $gateway ) {
550
+			foreach ($gateways as $gateway) {
551 551
 
552 552
 				// all gateways have an 'enabled' option by default
553 553
 				$fields = array(
554 554
 					array(
555
-						'name'     => 'dlm_gateway_' . esc_attr( $gateway->get_id() ) . '_enabled',
555
+						'name'     => 'dlm_gateway_' . esc_attr($gateway->get_id()) . '_enabled',
556 556
 						'std'      => '0',
557
-						'label'    => __( 'Enabled', 'download-monitor' ),
558
-						'cb_label' => __( 'Enable Gateway', 'download-monitor' ),
559
-						'desc'     => __( 'Check this to allow your customers to use this payment method to pay at your checkout page.', 'download-monitor' ),
557
+						'label'    => __('Enabled', 'download-monitor'),
558
+						'cb_label' => __('Enable Gateway', 'download-monitor'),
559
+						'desc'     => __('Check this to allow your customers to use this payment method to pay at your checkout page.', 'download-monitor'),
560 560
 						'type'     => 'checkbox'
561 561
 					)
562 562
 				);
563 563
 
564 564
 				$gateway_settings = $gateway->get_settings();
565
-				if ( ! empty( $gateway_settings ) ) {
566
-					$escaped_id = esc_attr( $gateway->get_id() );
567
-					foreach ( $gateway_settings as $gw ) {
565
+				if ( ! empty($gateway_settings)) {
566
+					$escaped_id = esc_attr($gateway->get_id());
567
+					foreach ($gateway_settings as $gw) {
568 568
 						$prefixed_field = $gw;
569 569
 
570 570
 						$prefixed_field['name'] = 'dlm_gateway_' . $escaped_id . '_' . $prefixed_field['name'];
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 
577 577
 				//dlm_gateway_paypal_
578 578
 
579
-				$sections[ $gateway->get_id() ] = array(
579
+				$sections[$gateway->get_id()] = array(
580 580
 					'title'  => $gateway->get_title(),
581 581
 					'fields' => $fields
582 582
 				);
Please login to merge, or discard this patch.