Download Monitor - Version 1.6.2

Version Description

  • Fixed a bug that caused translations not to load.
  • Fixed a bug that prevented download versions from being removed.
  • Fixed a pagination in 'insert download' shortcode bug.
  • Fixed a bug in the template loader when used with a custom directory, a slug and no custom template.
  • Removed assigning by reference, fixed strict notice while delete downloads.
  • Tweaked template loader to accept arguments.
  • Allow downloads shortcode WP_Query arguments to be filtered with 'dlm_shortcode_downloads_args'.
Download this release

Release Info

Developer barrykooij
Plugin Icon 128x128 Download Monitor
Version 1.6.2
Comparing to
See all releases

Code changes from version 1.6.1 to 1.6.2

download-monitor.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Download Monitor
4
  Plugin URI: https://www.download-monitor.com
5
  Description: A full solution for managing downloadable files, monitoring downloads and outputting download links and file information on your WordPress powered site.
6
- Version: 1.6.1
7
  Author: Barry Kooij & Mike Jolley
8
  Author URI: http://www.download-monitor.com
9
  Requires at least: 3.8
@@ -33,7 +33,7 @@ if ( ! defined( 'ABSPATH' ) ) {
33
  function __download_monitor_main() {
34
 
35
  // Define DLM Version
36
- define( 'DLM_VERSION', '1.6.1' );
37
 
38
  // Define DLM FILE
39
  define( 'DLM_PLUGIN_FILE', __FILE__ );
3
  Plugin Name: Download Monitor
4
  Plugin URI: https://www.download-monitor.com
5
  Description: A full solution for managing downloadable files, monitoring downloads and outputting download links and file information on your WordPress powered site.
6
+ Version: 1.6.2
7
  Author: Barry Kooij & Mike Jolley
8
  Author URI: http://www.download-monitor.com
9
  Requires at least: 3.8
33
  function __download_monitor_main() {
34
 
35
  // Define DLM Version
36
+ define( 'DLM_VERSION', '1.6.2' );
37
 
38
  // Define DLM FILE
39
  define( 'DLM_PLUGIN_FILE', __FILE__ );
includes/admin/class-dlm-admin-cpt.php CHANGED
@@ -119,11 +119,10 @@ class DLM_Admin_CPT {
119
 
120
  switch ( $post_type ) {
121
  case 'dlm_download' :
122
- if ( $versions =& get_children( 'post_parent=' . $id . '&post_type=dlm_download_version' ) ) {
123
- if ( $versions ) {
124
- foreach ( $versions as $child ) {
125
- wp_delete_post( $child->ID, true );
126
- }
127
  }
128
  }
129
  break;
119
 
120
  switch ( $post_type ) {
121
  case 'dlm_download' :
122
+ $versions = get_children( 'post_parent=' . $id . '&post_type=dlm_download_version' );
123
+ if ( is_array( $versions ) && count( $versions ) > 0 ) {
124
+ foreach ( $versions as $child ) {
125
+ wp_delete_post( $child->ID, true );
 
126
  }
127
  }
128
  break;
includes/admin/class-dlm-admin-media-insert.php CHANGED
@@ -170,8 +170,9 @@ class DLM_Admin_Media_Insert {
170
  }
171
 
172
  if ( $dlm_query->max_num_pages > 1 ) {
 
173
  echo paginate_links( apply_filters( 'download_monitor_pagination_args', array(
174
- 'base' => str_replace( 999999999, '%#%', get_pagenum_link( 999999999 ) ),
175
  'format' => '',
176
  'current' => $page,
177
  'total' => $dlm_query->max_num_pages,
170
  }
171
 
172
  if ( $dlm_query->max_num_pages > 1 ) {
173
+
174
  echo paginate_links( apply_filters( 'download_monitor_pagination_args', array(
175
+ 'base' => str_replace( 999999999, '%#%', get_pagenum_link( 999999999, false ) ),
176
  'format' => '',
177
  'current' => $page,
178
  'total' => $dlm_query->max_num_pages,
includes/admin/class-dlm-admin-writepanels.php CHANGED
@@ -103,7 +103,7 @@ class DLM_Admin_Writepanels {
103
  <input type="hidden" name="dlm_post_id" id="dlm-post-id" value="<?php echo $post->ID; ?>" />
104
  <input type="hidden" name="dlm_post_id" id="dlm-plugin-url" value="<?php echo WP_DLM::get_plugin_url(); ?>" />
105
  <input type="hidden" name="dlm_post_id" id="dlm-ajax-nonce-add-file" value="<?php echo wp_create_nonce( "add-file" ); ?>" />
106
- <input type="hidden" name="dlm_post_id" id="dlm-ajax-nonce-remove-file" value="<?php wp_create_nonce( "remove-file" ); ?>" />
107
 
108
  <?php do_action( 'dlm_download_monitor_files_writepanel_start' ); ?>
109
 
103
  <input type="hidden" name="dlm_post_id" id="dlm-post-id" value="<?php echo $post->ID; ?>" />
104
  <input type="hidden" name="dlm_post_id" id="dlm-plugin-url" value="<?php echo WP_DLM::get_plugin_url(); ?>" />
105
  <input type="hidden" name="dlm_post_id" id="dlm-ajax-nonce-add-file" value="<?php echo wp_create_nonce( "add-file" ); ?>" />
106
+ <input type="hidden" name="dlm_post_id" id="dlm-ajax-nonce-remove-file" value="<?php echo wp_create_nonce( "remove-file" ); ?>" />
107
 
108
  <?php do_action( 'dlm_download_monitor_files_writepanel_start' ); ?>
109
 
includes/class-dlm-download.php CHANGED
@@ -58,7 +58,8 @@ class DLM_Download {
58
  } elseif ( 'redirect_only' == $key ) {
59
  $value = ( $value = get_post_meta( $this->id, '_redirect_only', true ) ) ? $value : 'no';
60
  } else {
61
- $value = get_post_meta( $this->id, '_' . $key, true );
 
62
  }
63
 
64
  return $value;
@@ -488,7 +489,7 @@ class DLM_Download {
488
  * get_file_version_ids function.
489
  *
490
  * @access public
491
- * @return void
492
  */
493
  function get_file_version_ids() {
494
  if ( ! is_array( $this->file_version_ids ) ) {
58
  } elseif ( 'redirect_only' == $key ) {
59
  $value = ( $value = get_post_meta( $this->id, '_redirect_only', true ) ) ? $value : 'no';
60
  } else {
61
+ $key = ( ( strpos( $key, '_' ) !== 0 ) ? '_' . $key : $key );
62
+ $value = get_post_meta( $this->id, $key, true );
63
  }
64
 
65
  return $value;
489
  * get_file_version_ids function.
490
  *
491
  * @access public
492
+ * @return array
493
  */
494
  function get_file_version_ids() {
495
  if ( ! is_array( $this->file_version_ids ) ) {
includes/class-dlm-shortcodes.php CHANGED
@@ -342,6 +342,9 @@ class DLM_Shortcodes {
342
 
343
  ob_start();
344
 
 
 
 
345
  $downloads = new WP_Query( $args );
346
  $dlm_max_num_pages = $downloads->max_num_pages;
347
 
342
 
343
  ob_start();
344
 
345
+ // Allow filtering of arguments
346
+ $args = apply_filters( 'dlm_shortcode_downloads_args', $args );
347
+
348
  $downloads = new WP_Query( $args );
349
  $dlm_max_num_pages = $downloads->max_num_pages;
350
 
includes/class-dlm-template-handler.php CHANGED
@@ -9,8 +9,6 @@ class DLM_Template_Handler {
9
  /**
10
  * get_template_part method.
11
  *
12
- * @todo move this to own template loader
13
- *
14
  * @access public
15
  *
16
  * @param string $slug
@@ -19,7 +17,7 @@ class DLM_Template_Handler {
19
  *
20
  * @return void
21
  */
22
- public function get_template_part( $slug, $name = '', $custom_dir = '' ) {
23
  $template = '';
24
 
25
  // The plugin path
@@ -46,7 +44,7 @@ class DLM_Template_Handler {
46
  }
47
 
48
  // If a custom path was defined, check that next
49
- if ( ! $template && $custom_dir && file_exists( trailingslashit( $custom_dir ) . "{$slug}-{$name}.php" ) ) {
50
  $template = trailingslashit( $custom_dir ) . "{$slug}.php";
51
  }
52
 
@@ -60,7 +58,18 @@ class DLM_Template_Handler {
60
 
61
  // Load template if we've found one
62
  if ( $template ) {
63
- load_template( $template, false );
 
 
 
 
 
 
 
 
 
 
 
64
  }
65
  }
66
 
9
  /**
10
  * get_template_part method.
11
  *
 
 
12
  * @access public
13
  *
14
  * @param string $slug
17
  *
18
  * @return void
19
  */
20
+ public function get_template_part( $slug, $name = '', $custom_dir = '', $args = array() ) {
21
  $template = '';
22
 
23
  // The plugin path
44
  }
45
 
46
  // If a custom path was defined, check that next
47
+ if ( ! $template && $custom_dir && file_exists( trailingslashit( $custom_dir ) . "{$slug}.php" ) ) {
48
  $template = trailingslashit( $custom_dir ) . "{$slug}.php";
49
  }
50
 
58
 
59
  // Load template if we've found one
60
  if ( $template ) {
61
+
62
+ // Extract args if there are any
63
+ if ( is_array( $args ) && count( $args ) > 0 ) {
64
+ extract( $args );
65
+ }
66
+
67
+ do_action( 'dlm_before_template_part', $template, $slug, $name, $custom_dir, $args );
68
+
69
+ include( $template );
70
+
71
+ do_action( 'dlm_after_template_part', $template, $slug, $name, $custom_dir, $args );
72
+ //load_template( $template, false );
73
  }
74
  }
75
 
includes/class-wp-dlm.php CHANGED
@@ -66,7 +66,7 @@ class WP_DLM {
66
 
67
  // Load plugin text domain
68
  load_textdomain( 'download-monitor', WP_LANG_DIR . '/download-monitor/download_monitor-' . get_locale() . '.mo' );
69
- load_plugin_textdomain( 'download-monitor', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
70
 
71
  // Table for logs
72
  $wpdb->download_log = $wpdb->prefix . 'download_log';
66
 
67
  // Load plugin text domain
68
  load_textdomain( 'download-monitor', WP_LANG_DIR . '/download-monitor/download_monitor-' . get_locale() . '.mo' );
69
+ load_plugin_textdomain( 'download-monitor', false, dirname( plugin_basename( DLM_PLUGIN_FILE ) ) . '/languages' );
70
 
71
  // Table for logs
72
  $wpdb->download_log = $wpdb->prefix . 'download_log';
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=barry@ca
4
  Tags: download, downloads, monitor, hits, download monitor, tracking, admin, count, counter, files, versions, download count, logging
5
  Requires at least: 3.8
6
  Tested up to: 4.1
7
- Stable tag: 1.6.1
8
  License: GPLv3
9
 
10
  Download Monitor is a plugin for uploading and managing downloads, tracking downloads, and displaying links.
@@ -110,6 +110,15 @@ Admin hits are not counted, log out and try!
110
 
111
  == Changelog ==
112
 
 
 
 
 
 
 
 
 
 
113
  = 1.6.1 =
114
  * Fixed an extension activation error.
115
  * Fixed a bug that caused the featured image to disappear in some themes.
@@ -124,7 +133,7 @@ Admin hits are not counted, log out and try!
124
  * Removed $GLOBALS['dlm_logging'] global.
125
  * Removed $GLOBALS['DLM_Download_Handler'] global.
126
  * Removed internal use of $download_monitor global.
127
- # Moved all inline JavaScript to separate JavaScript files.
128
  * Moved all install related code to installer class.
129
  * Moved main plugin class to it's own file.
130
  * Deprecated 'dlm_create_log' function.
4
  Tags: download, downloads, monitor, hits, download monitor, tracking, admin, count, counter, files, versions, download count, logging
5
  Requires at least: 3.8
6
  Tested up to: 4.1
7
+ Stable tag: 1.6.2
8
  License: GPLv3
9
 
10
  Download Monitor is a plugin for uploading and managing downloads, tracking downloads, and displaying links.
110
 
111
  == Changelog ==
112
 
113
+ = 1.6.2 =
114
+ * Fixed a bug that caused translations not to load.
115
+ * Fixed a bug that prevented download versions from being removed.
116
+ * Fixed a pagination in 'insert download' shortcode bug.
117
+ * Fixed a bug in the template loader when used with a custom directory, a slug and no custom template.
118
+ * Removed assigning by reference, fixed strict notice while delete downloads.
119
+ * Tweaked template loader to accept arguments.
120
+ * Allow downloads shortcode WP_Query arguments to be filtered with 'dlm_shortcode_downloads_args'.
121
+
122
  = 1.6.1 =
123
  * Fixed an extension activation error.
124
  * Fixed a bug that caused the featured image to disappear in some themes.
133
  * Removed $GLOBALS['dlm_logging'] global.
134
  * Removed $GLOBALS['DLM_Download_Handler'] global.
135
  * Removed internal use of $download_monitor global.
136
+ * Moved all inline JavaScript to separate JavaScript files.
137
  * Moved all install related code to installer class.
138
  * Moved main plugin class to it's own file.
139
  * Deprecated 'dlm_create_log' function.