Version Description
Download this release
Release Info
Developer | barrykooij |
Plugin | Download Monitor |
Version | 4.0.2 |
Comparing to | |
See all releases |
Code changes from version 4.0.1 to 4.0.2
- download-monitor.php +3 -3
- readme.txt +8 -3
- src/DownloadHandler.php +22 -10
- src/Logs/LogItem.php +35 -1
download-monitor.php
CHANGED
@@ -3,11 +3,11 @@
|
|
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: 4.0.
|
7 |
Author: Never5
|
8 |
Author URI: https://www.never5.com
|
9 |
Requires at least: 3.8
|
10 |
-
Tested up to: 4.9.
|
11 |
Text Domain: download-monitor
|
12 |
|
13 |
License: GPL v3
|
@@ -33,7 +33,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
33 |
} // Exit if accessed directly
|
34 |
|
35 |
// Define DLM Version
|
36 |
-
define( 'DLM_VERSION', '4.0.
|
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: 4.0.2
|
7 |
Author: Never5
|
8 |
Author URI: https://www.never5.com
|
9 |
Requires at least: 3.8
|
10 |
+
Tested up to: 4.9.3
|
11 |
Text Domain: download-monitor
|
12 |
|
13 |
License: GPL v3
|
33 |
} // Exit if accessed directly
|
34 |
|
35 |
// Define DLM Version
|
36 |
+
define( 'DLM_VERSION', '4.0.2' );
|
37 |
|
38 |
// Define DLM FILE
|
39 |
define( 'DLM_PLUGIN_FILE', __FILE__ );
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: never5, barrykooij, mikejolley, hchouhan
|
|
3 |
Donate link: http://www.barrykooij.com/donate/
|
4 |
Tags: download, downloads, monitor, hits, download monitor, tracking, admin, count, counter, files, versions, download count, logging, AJAX, digital, documents, download category, download manager, download template, downloadmanager, file manager, file tree, grid, hits, ip-address, manager, media, monitor, password, protect downloads, tracker
|
5 |
Requires at least: 3.8
|
6 |
-
Tested up to: 4.9.
|
7 |
-
Stable tag: 4.0.
|
8 |
License: GPLv3
|
9 |
Text Domain: -
|
10 |
|
@@ -111,10 +111,15 @@ More documentation can be found in our [Knowledge Base](https://www.download-mon
|
|
111 |
1. The main admin screen lists your downloads using familiar WordPress UI.
|
112 |
2. Easily add file information and multiple versions.
|
113 |
3. The quick add panel can be opened via a link about the post editor. This lets you quickly add a file and insert it into a post.
|
114 |
-
4. Display regular download links or fancy ones all using shortcodes and templates.
|
115 |
|
116 |
== Changelog ==
|
117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
= 4.0.1: January 25, 2018 =
|
119 |
* Tweak: Fixed an issue that caused widget limit to not work.
|
120 |
* Tweak: Fixed an count() warning in PHP7.2 on extension page.
|
3 |
Donate link: http://www.barrykooij.com/donate/
|
4 |
Tags: download, downloads, monitor, hits, download monitor, tracking, admin, count, counter, files, versions, download count, logging, AJAX, digital, documents, download category, download manager, download template, downloadmanager, file manager, file tree, grid, hits, ip-address, manager, media, monitor, password, protect downloads, tracker
|
5 |
Requires at least: 3.8
|
6 |
+
Tested up to: 4.9.3
|
7 |
+
Stable tag: 4.0.2
|
8 |
License: GPLv3
|
9 |
Text Domain: -
|
10 |
|
111 |
1. The main admin screen lists your downloads using familiar WordPress UI.
|
112 |
2. Easily add file information and multiple versions.
|
113 |
3. The quick add panel can be opened via a link about the post editor. This lets you quickly add a file and insert it into a post.
|
|
|
114 |
|
115 |
== Changelog ==
|
116 |
|
117 |
+
= 4.0.2: February 2, 2018 =
|
118 |
+
* Tweak: Moved no cache headers up in download process, improving cache prevention.
|
119 |
+
* Tweak: Added new log item meta data methods, making it easier to add meta data.
|
120 |
+
* Tweak: Added new action 'dlm_downloading_log_item_added'. Is triggered after log item is added on download request.
|
121 |
+
* Tweak: Added $download and $version arguments to 'dlm_log_item' filter.
|
122 |
+
|
123 |
= 4.0.1: January 25, 2018 =
|
124 |
* Tweak: Fixed an issue that caused widget limit to not work.
|
125 |
* Tweak: Fixed an count() warning in PHP7.2 on extension page.
|
src/DownloadHandler.php
CHANGED
@@ -365,10 +365,13 @@ class DLM_Download_Handler {
|
|
365 |
$log_item->set_download_status_message( $message );
|
366 |
|
367 |
// allow filtering of log item
|
368 |
-
$log_item = apply_filters( 'dlm_log_item', $log_item );
|
369 |
|
370 |
// persist log item
|
371 |
download_monitor()->service( 'log_item_repository' )->persist( $log_item );
|
|
|
|
|
|
|
372 |
}
|
373 |
|
374 |
}
|
@@ -386,6 +389,9 @@ class DLM_Download_Handler {
|
|
386 |
*/
|
387 |
private function trigger( $download ) {
|
388 |
|
|
|
|
|
|
|
389 |
/** @var DLM_Download_Version $version */
|
390 |
$version = $download->get_version();
|
391 |
|
@@ -558,6 +564,21 @@ class DLM_Download_Handler {
|
|
558 |
exit;
|
559 |
}
|
560 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
561 |
/**
|
562 |
* Output download headers
|
563 |
*
|
@@ -566,7 +587,6 @@ class DLM_Download_Handler {
|
|
566 |
* @param DLM_Download_Version $version
|
567 |
*/
|
568 |
private function download_headers( $file_path, $download, $version ) {
|
569 |
-
global $is_IE;
|
570 |
|
571 |
// Get Mime Type
|
572 |
$mime_type = "application/octet-stream";
|
@@ -615,14 +635,6 @@ class DLM_Download_Handler {
|
|
615 |
|
616 |
$headers = array();
|
617 |
|
618 |
-
if ( $is_IE && is_ssl() ) {
|
619 |
-
// IE bug prevents download via SSL when Cache Control and Pragma no-cache headers set.
|
620 |
-
$headers['Expires'] = 'Wed, 11 Jan 1984 05:00:00 GMT';
|
621 |
-
$headers['Cache-Control'] = 'private';
|
622 |
-
} else {
|
623 |
-
nocache_headers();
|
624 |
-
}
|
625 |
-
|
626 |
$headers['X-Robots-Tag'] = 'noindex, nofollow';
|
627 |
$headers['Content-Type'] = $mime_type;
|
628 |
$headers['Content-Description'] = 'File Transfer';
|
365 |
$log_item->set_download_status_message( $message );
|
366 |
|
367 |
// allow filtering of log item
|
368 |
+
$log_item = apply_filters( 'dlm_log_item', $log_item, $download, $version );
|
369 |
|
370 |
// persist log item
|
371 |
download_monitor()->service( 'log_item_repository' )->persist( $log_item );
|
372 |
+
|
373 |
+
// trigger action when new log item was added for a download request
|
374 |
+
do_action( 'dlm_downloading_log_item_added', $log_item, $download, $version );
|
375 |
}
|
376 |
|
377 |
}
|
389 |
*/
|
390 |
private function trigger( $download ) {
|
391 |
|
392 |
+
// Download is triggered. First thing we do, send no cache headers.
|
393 |
+
$this->cache_headers();
|
394 |
+
|
395 |
/** @var DLM_Download_Version $version */
|
396 |
$version = $download->get_version();
|
397 |
|
564 |
exit;
|
565 |
}
|
566 |
|
567 |
+
/**
|
568 |
+
* Send cache headers to browser. No cache pelase.
|
569 |
+
*/
|
570 |
+
private function cache_headers() {
|
571 |
+
global $is_IE;
|
572 |
+
|
573 |
+
if ( $is_IE && is_ssl() ) {
|
574 |
+
// IE bug prevents download via SSL when Cache Control and Pragma no-cache headers set.
|
575 |
+
header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
|
576 |
+
header( 'Cache-Control: private' );
|
577 |
+
} else {
|
578 |
+
nocache_headers();
|
579 |
+
}
|
580 |
+
}
|
581 |
+
|
582 |
/**
|
583 |
* Output download headers
|
584 |
*
|
587 |
* @param DLM_Download_Version $version
|
588 |
*/
|
589 |
private function download_headers( $file_path, $download, $version ) {
|
|
|
590 |
|
591 |
// Get Mime Type
|
592 |
$mime_type = "application/octet-stream";
|
635 |
|
636 |
$headers = array();
|
637 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
638 |
$headers['X-Robots-Tag'] = 'noindex, nofollow';
|
639 |
$headers['Content-Type'] = $mime_type;
|
640 |
$headers['Content-Description'] = 'File Transfer';
|
src/Logs/LogItem.php
CHANGED
@@ -33,7 +33,7 @@ class DLM_Log_Item {
|
|
33 |
private $download_status_message;
|
34 |
|
35 |
/** @var array */
|
36 |
-
private $meta_data;
|
37 |
|
38 |
/**
|
39 |
* @return int
|
@@ -189,4 +189,38 @@ class DLM_Log_Item {
|
|
189 |
$this->meta_data = $meta_data;
|
190 |
}
|
191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
}
|
33 |
private $download_status_message;
|
34 |
|
35 |
/** @var array */
|
36 |
+
private $meta_data = array();
|
37 |
|
38 |
/**
|
39 |
* @return int
|
189 |
$this->meta_data = $meta_data;
|
190 |
}
|
191 |
|
192 |
+
/**
|
193 |
+
* @param string $key
|
194 |
+
* @param string $value
|
195 |
+
*/
|
196 |
+
public function add_meta_data_item( $key, $value ) {
|
197 |
+
|
198 |
+
// get meta
|
199 |
+
$meta = $this->get_meta_data();
|
200 |
+
|
201 |
+
// just to be sure we have an array
|
202 |
+
if ( ! is_array( $meta ) ) {
|
203 |
+
$meta = array();
|
204 |
+
}
|
205 |
+
|
206 |
+
// set new meta. We're not checking if it exists, this means we override by default. Check in your code if exists before adding!
|
207 |
+
$meta[ $key ] = $value;
|
208 |
+
|
209 |
+
// set meta
|
210 |
+
$this->set_meta_data( $meta );
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* Checks if meta data exists for given key
|
215 |
+
*
|
216 |
+
* @param $key
|
217 |
+
*
|
218 |
+
* @return bool
|
219 |
+
*/
|
220 |
+
public function meta_data_exist( $key ) {
|
221 |
+
$meta = $this->get_meta_data();
|
222 |
+
|
223 |
+
return ( is_array( $meta ) && isset( $meta[ $key ] ) );
|
224 |
+
}
|
225 |
+
|
226 |
}
|