Skip to content

Commit 5edf3e6

Browse files
committed
v bump; text domain fix
1 parent b3ce637 commit 5edf3e6

File tree

3 files changed

+140
-129
lines changed

3 files changed

+140
-129
lines changed

dlm-advanced-settings.php

Lines changed: 133 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Plugin Name: DLM - Advanced Settings
44
Plugin URI: https://github.com/razvanaldea89/dlm-advanced-settings
55
Description: A lightweight plugin that taps into Download Monitor's hooks and offers a way to manipulate them via the admin panel.
6-
Version: 1.0.3
6+
Version: 1.0.4
77
Author: Razvan Aldea
88
Requires Plugins: download-monitor
99
Author URI: https://profiles.wordpress.org/raldea89/
@@ -38,7 +38,7 @@ class DLM_Advanced_Settings {
3838
*
3939
* @since 1.0.0
4040
*/
41-
const VERSION = '1.0.3';
41+
const VERSION = '1.0.4';
4242

4343
/**
4444
* Plugin instance
@@ -206,124 +206,6 @@ private function __construct() {
206206
}
207207
}
208208

209-
$this->hooks = array(
210-
'dlm_remove_upsells' => array(
211-
'label' => __( 'Remove upsells', 'dlm-advanced-settings' ),
212-
'default' => '0',
213-
'params' => 1,
214-
'type' => 'checkbox',
215-
'description' => __( 'Remove upsells from the Download Monitor admin settings pages.', 'dlm-advanced-settings' ),
216-
),
217-
'dlm_delete_files' => array(
218-
'label' => __( 'Delete files when deleting a download', 'dlm-advanced-settings' ),
219-
'default' => '0',
220-
'params' => 1,
221-
'type' => 'checkbox',
222-
'description' => __( 'Enabling this will let you automatically delete files associated with a Download upon the Download deletion', 'dlm-advanced-settings' ),
223-
),
224-
'dlm_hotlink_protection' => array(
225-
'label' => __( 'Hotlink protection', 'dlm-advanced-settings' ),
226-
'default' => '0',
227-
'params' => 1,
228-
'type' => 'checkbox',
229-
'description' => __( 'Enabling this will allow the download handler to check the PHP referer to see if it originated from your site and if not, redirect them to the homepage.', 'dlm-advanced-settings' ),
230-
),
231-
'dlm_allow_x_forwarded_for' => array(
232-
'label' => __( 'Allow Proxy IP Override', 'dlm-advanced-settings' ),
233-
'default' => '0',
234-
'params' => 1,
235-
'type' => 'checkbox',
236-
'description' => __( 'If enabled, Download Monitor will use the <code>X_FORWARDED_FOR</code> HTTP header set by proxies as the IP address. Note that anyone can set this header, making it less secure.', 'dlm-advanced-settings' ),
237-
),
238-
'dlm_x_sendfile' => array(
239-
'label' => 'Enable X-Accel-Redirect / X-Sendfile',
240-
'default' => '0',
241-
'params' => 1,
242-
'type' => 'checkbox',
243-
'description' => __( 'If supported, <code>X-Accel-Redirect / X-Sendfile</code> can be used to serve downloads instead of PHP (server requires mod_xsendfile) Attention! Enabling this option will disable the XHR functionality!', 'dlm-advanced-settings' ),
244-
),
245-
'dlm_timestamp_link' => array(
246-
'label' => __( 'Show a timestamp in the download link', 'dlm-advanced-settings' ),
247-
'default' => '1',
248-
'params' => 1,
249-
'type' => 'checkbox',
250-
'description' => __( 'If enabled, the download URL will have a timestamp attached as a parameter. This serves as a cache preventing solution for plugins that cache the URL.', 'dlm-advanced-settings' ),
251-
),
252-
'dlm_enable_reports' => array(
253-
'label' => __( 'Enable reports', 'dlm-advanced-settings' ),
254-
'default' => '1',
255-
'params' => 1,
256-
'type' => 'checkbox',
257-
'description' => __( 'Enable or disable the Reports functionality. This will also enable/disable logging detailed info into the Logs Table of the Database. Disabling this will not disable the download count funtionality.', 'dlm-advanced-settings' ),
258-
),
259-
'dlm_hide_meta_version' => array(
260-
'label' => __( 'Hide meta version in header', 'dlm-advanced-settings' ),
261-
'default' => '0',
262-
'params' => 1,
263-
'type' => 'checkbox',
264-
'description' => __( 'Hide or show Download Monitor\'s version in the HTML\'s head.', 'dlm-advanced-settings' ),
265-
),
266-
'dlm_count_meta_downloads' => array(
267-
'label' => __( 'Add meta value to download count', 'dlm-advanced-settings' ),
268-
'default' => '1',
269-
'params' => 1,
270-
'type' => 'checkbox',
271-
'description' => __( 'Add the manual download count ( the one set when editing a Download ) to the total download count of a Download', 'dlm-advanced-settings' ),
272-
),
273-
'dlm_do_xhr' => array(
274-
'label' => __( 'XHR downloads', 'dlm-advanced-settings' ),
275-
'default' => '1',
276-
'params' => 1,
277-
'type' => 'checkbox',
278-
'description' => __( 'Enable or disable downloading files using the newly XHR functionality. Disabling this may cause the reports to not be so pricise.', 'dlm-advanced-settings' ),
279-
),
280-
'dlm_restricted_file_types' => array(
281-
'label' => __( 'Restricted file types', 'dlm-advanced-settings' ),
282-
'default' => '',
283-
'params' => 2,
284-
'type' => 'text',
285-
'description' => __( 'Define extra file types that should be restricted. Each file type needs to be separated by a comma (<code>,</code>). Only input the extension( ex.: txt, pdf ).', 'dlm-advanced-settings' ),
286-
),
287-
'dlm_404_redirect' => array(
288-
'label' => __( '404 redirect URL', 'dlm-advanced-settings' ),
289-
'default' => '',
290-
'params' => 1,
291-
'type' => 'text',
292-
'description' => __( 'Define a custom 404 redirect for when a Download can\'t be found.', 'dlm-advanced-settings' ),
293-
),
294-
'dlm_placeholder_image_src' => array(
295-
'label' => __( 'Placeholder image src', 'dlm-advanced-settings' ),
296-
'default' => download_monitor()->get_plugin_url() . '/assets/images/placeholder.png',
297-
'params' => 1,
298-
'type' => 'text',
299-
'description' => __( 'Define a custom URL for the Download CPT placeholder.', 'dlm-advanced-settings' ),
300-
),
301-
'dlm_reports_server_limits' => array(
302-
'label' => __( 'Reports server limits', 'dlm-advanced-settings' ),
303-
'default' => $this->php_info,
304-
'params' => 1,
305-
'type' => 'multi_text',
306-
'description' => __( 'Define other servet limits. Usefull when you have any problems with the Reports not being displayed a possible problem might be your server\'s lack of resources. This way you can control how much data is retrieved in one request.', 'dlm-advanced-settings' ),
307-
),
308-
'dlm_xhr_progress' => array(
309-
'label' => __( 'XHR progress animation', 'dlm-advanced-settings' ),
310-
'default' => array(
311-
'display' => true,
312-
'animation' => includes_url( '/images/spinner.gif' ),
313-
),
314-
'params' => 1,
315-
'type' => 'multi_text',
316-
'description' => __( 'Define whether to display the XHR progress or not. Also, define a custom URL for the loading animation.', 'dlm-advanced-settings' ),
317-
),
318-
);
319-
320-
$defaults = array();
321-
foreach ( $this->hooks as $key => $setting ) {
322-
$defaults[ $key ] = $setting['default'];
323-
}
324-
325-
$this->settings = wp_parse_args( get_option( 'dlm-as-settings', array() ), $defaults );
326-
327209
$this->set_wp_hooks();
328210
}
329211

@@ -350,7 +232,8 @@ public static function get_instance() {
350232
private function set_wp_hooks() {
351233
add_action( 'admin_init', array( $this, 'register_settings' ) );
352234
add_filter( 'dlm_admin_menu_links', array( $this, 'add_submenu_page' ), 120 );
353-
add_action( 'init', array( $this, 'set_dlm_hooks' ) );
235+
add_action( 'init', array( $this, 'set_default_hooks' ), 10 );
236+
add_action( 'init', array( $this, 'set_dlm_hooks' ), 15 );
354237
add_action( 'pre_update_option', array( $this, 'sanitize_settings' ), 15, 3 );
355238
}
356239

@@ -377,7 +260,7 @@ public function register_settings() {
377260
/**
378261
* Add the submenu page to the Downloads menu
379262
*
380-
* @param array $links The links array.
263+
* @param array $links The links array.
381264
*
382265
* @since 1.0.0
383266
*/
@@ -526,9 +409,9 @@ public function set_dlm_hooks() {
526409
/**
527410
* Sanitize settings
528411
*
529-
* @param array $value The new value.
530-
* @param array $option The option.
531-
* @param array $old_value The old value.
412+
* @param array $value The new value.
413+
* @param array $option The option.
414+
* @param array $old_value The old value.
532415
*
533416
* @return array
534417
* @since 1.0.0
@@ -554,6 +437,131 @@ public function sanitize_settings( $value, $option, $old_value ) {
554437
// Return value.
555438
return $value;
556439
}
440+
441+
/**
442+
* @return void
443+
*
444+
* @since 1.0.5 - moved the default hooks to a separate method
445+
*/
446+
public function set_default_hooks() {
447+
$this->hooks = array(
448+
'dlm_remove_upsells' => array(
449+
'label' => __( 'Remove upsells', 'dlm-advanced-settings' ),
450+
'default' => '0',
451+
'params' => 1,
452+
'type' => 'checkbox',
453+
'description' => __( 'Remove upsells from the Download Monitor admin settings pages.', 'dlm-advanced-settings' ),
454+
),
455+
'dlm_delete_files' => array(
456+
'label' => __( 'Delete files when deleting a download', 'dlm-advanced-settings' ),
457+
'default' => '0',
458+
'params' => 1,
459+
'type' => 'checkbox',
460+
'description' => __( 'Enabling this will let you automatically delete files associated with a Download upon the Download deletion', 'dlm-advanced-settings' ),
461+
),
462+
'dlm_hotlink_protection' => array(
463+
'label' => __( 'Hotlink protection', 'dlm-advanced-settings' ),
464+
'default' => '0',
465+
'params' => 1,
466+
'type' => 'checkbox',
467+
'description' => __( 'Enabling this will allow the download handler to check the PHP referer to see if it originated from your site and if not, redirect them to the homepage.', 'dlm-advanced-settings' ),
468+
),
469+
'dlm_allow_x_forwarded_for' => array(
470+
'label' => __( 'Allow Proxy IP Override', 'dlm-advanced-settings' ),
471+
'default' => '0',
472+
'params' => 1,
473+
'type' => 'checkbox',
474+
'description' => __( 'If enabled, Download Monitor will use the <code>X_FORWARDED_FOR</code> HTTP header set by proxies as the IP address. Note that anyone can set this header, making it less secure.', 'dlm-advanced-settings' ),
475+
),
476+
'dlm_x_sendfile' => array(
477+
'label' => 'Enable X-Accel-Redirect / X-Sendfile',
478+
'default' => '0',
479+
'params' => 1,
480+
'type' => 'checkbox',
481+
'description' => __( 'If supported, <code>X-Accel-Redirect / X-Sendfile</code> can be used to serve downloads instead of PHP (server requires mod_xsendfile) Attention! Enabling this option will disable the XHR functionality!', 'dlm-advanced-settings' ),
482+
),
483+
'dlm_timestamp_link' => array(
484+
'label' => __( 'Show a timestamp in the download link', 'dlm-advanced-settings' ),
485+
'default' => '1',
486+
'params' => 1,
487+
'type' => 'checkbox',
488+
'description' => __( 'If enabled, the download URL will have a timestamp attached as a parameter. This serves as a cache preventing solution for plugins that cache the URL.', 'dlm-advanced-settings' ),
489+
),
490+
'dlm_enable_reports' => array(
491+
'label' => __( 'Enable reports', 'dlm-advanced-settings' ),
492+
'default' => '1',
493+
'params' => 1,
494+
'type' => 'checkbox',
495+
'description' => __( 'Enable or disable the Reports functionality. This will also enable/disable logging detailed info into the Logs Table of the Database. Disabling this will not disable the download count funtionality.', 'dlm-advanced-settings' ),
496+
),
497+
'dlm_hide_meta_version' => array(
498+
'label' => __( 'Hide meta version in header', 'dlm-advanced-settings' ),
499+
'default' => '0',
500+
'params' => 1,
501+
'type' => 'checkbox',
502+
'description' => __( 'Hide or show Download Monitor\'s version in the HTML\'s head.', 'dlm-advanced-settings' ),
503+
),
504+
'dlm_count_meta_downloads' => array(
505+
'label' => __( 'Add meta value to download count', 'dlm-advanced-settings' ),
506+
'default' => '1',
507+
'params' => 1,
508+
'type' => 'checkbox',
509+
'description' => __( 'Add the manual download count ( the one set when editing a Download ) to the total download count of a Download', 'dlm-advanced-settings' ),
510+
),
511+
'dlm_do_xhr' => array(
512+
'label' => __( 'XHR downloads', 'dlm-advanced-settings' ),
513+
'default' => '1',
514+
'params' => 1,
515+
'type' => 'checkbox',
516+
'description' => __( 'Enable or disable downloading files using the newly XHR functionality. Disabling this may cause the reports to not be so pricise.', 'dlm-advanced-settings' ),
517+
),
518+
'dlm_restricted_file_types' => array(
519+
'label' => __( 'Restricted file types', 'dlm-advanced-settings' ),
520+
'default' => '',
521+
'params' => 2,
522+
'type' => 'text',
523+
'description' => __( 'Define extra file types that should be restricted. Each file type needs to be separated by a comma (<code>,</code>). Only input the extension( ex.: txt, pdf ).', 'dlm-advanced-settings' ),
524+
),
525+
'dlm_404_redirect' => array(
526+
'label' => __( '404 redirect URL', 'dlm-advanced-settings' ),
527+
'default' => '',
528+
'params' => 1,
529+
'type' => 'text',
530+
'description' => __( 'Define a custom 404 redirect for when a Download can\'t be found.', 'dlm-advanced-settings' ),
531+
),
532+
'dlm_placeholder_image_src' => array(
533+
'label' => __( 'Placeholder image src', 'dlm-advanced-settings' ),
534+
'default' => download_monitor()->get_plugin_url() . '/assets/images/placeholder.png',
535+
'params' => 1,
536+
'type' => 'text',
537+
'description' => __( 'Define a custom URL for the Download CPT placeholder.', 'dlm-advanced-settings' ),
538+
),
539+
'dlm_reports_server_limits' => array(
540+
'label' => __( 'Reports server limits', 'dlm-advanced-settings' ),
541+
'default' => $this->php_info,
542+
'params' => 1,
543+
'type' => 'multi_text',
544+
'description' => __( 'Define other servet limits. Usefull when you have any problems with the Reports not being displayed a possible problem might be your server\'s lack of resources. This way you can control how much data is retrieved in one request.', 'dlm-advanced-settings' ),
545+
),
546+
'dlm_xhr_progress' => array(
547+
'label' => __( 'XHR progress animation', 'dlm-advanced-settings' ),
548+
'default' => array(
549+
'display' => true,
550+
'animation' => includes_url( '/images/spinner.gif' ),
551+
),
552+
'params' => 1,
553+
'type' => 'multi_text',
554+
'description' => __( 'Define whether to display the XHR progress or not. Also, define a custom URL for the loading animation.', 'dlm-advanced-settings' ),
555+
),
556+
);
557+
558+
$defaults = array();
559+
foreach ( $this->hooks as $key => $setting ) {
560+
$defaults[ $key ] = $setting['default'];
561+
}
562+
563+
$this->settings = wp_parse_args( get_option( 'dlm-as-settings', array() ), $defaults );
564+
}
557565
}
558566

559567
add_action( 'plugins_loaded', array( 'DLM_Advanced_Settings', 'get_instance' ) );

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "dlm-advanced-settings",
33
"title": "Download Monitor - Advanced Settings",
4-
"version": "1.0.3",
4+
"version": "1.0.4",
55
"homepage": "",
66
"main": "Gruntfile.js",
77
"devDependencies": {

readme.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
=== DLM - Advanced Settings ===
22
Contributors: raldea89
3-
Tags: download monitor, filters, hooks, advanced settings
3+
Tags: download monitor, filters, hooks, advanced settings, download monitor filters
44
Requires at least: 5.4
5-
Tested up to: 6.7
6-
Stable tag: 1.0.3
5+
Tested up to: 6.8
6+
Stable tag: 1.0.4
77
License: GPLv3
88
Text Domain: dlm-advanced-settings
99
Requires PHP: 7.4
@@ -53,6 +53,9 @@ The manual installation method involves downloading the plugin and uploading it
5353
* Activate the plugin from the Plugins menu within the WordPress admin.
5454

5555
== Changelog ==
56+
= 1.0.4 - 10.07.2025 =
57+
* Fixed: Text domain load error
58+
5659
= 1.0.3 - 03.02.2025 =
5760
* Added: Option to remove upsells
5861

0 commit comments

Comments
 (0)