WordPress Download Manager - Version 3.1.17

Version Description

  • 2021.04.08 =
  • Adjusted shortcode column, removed the popup trigger button and reinstated the preview text field showing the shortcode
Download this release

Release Info

Developer codename065
Plugin Icon 128x128 WordPress Download Manager
Version 3.1.17
Comparing to
See all releases

Code changes from version 3.1.14 to 3.1.17

admin/menus/class.Packages.php CHANGED
@@ -4,6 +4,8 @@
4
  namespace WPDM\admin\menus;
5
 
6
 
 
 
7
  class Packages
8
  {
9
 
@@ -25,6 +27,8 @@ class Packages
25
 
26
  add_action('admin_footer', array($this, 'footerScripts'));
27
 
 
 
28
 
29
  }
30
 
@@ -66,7 +70,7 @@ class Packages
66
  if (isset($_POST['reset_key']) && $_POST['reset_key'] == 1)
67
  update_post_meta($post, '__wpdm_masterkey', uniqid());
68
 
69
- if(isset($_REQUEST['reset_udl'])) delete_post_meta($post, '__wpdmx_user_download_count');
70
  //do_action('after_update_package',$post, $_POST['file']);
71
 
72
 
@@ -143,7 +147,7 @@ class Packages
143
  $img['image'] = "<span class='wpdm-th-icon ttip' style='font-size: 0.8em'><i style='font-size: 80%' class='fa fa-image'></i></span>";
144
  wpdm_array_splice_assoc( $defaults, 1, 0, $img );
145
  $otf['download_count'] = "<span class='wpdm-th-icon ttip' style='font-size: 0.8em'><i style='font-size: 80%' class='fa fa-download'></i></span>";
146
- $otf['wpdmshortcode'] = 'Short-code';
147
  wpdm_array_splice_assoc( $defaults, 3, 0, $otf );
148
  return $defaults;
149
  }
@@ -156,9 +160,10 @@ class Packages
156
  echo (int)get_post_meta($post_ID, '__wpdm_download_count', true);
157
 
158
  }
159
- if ($column_name == 'wpdmshortcode') {
160
 
161
- echo "<input readonly=readonly class='wpdm-scode' onclick='this.select();' value=\"[wpdm_package id='$post_ID']\" />";
 
162
 
163
  }
164
  if ($column_name == 'image') {
@@ -199,8 +204,10 @@ class Packages
199
 
200
  function rowActions($actions, $post)
201
  {
202
- if($post->post_type == 'wpdmpro')
203
- $actions['download_link'] = '<a title="'.__('Direct Download','download-manager').'" href="'.\WPDM\Package::getMasterDownloadURL($post->ID).'" class="view_stats"><i class="fa fa-download text-success"></i></a>';
 
 
204
 
205
  return $actions;
206
  }
@@ -213,7 +220,76 @@ class Packages
213
 
214
  function footerScripts(){
215
  global $pagenow;
216
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
217
  if($pagenow === 'themes.php' || $pagenow === 'theme-install.php'){
218
  if(!file_exists(ABSPATH.'/wp-content/themes/attire/')) {
219
  ?>
@@ -229,7 +305,14 @@ class Packages
229
  }
230
 
231
 
232
-
 
 
 
 
 
 
 
233
 
234
 
235
  }
4
  namespace WPDM\admin\menus;
5
 
6
 
7
+ use WPDM\Package;
8
+
9
  class Packages
10
  {
11
 
27
 
28
  add_action('admin_footer', array($this, 'footerScripts'));
29
 
30
+ add_action("admin_init", [$this, 'duplicate']);
31
+
32
 
33
  }
34
 
70
  if (isset($_POST['reset_key']) && $_POST['reset_key'] == 1)
71
  update_post_meta($post, '__wpdm_masterkey', uniqid());
72
 
73
+ if(isset($_REQUEST['reset_udl'])) WPDM()->downloadHistory->resetUserDownloadCount($post, 'all');
74
  //do_action('after_update_package',$post, $_POST['file']);
75
 
76
 
147
  $img['image'] = "<span class='wpdm-th-icon ttip' style='font-size: 0.8em'><i style='font-size: 80%' class='fa fa-image'></i></span>";
148
  wpdm_array_splice_assoc( $defaults, 1, 0, $img );
149
  $otf['download_count'] = "<span class='wpdm-th-icon ttip' style='font-size: 0.8em'><i style='font-size: 80%' class='fa fa-download'></i></span>";
150
+ $otf['wpdmembed'] = esc_attr__( 'Shortcode', 'download-manager' );
151
  wpdm_array_splice_assoc( $defaults, 3, 0, $otf );
152
  return $defaults;
153
  }
160
  echo (int)get_post_meta($post_ID, '__wpdm_download_count', true);
161
 
162
  }
163
+ if ($column_name == 'wpdmembed') {
164
 
165
+ echo "<div class='w3eden'><div class='input-group short-code-wpdm'><input readonly=readonly class='form-control bg-white' onclick='this.select();' value=\"[wpdm_package id='$post_ID']\" id='sci{$post_ID}' /><div class='input-group-btn'><button type='button' onclick=\"WPDM.copy('sci{$post_ID}')\" class='btn btn-secondary'><i class='fa fa-copy'></i></button></div></div></div>";
166
+ //echo "<div class='w3eden'><button type='button' href='#' data-toggle='modal' data-target='#embModal' data-pid='{$post_ID}' class='btn btn-secondary btn-embed'><i class='fa fa-bars'></i></button></div>";
167
 
168
  }
169
  if ($column_name == 'image') {
204
 
205
  function rowActions($actions, $post)
206
  {
207
+ if($post->post_type == 'wpdmpro') {
208
+ $actions['duplicate'] = '<a title="' . __( "Duplicate" , "download-manager" ) . '" href="' . admin_url("/?wpdm_duplicate={$post->ID}") . '" class="wpdm_duplicate w3eden">'.esc_attr__( 'Duplicate', 'download-manager' ).'</a>';
209
+ $actions['download_link'] = '<a title="' . __('Direct Download', 'download-manager') . '" href="' . \WPDM\Package::getMasterDownloadURL($post->ID) . '" class="view_stats"><i class="fa fa-download text-success"></i></a>';
210
+ }
211
 
212
  return $actions;
213
  }
220
 
221
  function footerScripts(){
222
  global $pagenow;
223
+ ?>
224
+ <div class="w3eden">
225
+ <div class="modal fade" tabindex="-1" role="dialog" id="embModal" style="display: none">
226
+ <div class="modal-dialog" role="document">
227
+ <div class="modal-content">
228
+
229
+ <div class="modal-header">
230
+ <h4 class="modal-title"><i class="fa fa-paste color-green"></i> <?php _e("Embed Package", "download-manager"); ?></h4>
231
+ </div>
232
+ <div class="modal-body">
233
+
234
+ <div class="input-group input-group-lg">
235
+ <input type="text" value="[wpdm_package id='{{ID}}']" id="cpsc" readonly="readonly" class="form-control bg-white" style="font-family: monospace;font-weight: bold;text-align: center">
236
+ <div class="input-group-btn">
237
+ <button style="padding-left: 30px;padding-right: 30px" onclick="WPDM.copy('cpsc');" type="button" class="btn btn-secondary"><i class="fa fa-copy"></i> <?=esc_attr__( 'Copy', 'download-manager' );?></button>
238
+ </div>
239
+ </div>
240
+ <div class="alert alert-info" style="margin-top: 20px">
241
+ <?=esc_attr__( 'If you are on Gutenberg Editor or elementor, you may use gutenberg block or elementor add-on for wpdm to embed wpdm packages and categories or generate another available layouts', 'download-manager' ); ?>
242
+ </div>
243
+
244
+ <div class="panel panel-default card-plain">
245
+ <div class="panel-heading">
246
+ <?=esc_attr__( 'Go To Page', 'download-manager' );?>
247
+ </div>
248
+ <div class="panel-body">
249
+ <div class="row">
250
+ <div class="col-md-9"><?php wp_dropdown_pages(['class' => 'form-control wpdm-custom-select', 'id' => 'gotopg']); ?></div>
251
+ <div class="col-md-3"><button onclick="location.href='post.php?action=edit&post='+jQuery('#gotopg').val()" type="button" class="btn btn-secondary btn-block"><?=esc_attr__( 'Go', 'download-manager' ); ?></button></div>
252
+ </div>
253
+
254
+ </div>
255
+ <div class="panel-footer bg-white">
256
+ <a href="post-new.php?post_type=page"><?=esc_attr__( 'Create new page', 'download-manager' );?></a>
257
+ </div>
258
+ </div>
259
+
260
+
261
+ <?php if(!defined('__WPDM_GB__')) { ?>
262
+ <a class="btn btn-block btn-secondary thickbox open-plugin-details-modal" href="<?=admin_url('/plugin-install.php?tab=plugin-information&plugin=wpdm-gutenberg-blocks&TB_iframe=true&width=600&height=550')?>"><?=esc_attr__( 'Install Gutenberg Blocks by WordPress Download Manager', 'download-manager' );?></a>
263
+ <?php } ?>
264
+ <?php if(!defined('__WPDM_ELEMENTOR__')) { ?>
265
+ <a class="btn btn-block btn-secondary thickbox open-plugin-details-modal" style="margin-top: 10px" href="<?=admin_url('/plugin-install.php?tab=plugin-information&plugin=wpdm-elementor&TB_iframe=true&width=600&height=550')?>"><?=esc_attr__( 'Install Download Manager Addons for Elementor', 'download-manager' );?></a>
266
+ <?php } ?>
267
+ <?php if(!function_exists('LiveForms')) { ?>
268
+ <a class="btn btn-block btn-info thickbox open-plugin-details-modal" style="margin-top: 10px" href="<?=admin_url('/plugin-install.php?tab=plugin-information&plugin=liveforms&TB_iframe=true&width=600&height=550')?>"><?=esc_attr__( 'Install The Best WordPress Contact Form Builder', 'download-manager' );?></a>
269
+ <?php } ?>
270
+
271
+
272
+
273
+
274
+ </div>
275
+ <div class="modal-footer">
276
+ <button type="button" class="btn btn-secondary" data-dismiss="modal"><?php _e("Close", "download-manager"); ?></button>
277
+ </div>
278
+ </div><!-- /.modal-content -->
279
+ </div><!-- /.modal-dialog -->
280
+ </div><!-- /.modal -->
281
+ </div>
282
+ <script>
283
+ jQuery(function ($){
284
+ $('body').on('click', '.btn-embed', function (){
285
+ var sc = "[wpdm_package id='{{ID}}']";
286
+ sc = sc.replace("{{ID}}", $(this).data('pid'));
287
+ console.log(sc);
288
+ $('#cpsc').val(sc);
289
+ });
290
+ });
291
+ </script>
292
+ <?php
293
  if($pagenow === 'themes.php' || $pagenow === 'theme-install.php'){
294
  if(!file_exists(ABSPATH.'/wp-content/themes/attire/')) {
295
  ?>
305
  }
306
 
307
 
308
+ function duplicate()
309
+ {
310
+ if(wpdm_query_var('wpdm_duplicate', 'int') > 0 && get_post_type(wpdm_query_var('wpdm_duplicate')) === 'wpdmpro') {
311
+ Package::copy(wpdm_query_var('wpdm_duplicate', 'int'));
312
+ wp_redirect("edit.php?post_type=wpdmpro");
313
+ die();
314
+ }
315
+ }
316
 
317
 
318
  }
admin/menus/class.Welcome.php CHANGED
@@ -34,4 +34,4 @@ class Welcome
34
  }
35
  }
36
 
37
- }
34
  }
35
  }
36
 
37
+ }
admin/tpls/welcome.php CHANGED
@@ -238,65 +238,60 @@
238
 
239
  </div>
240
  <?php //if(!function_exists('wpdm_tinymce')){ ?>
241
- <div class="col-md-12 lead text-center">Let's install the following add-ons to make your WordPress Download Manager more awesome<br/></div>
 
 
242
  <div class="col-md-4">
243
  <div class="panel panel-default">
244
- <div style="min-height: 130px;height: 130px;overflow: hidden" class="panel-body">
245
  <div class="media">
246
 
247
  <div class="media-body">
248
- <b><a target="_blank" href="https://www.wpdownloadmanager.com/download/gutenberg-blocks/">Gutenberg Blocks</a></b><br>
249
- <p>Gutenberg Blocks for WordPress Download Manager is the collection of blocks for the new Gutenberg block editor to use various download manager features ...</p>
250
  </div>
251
  </div>
252
  </div>
253
  <div style="line-height: 30px;" class="panel-footer">
254
- <div style="margin-top: -2px" class="pull-right">
255
- <a style="border: 0;border-radius: 2px" href="#" data-target="#addonmodal" data-backdrop="true" rel="15665" data-toggle="modal" class="btn btn-sm btn-primary btn-install"><i class="fa fa-download"></i> &nbsp;Download &amp; Install</a>
256
- </div>
257
- <span style="font-size: 11px;" class="label label-info"><i class="fa fa-th"></i> &nbsp;642.87 KB</span>
258
  </div>
259
  </div>
260
  </div>
261
 
262
- <div class="col-md-4" >
263
  <div class="panel panel-default">
264
- <div style="min-height: 130px;height: 130px;overflow: hidden" class="panel-body">
265
  <div class="media">
266
 
267
  <div class="media-body">
268
- <b><a href="https://www.wpdownloadmanager.com/download/premium-package-complete-digital-store-solution/">Premium Package &ndash; Complete Digital Store Solution</a></b><br>
269
- <p>WordPress Digital Store Solution - Premium Package add-on helps you to setup prices for your digital products and sell it easily from your WordPress site ...</p>
270
  </div>
271
  </div>
272
  </div>
273
  <div style="line-height: 30px;" class="panel-footer">
274
- <div style="margin-top: -2px" class="pull-right">
275
- <a style="border: 0;border-radius: 2px" href="#" data-target="#addonmodal" data-backdrop="true" rel="15671" data-toggle="modal" class="btn btn-sm btn-primary btn-install"><i class="fa fa-download"></i> &nbsp;Download &amp; Install</a>
276
- </div>
277
- <span style="font-size: 11px;" class="label label-info"><i class="fa fa-th"></i> &nbsp;482.11 KB</span>
278
  </div>
279
  </div>
280
  </div>
281
 
282
- <div class="col-md-4">
283
- <div class="panel panel-default">
284
- <div style="min-height: 130px;height: 130px;overflow: hidden" class="panel-body">
285
- <div class="media">
286
- <div class="media-body">
287
- <b><a target="_blank" href="https://www.wpdownloadmanager.com/download/wpdm-extended-short-codes/">WPDM Extended Short-codes</a></b><br>
288
- <p>WPDM Extended Short-codes add-on will give you a better experience in using WordPress Download Manager Pro. We will be adding new short-codes in every update ...</p>
289
- </div>
290
- </div>
291
- </div>
292
- <div style="line-height: 30px;" class="panel-footer">
293
- <div style="margin-top: -2px" class="pull-right">
294
- <a style="border: 0;border-radius: 2px" href="#" data-target="#addonmodal" data-backdrop="true" rel="15691" data-toggle="modal" class="btn btn-sm btn-primary btn-install"><i class="fa fa-download"></i> &nbsp;Download &amp; Install</a>
295
  </div>
296
- <span style="font-size: 11px;" class="label label-info"><i class="fa fa-th"></i> &nbsp;310.17 KB</span>
297
  </div>
298
  </div>
 
 
 
299
  </div>
 
 
300
 
301
 
302
 
@@ -305,27 +300,37 @@
305
 
306
  <?php //} ?>
307
 
308
- <div class="col-md-12">
309
  <div class="well">
310
  <div class="media">
311
  <div class="pull-right">
312
- <a href="https://www.wpdownloadmanager.com/downloads/free-add-ons/" target="_blank" class="btn btn-success">Explore Free Add-ons <i class="fa fa-angle-double-right"></i></a>
313
  </div>
314
  <div class="media-body">
315
  <b>Free Add-ons</b><br/>
316
  There are more free add-ons
317
  </div> </div>
318
  </div>
 
319
 
320
- <div class="alert alert-info" style="margin: 15px 0;font-size: 12pt">
321
- <a href="https://www.wpdownloadmanager.com/download/attire-allinone-wordpress-theme/" target="_blank"><i class="fa fa-gift" style="margin-right: 7px"></i> Attire – Free All-in-one WordPress Theme, Get it now! </a>
 
 
 
 
 
 
 
 
322
  </div>
323
 
324
  </div>
325
 
326
  <div class="col-md-12 lead">
 
327
  <h3>What's New?</h3>
328
- What new with WordPress Download Manager v3.0:
329
  </div>
330
 
331
  <div class="col-md-4 r">
238
 
239
  </div>
240
  <?php //if(!function_exists('wpdm_tinymce')){ ?>
241
+ <div class="col-md-12 lead text-center" style="padding: 20px 0">
242
+ <h3>Recommended Plugins</h3>
243
+ Let's install the following add-ons to make your WordPress Download Manager more awesome<br/></div>
244
  <div class="col-md-4">
245
  <div class="panel panel-default">
246
+ <div class="panel-body">
247
  <div class="media">
248
 
249
  <div class="media-body">
250
+ <b style="display: block;font-size: 15pt;margin-bottom: 10px"><a target="_blank" href="https://www.wpdownloadmanager.com/download/gutenberg-blocks/">Gutenberg Blocks</a></b>
251
+ <p style="font-size: 12pt;margin-bottom: 0">Use gutenberg blocks to embed packages and categories</p>
252
  </div>
253
  </div>
254
  </div>
255
  <div style="line-height: 30px;" class="panel-footer">
256
+ <a href="<?=admin_url('plugin-install.php?tab=plugin-information&plugin=wpdm-gutenberg-blocks&TB_iframe=true&width=600&height=550')?>" class="btn btn-primary btn-block thickbox open-plugin-details-modal">Install</a>
 
 
 
257
  </div>
258
  </div>
259
  </div>
260
 
261
+ <div class="col-md-4">
262
  <div class="panel panel-default">
263
+ <div class="panel-body">
264
  <div class="media">
265
 
266
  <div class="media-body">
267
+ <b style="display: block;font-size: 15pt;margin-bottom: 10px"><a target="_blank" href="https://www.wpdownloadmanager.com/download/premium-package-wordpress-digital-store-solution/">Premium Packages</a></b>
268
+ <p style="font-size: 12pt;margin-bottom: 0">Easy and secure way to sell your digital products.</p>
269
  </div>
270
  </div>
271
  </div>
272
  <div style="line-height: 30px;" class="panel-footer">
273
+ <a href="<?=admin_url('plugin-install.php?tab=plugin-information&plugin=wpdm-premium-packages&TB_iframe=true&width=600&height=550')?>" class="btn btn-primary btn-block thickbox open-plugin-details-modal">Install</a>
 
 
 
274
  </div>
275
  </div>
276
  </div>
277
 
278
+ <div class="col-md-4">
279
+ <div class="panel panel-default">
280
+ <div class="panel-body">
281
+ <div class="media">
282
+
283
+ <div class="media-body">
284
+ <b style="display: block;font-size: 15pt;margin-bottom: 10px"><a target="_blank" href="https://wpliveforms.com">Live Forms - The best form builder</a></b>
285
+ <p style="font-size: 12pt;margin-bottom: 0">We specially request you to try this, we assure you, you will be more than happy!</p>
 
 
 
 
 
286
  </div>
 
287
  </div>
288
  </div>
289
+ <div style="line-height: 30px;" class="panel-footer">
290
+ <a href="<?=admin_url('plugin-install.php?tab=plugin-information&plugin=liveforms&TB_iframe=true&width=600&height=550')?>" class="btn btn-success btn-block thickbox open-plugin-details-modal">Install</a>
291
+ </div>
292
  </div>
293
+ </div>
294
+
295
 
296
 
297
 
300
 
301
  <?php //} ?>
302
 
303
+ <div class="col-md-6">
304
  <div class="well">
305
  <div class="media">
306
  <div class="pull-right">
307
+ <a href="https://www.wpdownloadmanager.com/downloads/free-add-ons/" target="_blank" class="btn btn-info">Explore Free Add-ons <i class="fa fa-angle-double-right"></i></a>
308
  </div>
309
  <div class="media-body">
310
  <b>Free Add-ons</b><br/>
311
  There are more free add-ons
312
  </div> </div>
313
  </div>
314
+ </div>
315
 
316
+ <div class="col-md-6">
317
+ <div class="well">
318
+ <div class="media">
319
+ <div class="pull-right">
320
+ <a href="https://wpattire.com" target="_blank" class="btn btn-info">Get WP Attire <i class="fa fa-angle-double-right"></i></a>
321
+ </div>
322
+ <div class="media-body">
323
+ <b>All-in-One WordPress Theme</b><br/>
324
+ You search for the best theme ends here
325
+ </div> </div>
326
  </div>
327
 
328
  </div>
329
 
330
  <div class="col-md-12 lead">
331
+ <hr/>
332
  <h3>What's New?</h3>
333
+ What new with WordPress Download Manager v3.1:
334
  </div>
335
 
336
  <div class="col-md-4 r">
assets/css/admin-styles.css CHANGED
@@ -1885,6 +1885,12 @@ body.wpdm-iframe-modal-open {
1885
  right: 30px;
1886
  z-index: 999999 !important;
1887
  }
 
 
 
 
 
 
1888
 
1889
  .wpdm-floatify {
1890
  margin-bottom: 10px;
@@ -1893,7 +1899,7 @@ body.wpdm-iframe-modal-open {
1893
  }
1894
 
1895
  .wpdm-notify {
1896
- padding: 20px;
1897
  border-radius: 2px;
1898
  float: right;
1899
  clear: both;
@@ -1907,7 +1913,11 @@ body.wpdm-iframe-modal-open {
1907
  z-index: 999999;
1908
  max-width: 400px;
1909
  }
1910
-
 
 
 
 
1911
  .wpdm-hide-right {
1912
  display: none;
1913
  position: absolute;
@@ -1919,20 +1929,20 @@ body.wpdm-iframe-modal-open {
1919
  }
1920
 
1921
  .wpdm-notify-info {
1922
- border-left: 3px solid var(--color-info);
1923
  color: var(--color-info);
1924
  }
1925
 
1926
  .wpdm-notify-success {
1927
  background: #ffffff !important;
1928
  background-size: 24px !important;
1929
- border-left: 3px solid var(--color-success);
1930
  color: var(--color-success);
1931
  }
1932
 
1933
  .wpdm-notify-error {
1934
  background-size: 24px !important;
1935
- border-left: 3px solid var(--color-danger);
1936
  color: var(--color-danger);
1937
  }
1938
 
@@ -2136,4 +2146,12 @@ body.wpdm-iframe-modal-open {
2136
  }
2137
  #wpdm_terms_page_chosen {
2138
  width: 400px !important;
2139
- }
 
 
 
 
 
 
 
 
1885
  right: 30px;
1886
  z-index: 999999 !important;
1887
  }
1888
+ #wpdm-notify-top-center {
1889
+ position: fixed;
1890
+ left: 50% !important;
1891
+ top: 40px !important;
1892
+ z-index: 999999;
1893
+ }
1894
 
1895
  .wpdm-floatify {
1896
  margin-bottom: 10px;
1899
  }
1900
 
1901
  .wpdm-notify {
1902
+ padding: 20px 30px;
1903
  border-radius: 2px;
1904
  float: right;
1905
  clear: both;
1913
  z-index: 999999;
1914
  max-width: 400px;
1915
  }
1916
+ #wpdm-notify-top-center .wpdm-notify {
1917
+ float: none;
1918
+ margin-left: -50%;
1919
+ text-align: center;
1920
+ }
1921
  .wpdm-hide-right {
1922
  display: none;
1923
  position: absolute;
1929
  }
1930
 
1931
  .wpdm-notify-info {
1932
+ border-bottom: 3px solid var(--color-info);
1933
  color: var(--color-info);
1934
  }
1935
 
1936
  .wpdm-notify-success {
1937
  background: #ffffff !important;
1938
  background-size: 24px !important;
1939
+ border-bottom: 3px solid var(--color-success);
1940
  color: var(--color-success);
1941
  }
1942
 
1943
  .wpdm-notify-error {
1944
  background-size: 24px !important;
1945
+ border-bottom: 3px solid var(--color-danger);
1946
  color: var(--color-danger);
1947
  }
1948
 
2146
  }
2147
  #wpdm_terms_page_chosen {
2148
  width: 400px !important;
2149
+ }
2150
+
2151
+ th#wpdmembed{
2152
+ width: 250px;
2153
+ min-width: 250px;
2154
+ }
2155
+ .short-code-wpdm .form-control{
2156
+ font-family: monospace;font-size: 12px;text-align: center;
2157
+ }
assets/js/front.js CHANGED
@@ -371,12 +371,15 @@ jQuery(function ($) {
371
  var parentWindow = document.createElement("a");
372
  parentWindow.href = document.referrer.toString();
373
 
 
 
 
374
  if(parentWindow.hostname === window.location.hostname || 1)
375
- $(window.parent.document.body).append("<iframe id='wpdm-lock-frame' style='left:0;top:0;width: 100%;height: 100%;z-index: 999999999;position: fixed;background: rgba(255,255,255,0.4) url("+wpdm_home_url+"wp-content/plugins/download-manager/assets/images/loader.svg) center center no-repeat;background-size: 80px 80px;border: 0;' src='"+wpdm_home_url+"?__wpdmlo="+$(this).data('package')+"'></iframe>");
376
  else
377
  window.parent.postMessage({
378
  'task': 'showiframe',
379
- 'iframe': "<iframe id='wpdm-lock-frame' style='left:0;top:0;width: 100%;height: 100%;z-index: 999999999;position: fixed;background: rgba(255,255,255,0.4) url("+wpdm_home_url+"wp-content/plugins/download-manager/assets/images/loader.svg) center center no-repeat;background-size: 80px 80px;border: 0;' src='"+wpdm_home_url+"?__wpdmlo="+$(this).data('package')+"'></iframe>"
380
  }, "*");
381
 
382
  });
371
  var parentWindow = document.createElement("a");
372
  parentWindow.href = document.referrer.toString();
373
 
374
+ var __sep = '?';
375
+ if(wpdm_home_url.indexOf('?') > 0) __sep = '&';
376
+
377
  if(parentWindow.hostname === window.location.hostname || 1)
378
+ $(window.parent.document.body).append("<iframe id='wpdm-lock-frame' style='left:0;top:0;width: 100%;height: 100%;z-index: 999999999;position: fixed;background: rgba(255,255,255,0.4) url("+wpdm_home_url+"wp-content/plugins/download-manager/assets/images/loader.svg) center center no-repeat;background-size: 80px 80px;border: 0;' src='"+wpdm_home_url+__sep+"__wpdmlo="+$(this).data('package')+"'></iframe>");
379
  else
380
  window.parent.postMessage({
381
  'task': 'showiframe',
382
+ 'iframe': "<iframe id='wpdm-lock-frame' style='left:0;top:0;width: 100%;height: 100%;z-index: 999999999;position: fixed;background: rgba(255,255,255,0.4) url("+wpdm_home_url+"wp-content/plugins/download-manager/assets/images/loader.svg) center center no-repeat;background-size: 80px 80px;border: 0;' src='"+wpdm_home_url+__sep+"__wpdmlo="+$(this).data('package')+"'></iframe>"
383
  }, "*");
384
 
385
  });
assets/js/wpdm-admin.js CHANGED
@@ -19,7 +19,13 @@ var WPDM = {
19
  init: function($){
20
 
21
  },
22
-
 
 
 
 
 
 
23
  beep: function() {
24
  if(WPDM.audio == undefined)
25
  var snd = new Audio("data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1jwHuTRxDUQ//iYBczjHiTJcIuPyKlHQkv/LHQUYkuSi57yQT//uggfZNajQ3Vmz+Zt//+mm3Wm3Q576v////+32///5/EOgAAADVghQAAAAA//uQZAUAB1WI0PZugAAAAAoQwAAAEk3nRd2qAAAAACiDgAAAAAAABCqEEQRLCgwpBGMlJkIz8jKhGvj4k6jzRnqasNKIeoh5gI7BJaC1A1AoNBjJgbyApVS4IDlZgDU5WUAxEKDNmmALHzZp0Fkz1FMTmGFl1FMEyodIavcCAUHDWrKAIA4aa2oCgILEBupZgHvAhEBcZ6joQBxS76AgccrFlczBvKLC0QI2cBoCFvfTDAo7eoOQInqDP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SmqU36A3CumzN/9Robv/Xx4v9ijkSRSNLQhAWumap82WRSBUqXStV/YcS+XVLnSS+WLDroqArFkMEsAS+eWmrUzrO0oEmE40RlMZ5+ODIkAyKAGUwZ3mVKmcamcJnMW26MRPgUw6j+LkhyHGVGYjSUUKNpuJUQoOIAyDvEyG8S5yfK6dhZc0Tx1KI/gviKL6qvvFs1+bWtaz58uUNnryq6kt5RzOCkPWlVqVX2a/EEBUdU1KrXLf40GoiiFXK///qpoiDXrOgqDR38JB0bw7SoL+ZB9o1RCkQjQ2CBYZKd/+VJxZRRZlqSkKiws0WFxUyCwsKiMy7hUVFhIaCrNQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU=");
19
  init: function($){
20
 
21
  },
22
+ copy: function ($id) {
23
+ var copyText = document.getElementById($id);
24
+ copyText.select();
25
+ copyText.setSelectionRange(0, 99999);
26
+ document.execCommand("copy");
27
+ WPDM.notify('<i class="fa fa-check-double"></i> Copied', 'success', 'top-center', 1000);
28
+ },
29
  beep: function() {
30
  if(WPDM.audio == undefined)
31
  var snd = new Audio("data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaA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NQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU=");
download-manager.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Download Manager
4
  Plugin URI: https://www.wpdownloadmanager.com/pricing/
5
  Description: Manage, Protect and Track file downloads, and sell digital products from your WordPress site. A complete digital asset management solution.
6
  Author: W3 Eden
7
- Version: 3.1.14
8
  Author URI: https://www.wpdownloadmanager.com/
9
  Text Domain: download-manager
10
  Domain Path: /languages
@@ -108,7 +108,7 @@ class WordPressDownloadManager{
108
 
109
  function __construct(){
110
 
111
- define('WPDM_Version','3.1.14');
112
 
113
  register_activation_hook(__FILE__, array($this, 'Install'));
114
 
4
  Plugin URI: https://www.wpdownloadmanager.com/pricing/
5
  Description: Manage, Protect and Track file downloads, and sell digital products from your WordPress site. A complete digital asset management solution.
6
  Author: W3 Eden
7
+ Version: 3.1.17
8
  Author URI: https://www.wpdownloadmanager.com/
9
  Text Domain: download-manager
10
  Domain Path: /languages
108
 
109
  function __construct(){
110
 
111
+ define('WPDM_Version','3.1.17');
112
 
113
  register_activation_hook(__FILE__, array($this, 'Install'));
114
 
libs/class.Apply.php CHANGED
@@ -473,61 +473,65 @@ class Apply {
473
 
474
  }
475
 
476
- function resetPassword(){
477
- if(wpdm_query_var('__reset_pass')){
478
 
479
- if ( empty( $_POST['user_login'] ) ) {
 
 
 
 
480
  die('error');
481
- } elseif ( strpos( $_POST['user_login'], '@' ) ) {
482
- $user_data = get_user_by( 'email', trim( wp_unslash( $_POST['user_login'] ) ) );
483
- if ( empty( $user_data ) )
484
  die('error');
485
  } else {
486
  $login = trim($_POST['user_login']);
487
  $user_data = get_user_by('login', $login);
488
  }
489
- if(Session::get( '__reset_time' ) && time() - Session::get( '__reset_time' ) < 60){
490
  echo "toosoon";
491
  exit;
492
  }
493
- if(!is_object($user_data) || !isset($user_data->user_login)) die('error');
494
- $user_login = $user_data->user_login;
495
  $user_email = $user_data->user_email;
496
- $key = get_password_reset_key( $user_data );
497
 
498
 
499
-
500
- $reseturl = add_query_arg(array('action' => 'rp', 'key' => $key, 'login' => rawurlencode($user_login)), wpdm_login_url());
501
 
502
  $params = array('reset_password' => $reseturl, 'to_email' => $user_email);
503
 
504
  \WPDM\Email::send('password-reset', $params);
505
- Session::set( '__reset_time' , time() );
506
  echo 'ok';
507
  exit;
508
 
509
  }
510
  }
511
 
512
- function updatePassword(){
513
- if(wpdm_query_var('__update_pass')){
 
 
 
 
 
 
 
 
 
 
514
 
515
- if(wp_verify_nonce(wpdm_query_var('__update_pass'), NONCE_KEY)){
516
- $pass = wpdm_query_var('password');
517
- if($pass == '') die('error');
518
- $user = Session::get('__up_user');
519
- $user = maybe_unserialize($user);
520
- if(is_object($user) && isset($user->ID)) {
521
  wp_set_current_user($user->ID, $user->user_login);
522
  wp_set_auth_cookie($user->ID);
523
  //do_action('wp_login', $user->user_login);
524
  wp_set_password($pass, $user->ID);
525
  //print_r($user);
526
  wp_send_json(array('success' => true, 'message' => ''));
527
- } else wp_send_json(array('success' => false, 'message' => __('Session Expired! Please try again.', 'download-manager')));
528
- }
529
- else
530
- wp_send_json(array('success' => false, 'message' => __('Session Expired! Please try again.', 'download-manager')));
531
 
532
  }
533
  }
@@ -801,6 +805,7 @@ class Apply {
801
  if(!current_user_can('manage_options')) die('error');
802
  global $wpdb;
803
  $wpdb->query('truncate table '.$wpdb->prefix.'ahm_download_stats');
 
804
  $wpdb->query("delete from {$wpdb->prefix}postmeta where meta_key='__wpdmx_user_download_count'");
805
  die('ok');
806
  }
473
 
474
  }
475
 
 
 
476
 
477
+ function resetPassword()
478
+ {
479
+ if (wpdm_query_var('__reset_pass')) {
480
+
481
+ if (empty($_POST['user_login'])) {
482
  die('error');
483
+ } elseif (strpos($_POST['user_login'], '@')) {
484
+ $user_data = get_user_by('email', trim(wp_unslash($_POST['user_login'])));
485
+ if (empty($user_data))
486
  die('error');
487
  } else {
488
  $login = trim($_POST['user_login']);
489
  $user_data = get_user_by('login', $login);
490
  }
491
+ if (Session::get('__reset_time') && time() - Session::get('__reset_time') < 60) {
492
  echo "toosoon";
493
  exit;
494
  }
495
+ if (!is_object($user_data) || !isset($user_data->user_login)) die('error');
496
+ $user_login = Crypt::encrypt($user_data->user_login);
497
  $user_email = $user_data->user_email;
498
+ $key = get_password_reset_key($user_data);
499
 
500
 
501
+ $reseturl = add_query_arg(array('action' => 'rp', 'key' => $key, 'login' => $user_login), wpdm_login_url());
 
502
 
503
  $params = array('reset_password' => $reseturl, 'to_email' => $user_email);
504
 
505
  \WPDM\Email::send('password-reset', $params);
506
+ Session::set('__reset_time', time());
507
  echo 'ok';
508
  exit;
509
 
510
  }
511
  }
512
 
513
+ function updatePassword()
514
+ {
515
+ if (wpdm_query_var('__update_pass')) {
516
+
517
+ if (wp_verify_nonce(wpdm_query_var('__update_pass'), NONCE_KEY)) {
518
+ $pass = wpdm_query_var('password','html');
519
+ if ($pass == '') die('error');
520
+ $user = Crypt::decrypt(wpdm_query_var('__up_user'));
521
+ if (is_object($user) && isset($user->ID)) {
522
+
523
+ if(user_can($user->ID, 'manage_options'))
524
+ wp_send_json(array('success' => false, 'message' => apply_filters('wpdm_update_password_error', __('Password update is disabled for this user!', 'download-manager'))));
525
 
 
 
 
 
 
 
526
  wp_set_current_user($user->ID, $user->user_login);
527
  wp_set_auth_cookie($user->ID);
528
  //do_action('wp_login', $user->user_login);
529
  wp_set_password($pass, $user->ID);
530
  //print_r($user);
531
  wp_send_json(array('success' => true, 'message' => ''));
532
+ } else wp_send_json(array('success' => false, 'message' => apply_filters('wpdm_update_password_error', __('Session Expired! Please try again.', 'download-manager'))));
533
+ } else
534
+ wp_send_json(array('success' => false, 'message' => apply_filters('wpdm_update_password_error', __('Session Expired! Please try again.', 'download-manager'))));
 
535
 
536
  }
537
  }
805
  if(!current_user_can('manage_options')) die('error');
806
  global $wpdb;
807
  $wpdb->query('truncate table '.$wpdb->prefix.'ahm_download_stats');
808
+ $wpdb->query('truncate table '.$wpdb->prefix.'ahm_user_download_counts');
809
  $wpdb->query("delete from {$wpdb->prefix}postmeta where meta_key='__wpdmx_user_download_count'");
810
  die('ok');
811
  }
libs/class.CategoryHandler.php CHANGED
@@ -3,6 +3,7 @@
3
  namespace WPDM\libs;
4
 
5
  use WPDM\Package;
 
6
  use WPDM\Template;
7
 
8
  class CategoryHandler
@@ -15,9 +16,9 @@ class CategoryHandler
15
 
16
  }
17
 
18
- function hArray($skip_filter = 1)
19
  {
20
- $terms = get_terms(array('taxonomy' => 'wpdmcategory', 'parent' => 0, 'hide_empty' => false));
21
  $allterms = _get_term_hierarchy('wpdmcategory');
22
  $allcats = array();
23
  foreach ($terms as $term) {
@@ -40,26 +41,45 @@ class CategoryHandler
40
  function checkboxTree($name, $selected = array(), $extras = array())
41
  {
42
  echo "<ul class='ptypes m-0 p-0' id='wpdmcat-tree'>";
43
- $allcats = WPDM()->categories->hArray(0);
44
- $cparent = is_array($extras) && isset($extras['base_category']) ? $extras['base_category'] : 0;
 
 
45
  if ($cparent !== 0) {
46
- $cparent = get_term_by('slug', $cparent, 'wpdmcategory');
47
  $cparent = $cparent->term_id;
48
  echo "<input type='hidden' value='{$cparent}' name='cats[]' />";
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  }
50
  $this->checkboxList($name, $allcats, $selected, $extras);
 
51
  echo "</ul>";
52
  }
53
 
54
  private function checkboxList($name, $allcats, $selected = array(), $extras = array())
55
  {
56
  foreach ($allcats as $cat_id => $cat) {
 
 
57
  $category = $cat['category'];
58
  ?>
59
- <li <?php if (is_array($extras) && isset($extras['liclass'])) echo "class='{$extras['liclass']}'"; ?>>
60
- <label><input type="checkbox" <?php checked(1, in_array($cat_id, $selected)); ?>
61
  name="<?php echo $name; ?>[]"
62
- value="<?php echo $cat_id; ?>"> <?php echo $category->name; ?> </label>
 
63
  <?php
64
  if (count($cat['childs']) > 0) {
65
  echo "<ul id='wpdmcats-childof-{$cat_id}'>";
@@ -155,6 +175,11 @@ class CategoryHandler
155
 
156
  }
157
 
 
 
 
 
 
158
  public static function userHasAccess($term_id)
159
  {
160
  global $current_user;
@@ -166,6 +191,8 @@ class CategoryHandler
166
  $users = maybe_unserialize(get_term_meta($term_id, '__wpdm_user_access', true));
167
  $users = is_array($users) ? $users : array();
168
  if (count($has_role) > 0 || in_array($current_user->user_login, $users)) return true;
 
 
169
  }
170
 
171
  public static function categoryBreadcrumb($cid, $offset = 1)
@@ -201,11 +228,11 @@ class CategoryHandler
201
  $toolbar = isset($toolbar) ? $toolbar : 0;
202
  $scid = isset($scid) ? $scid : md5($id);
203
  $taxo = 'wpdmcategory';
204
- if (isset($tag) && $tag == 1) $taxo = 'post_tag';
205
  $css_class = isset($css_class) ? $css_class : '';
206
  $cwd_class = "col-lg-" . (int)(12 / $cols);
207
  $cwdsm_class = "col-md-" . (int)(12 / $colspad);
208
- $cwdxs_class = "col-sm-" . (int)(12 / $colsphone);
209
 
210
  $id = trim($id, ", ");
211
  $cids = explode(",", $id);
@@ -221,81 +248,45 @@ class CategoryHandler
221
  //$cpvid = str_replace(",", "_", $id);
222
  //$cpvar = 'cp_'.$cids[0];
223
  $term = get_term_by('slug', $cids[0], 'wpdmcategory');
 
224
  $cpvar = 'cp_' . $term->term_id;
225
  $cp = wpdm_query_var($cpvar, 'num');
226
  if (!$cp) $cp = 1;
227
 
228
- $params = array(
229
- 'post_type' => 'wpdmpro',
230
- 'paged' => $cp,
231
- 'posts_per_page' => $items_per_page,
232
- 'tax_query' => array(array(
233
- 'taxonomy' => $taxo,
234
- 'field' => 'slug',
235
- 'terms' => $cids,
236
- //'include_children' => false,
237
- 'operator' => $operator
238
- ))
239
- );
240
 
241
  if (get_option('_wpdm_hide_all', 0) == 1) {
242
- $params['meta_query'] = array(
243
- array(
244
- 'key' => '__wpdm_access',
245
- 'value' => 'guest',
246
- 'compare' => 'LIKE'
247
- )
248
- );
249
  if (is_user_logged_in()) {
250
- global $current_user;
251
- if (isset($current_user->roles, $current_user->roles[0])) {
252
- foreach ($current_user->roles as $role) {
253
- $params['meta_query'][] = array(
254
- 'key' => '__wpdm_access',
255
- 'value' => $role,
256
- 'compare' => 'LIKE'
257
- );
258
- }
259
- $params['meta_query']['relation'] = 'OR';
260
  }
 
261
  }
262
  }
263
 
264
- if (isset($tags) && $tags != '') {
265
- $params['tag'] = $tags;
266
- }
267
- if($orderby == 'downloads') $orderby = 'download_count';
268
- if($orderby == 'view') $orderby = 'view_count';
269
- $order_fields = array('__wpdm_download_count', '__wpdm_view_count', '__wpdm_package_size_b');
270
- if (!in_array("__wpdm_" . $orderby, $order_fields)) {
271
- $params['orderby'] = $orderby;
272
- $params['order'] = $order;
273
- } else {
274
- $params['orderby'] = 'meta_value_num';
275
- $params['meta_key'] = "__wpdm_" . $orderby;
276
- $params['order'] = $order;
277
  }
278
 
279
- if(wpdm_query_var('skw') !== '') $params['s'] = wpdm_query_var('skw', 'txt');
280
-
281
- $params = apply_filters("wpdm_embed_category_query_params", $params);
282
-
283
- $packs = new \WP_Query($params);
284
-
285
- $total = $packs->found_posts;
286
  $pages = ceil($total / $items_per_page);
287
- $page = $cp;
288
- $start = ($page - 1) * $items_per_page;
289
-
290
-
291
-
292
  $burl = get_permalink();
293
 
294
  $html = '';
295
  $templates = maybe_unserialize(get_option("_fm_link_templates", true));
296
 
297
  if (isset($templates[$template])) $template = $templates[$template]['content'];
298
- $packs = get_posts($params);
299
  foreach ($packs as $pack) {
300
  $pack = (array)$pack;
301
  $thtml = Package::fetchTemplate($template, $pack);
@@ -339,7 +330,7 @@ class CategoryHandler
339
  }
340
  $pagination = "";
341
  if (!isset($paging) || intval($paging) == 1) {
342
- $pag_links = wpdm_paginate_links($total, $items_per_page, $page, $cpvar, array('container' => '#content_' . $scid, 'async' => (isset($async) && $async == 1 ? 1 : 0), 'next_text' => ' <i style="display: inline-block;width: 8px;height: 8px;border-right: 2px solid;border-top: 2px solid;transform: rotate(45deg);margin-left: -2px;margin-top: -2px;"></i> ', 'prev_text' => ' <i style="display: inline-block;width: 8px;height: 8px;border-right: 2px solid;border-bottom: 2px solid;transform: rotate(135deg);margin-left: 2px;margin-top: -2px;"></i> '));
343
  $pagination = "<div style='clear:both'></div>" . $pag_links . "<div style='clear:both'></div>";
344
  } else
345
  $pgn = "";
3
  namespace WPDM\libs;
4
 
5
  use WPDM\Package;
6
+ use WPDM\Query;
7
  use WPDM\Template;
8
 
9
  class CategoryHandler
16
 
17
  }
18
 
19
+ function hArray($skip_filter = 1, $parent = 0)
20
  {
21
+ $terms = get_terms(array('taxonomy' => 'wpdmcategory', 'parent' => $parent, 'hide_empty' => false));
22
  $allterms = _get_term_hierarchy('wpdmcategory');
23
  $allcats = array();
24
  foreach ($terms as $term) {
41
  function checkboxTree($name, $selected = array(), $extras = array())
42
  {
43
  echo "<ul class='ptypes m-0 p-0' id='wpdmcat-tree'>";
44
+ $parent = wpdm_valueof($extras, 'parent', ['validate' => 'int']);
45
+ $allcats = WPDM()->categories->hArray(0, $parent);
46
+
47
+ /*$cparent = is_array($extras) && isset($extras['base_category']) ? $extras['base_category'] : 0;
48
  if ($cparent !== 0) {
49
+ $cparent = get_term($cparent);
50
  $cparent = $cparent->term_id;
51
  echo "<input type='hidden' value='{$cparent}' name='cats[]' />";
52
+ }*/
53
+ if($parent > 0 && wpdm_valueof($extras, 'hide_parent', ['validate' => 'int', 'default' => 0]) == 0) {
54
+ $term = get_term($parent);
55
+ $value = wpdm_valueof($extras, 'value') === 'slug' ? $term->slug : $term->term_id;
56
+ ?>
57
+ <ul>
58
+ <li class="<?php echo wpdm_valueof($extras, 'liclass'); ?>">
59
+ <label><input type="checkbox" <?php checked(1, in_array($value, $selected)); ?>
60
+ name="<?php echo $name; ?>[]"
61
+ class="<?php echo wpdm_valueof($extras, 'cbclass'); ?>"
62
+ value="<?php echo $value; ?>"> <?php echo $term->name; ?> </label>
63
+ <ul>
64
+ <?php
65
  }
66
  $this->checkboxList($name, $allcats, $selected, $extras);
67
+ if($parent > 0 && wpdm_valueof($extras, 'hide_parent', ['validate' => 'int', 'default' => 0]) == 0) echo "</li></ul>";
68
  echo "</ul>";
69
  }
70
 
71
  private function checkboxList($name, $allcats, $selected = array(), $extras = array())
72
  {
73
  foreach ($allcats as $cat_id => $cat) {
74
+
75
+ $value = wpdm_valueof($extras, 'value') === 'slug' ? $cat['category']->slug : $cat_id;
76
  $category = $cat['category'];
77
  ?>
78
+ <li class="<?php echo wpdm_valueof($extras, 'liclass'); ?>">
79
+ <label><input type="checkbox" <?php checked(1, in_array($value, $selected)); ?>
80
  name="<?php echo $name; ?>[]"
81
+ class="<?php echo wpdm_valueof($extras, 'cbclass'); ?>"
82
+ value="<?php echo $value; ?>"> <?php echo $category->name; ?> </label>
83
  <?php
84
  if (count($cat['childs']) > 0) {
85
  echo "<ul id='wpdmcats-childof-{$cat_id}'>";
175
 
176
  }
177
 
178
+ /**
179
+ * Check if current user has access to the given term
180
+ * @param $term_id
181
+ * @return bool
182
+ */
183
  public static function userHasAccess($term_id)
184
  {
185
  global $current_user;
191
  $users = maybe_unserialize(get_term_meta($term_id, '__wpdm_user_access', true));
192
  $users = is_array($users) ? $users : array();
193
  if (count($has_role) > 0 || in_array($current_user->user_login, $users)) return true;
194
+ if(count($roles) === 0 && count($users) === 0) return true;
195
+ return false;
196
  }
197
 
198
  public static function categoryBreadcrumb($cid, $offset = 1)
228
  $toolbar = isset($toolbar) ? $toolbar : 0;
229
  $scid = isset($scid) ? $scid : md5($id);
230
  $taxo = 'wpdmcategory';
231
+ if (isset($tag) && $tag == 1) $taxo = 'wpdmtag';
232
  $css_class = isset($css_class) ? $css_class : '';
233
  $cwd_class = "col-lg-" . (int)(12 / $cols);
234
  $cwdsm_class = "col-md-" . (int)(12 / $colspad);
235
+ $cwdxs_class = "col-" . (int)(12 / $colsphone);
236
 
237
  $id = trim($id, ", ");
238
  $cids = explode(",", $id);
248
  //$cpvid = str_replace(",", "_", $id);
249
  //$cpvar = 'cp_'.$cids[0];
250
  $term = get_term_by('slug', $cids[0], 'wpdmcategory');
251
+ if(!$term) return apply_filters("wpdm_category_not_found", __( "Category doesn't exist", 'download-manager' ));
252
  $cpvar = 'cp_' . $term->term_id;
253
  $cp = wpdm_query_var($cpvar, 'num');
254
  if (!$cp) $cp = 1;
255
 
256
+
257
+ $query = new Query();
258
+ $query->items_per_page($items_per_page);
259
+ $query->paged($cp);
260
+ $query->sort($orderby, $order);
261
+ $query->categories($cids, 'slug', $operator, wpdm_valueof($params, 'include_children', false));
262
+
 
 
 
 
 
263
 
264
  if (get_option('_wpdm_hide_all', 0) == 1) {
265
+ $query->meta("__wpdm_access", '"guest"');
266
+
 
 
 
 
 
267
  if (is_user_logged_in()) {
268
+ foreach ($current_user->roles as $role) {
269
+ $query->meta("__wpdm_access", $role);
 
 
 
 
 
 
 
 
270
  }
271
+ $query->meta_relation('OR');
272
  }
273
  }
274
 
275
+ if (wpdm_query_var('skw', 'txt') != '') {
276
+ $query->s(wpdm_query_var('skw', 'txt'));
 
 
 
 
 
 
 
 
 
 
 
277
  }
278
 
279
+ $query->process();
280
+ $total = $query->count;
281
+ $packs = $query->packages();
 
 
 
 
282
  $pages = ceil($total / $items_per_page);
 
 
 
 
 
283
  $burl = get_permalink();
284
 
285
  $html = '';
286
  $templates = maybe_unserialize(get_option("_fm_link_templates", true));
287
 
288
  if (isset($templates[$template])) $template = $templates[$template]['content'];
289
+
290
  foreach ($packs as $pack) {
291
  $pack = (array)$pack;
292
  $thtml = Package::fetchTemplate($template, $pack);
330
  }
331
  $pagination = "";
332
  if (!isset($paging) || intval($paging) == 1) {
333
+ $pag_links = wpdm_paginate_links($total, $items_per_page, $cp, $cpvar, array('container' => '#content_' . $scid, 'async' => (isset($async) && $async == 1 ? 1 : 0), 'next_text' => ' <i style="display: inline-block;width: 8px;height: 8px;border-right: 2px solid;border-top: 2px solid;transform: rotate(45deg);margin-left: -2px;margin-top: -2px;"></i> ', 'prev_text' => ' <i style="display: inline-block;width: 8px;height: 8px;border-right: 2px solid;border-bottom: 2px solid;transform: rotate(135deg);margin-left: 2px;margin-top: -2px;"></i> '));
334
  $pagination = "<div style='clear:both'></div>" . $pag_links . "<div style='clear:both'></div>";
335
  } else
336
  $pgn = "";
libs/class.DownloadStats.php CHANGED
@@ -7,12 +7,19 @@ namespace WPDM\libs;
7
 
8
  use WPDM\Session;
9
 
 
 
 
10
  class DownloadStats
11
  {
12
 
 
 
 
13
  function __construct()
14
  {
15
-
 
16
  }
17
 
18
  /**
@@ -36,10 +43,11 @@ class DownloadStats
36
  if((int)Session::get($hash) === 1 || wpdm_query_var('nostat', ['validate' => 'int']) === 1) return;
37
  Session::set($hash, 1);
38
  $version = get_post_meta($pid, '__wpdm_version', true);
39
- $wpdb->insert("{$wpdb->prefix}ahm_download_stats", array('pid' => (int)$pid, 'uid' => (int)$uid, 'oid' => $oid, 'year' => date("Y"), 'month' => date("m"), 'day' => date("d"), 'timestamp' => time(), 'ip' => "$ip", 'filename' => $filename, 'agent' => $agent, 'version' => $version));
40
  update_post_meta($pid, '__wpdm_download_count', (int)get_post_meta($pid, '__wpdm_download_count', true) + 1);
41
 
42
- $udl = maybe_unserialize(get_post_meta($pid, "__wpdmx_user_download_count", true));
 
43
  if (is_user_logged_in()) {
44
  $index = $current_user->ID;
45
  } else {
@@ -47,15 +55,93 @@ class DownloadStats
47
  if ($index == '') $index = uniqid();
48
  }
49
 
50
- $udl["{$index}"] = isset($udl["{$index}"]) && intval($udl["{$index}"]) > 0 ? (int)$udl["{$index}"] + 1 : 1;
51
- update_post_meta($pid, '__wpdmx_user_download_count', $udl);
52
-
53
  if ($ip == '') $ip = $index;
54
  Session::set('downloaded_' . $pid, $ip);
55
  }
56
 
57
  /**
58
- * @deprecated User <b>add</b> method
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  * @param $pid
60
  * @param $uid
61
  * @param $oid
7
 
8
  use WPDM\Session;
9
 
10
+ global $userDownloadCount;
11
+ $userDownloadCount = [];
12
+
13
  class DownloadStats
14
  {
15
 
16
+ private $dbTable;
17
+
18
+
19
  function __construct()
20
  {
21
+ global $wpdb;
22
+ $this->dbTable = "{$wpdb->prefix}ahm_download_stats";
23
  }
24
 
25
  /**
43
  if((int)Session::get($hash) === 1 || wpdm_query_var('nostat', ['validate' => 'int']) === 1) return;
44
  Session::set($hash, 1);
45
  $version = get_post_meta($pid, '__wpdm_version', true);
46
+ $wpdb->insert("{$this->dbTable}", array('pid' => (int)$pid, 'uid' => (int)$uid, 'oid' => $oid, 'year' => date("Y"), 'month' => date("m"), 'day' => date("d"), 'timestamp' => time(), 'ip' => "$ip", 'filename' => $filename, 'agent' => $agent, 'version' => $version));
47
  update_post_meta($pid, '__wpdm_download_count', (int)get_post_meta($pid, '__wpdm_download_count', true) + 1);
48
 
49
+ $this->updateUserDownloadCount($pid);
50
+
51
  if (is_user_logged_in()) {
52
  $index = $current_user->ID;
53
  } else {
55
  if ($index == '') $index = uniqid();
56
  }
57
 
 
 
 
58
  if ($ip == '') $ip = $index;
59
  Session::set('downloaded_' . $pid, $ip);
60
  }
61
 
62
  /**
63
+ * Get user download count for the given package
64
+ * @param $packageID
65
+ * @param null $userID
66
+ * @return int|null
67
+ */
68
+ function userDownloadCount($packageID, $userID = null)
69
+ {
70
+ global $wpdb, $userDownloadCount;
71
+ $packageID = (int)$packageID;
72
+
73
+ if(!$userID) {
74
+ if(is_user_logged_in())
75
+ $userID = get_current_user_id();
76
+ else {
77
+ $userID = wpdm_get_client_ip();
78
+ }
79
+ }
80
+ $userID = esc_sql($userID);
81
+
82
+ $piduid = $packageID."_".$userID;
83
+
84
+ if(isset($userDownloadCount[$piduid])) return $userDownloadCount[$piduid];
85
+ $sql = "select download_count from {$wpdb->prefix}ahm_user_download_counts WHERE user = '{$userID}' and package_id = '{$packageID}'";
86
+ $download_count = (int)$wpdb->get_var($sql);
87
+ $userDownloadCount[$piduid] = $download_count;
88
+ return $download_count;
89
+ }
90
+
91
+ /**
92
+ * Reset user download count for the given package
93
+ * @param $packageID
94
+ * @param null $userID
95
+ * @return bool|int
96
+ */
97
+ function resetUserDownloadCount($packageID, $userID = null)
98
+ {
99
+ global $wpdb;
100
+ $packageID = (int)$packageID;
101
+ $where['package_id'] = $packageID;
102
+ if($userID !== 'all') {
103
+ if (!$userID) {
104
+ if (is_user_logged_in())
105
+ $userID = get_current_user_id();
106
+ else {
107
+ $userID = wpdm_get_client_ip();
108
+ }
109
+ }
110
+ $userID = esc_sql($userID);
111
+ $where['user'] = $userID;
112
+ }
113
+ return $wpdb->update("{$wpdb->prefix}ahm_user_download_counts", ['donwload_count' => 0], $where);
114
+ }
115
+
116
+ /**
117
+ * Update user download count for the given package
118
+ * @param $packageID
119
+ * @param null $userID
120
+ */
121
+ function updateUserDownloadCount($packageID, $userID = null)
122
+ {
123
+ global $wpdb;
124
+ $packageID = (int)$packageID;
125
+
126
+ if(!$userID) {
127
+ if(is_user_logged_in())
128
+ $userID = get_current_user_id();
129
+ else {
130
+ $userID = wpdm_get_client_ip();
131
+ }
132
+ }
133
+ $userID = esc_sql($userID);
134
+ $download_count = (int)$this->userDownloadCount($packageID, $userID);
135
+ $download_count++;
136
+ $found = $wpdb->get_var("select count(ID) from {$wpdb->prefix}ahm_user_download_counts where user = '$userID' and package_id = '$packageID'");
137
+ if(!$found)
138
+ $wpdb->insert("{$wpdb->prefix}ahm_user_download_counts", ['download_count' => $download_count, 'user' => $userID, 'package_id' => $packageID]);
139
+ else
140
+ $wpdb->update("{$wpdb->prefix}ahm_user_download_counts", ['download_count' => $download_count], ['user' => $userID, 'package_id' => $packageID]);
141
+ }
142
+
143
+ /**
144
+ * @deprecated Use <strong>add</strong> method, WPDM()->downloadHistory->add($pid, $filename, $oid = null);
145
  * @param $pid
146
  * @param $uid
147
  * @param $oid
libs/class.Email.php CHANGED
@@ -214,7 +214,8 @@ class Email {
214
  }
215
 
216
  $template['subject'] = str_replace( array_keys( $params ), array_values( $params ), $template['subject'] );
217
- $template['to_email'] = str_replace( array_keys( $params ), array_values( $params ), $template['to_email'] );
 
218
  $template['message'] = str_replace( array_keys( $params ), array_values( $params ), $template['message'] );
219
  $template['message'] = self::compile($template['message']);
220
  return $template;
214
  }
215
 
216
  $template['subject'] = str_replace( array_keys( $params ), array_values( $params ), $template['subject'] );
217
+ if(isset($template['to_email']))
218
+ $template['to_email'] = str_replace( array_keys( $params ), array_values( $params ), $template['to_email'] );
219
  $template['message'] = str_replace( array_keys( $params ), array_values( $params ), $template['message'] );
220
  $template['message'] = self::compile($template['message']);
221
  return $template;
libs/class.Form.php CHANGED
@@ -130,6 +130,7 @@ class Form
130
 
131
  function select($attrs){
132
  $_attrs = "";
 
133
  $attrs['class'] = isset($attrs['class']) ? "form-control ".$attrs['class']: "form-control";
134
  $options = $attrs['options'];
135
  unset($attrs['options']);
@@ -192,7 +193,7 @@ class Form
192
  $form_html .= "<button class='{$this->submit_button['class']}'>{$this->submit_button['label']}</button>";
193
  }
194
  $after_form_fields = "";
195
- $form_html .= apply_filters("{$this->id}_before_fields", $after_form_fields, $this);
196
  $form_html .= $this->noForm ? "" : "</form>";
197
  return $form_html;
198
  }
130
 
131
  function select($attrs){
132
  $_attrs = "";
133
+ //print_r($attrs);
134
  $attrs['class'] = isset($attrs['class']) ? "form-control ".$attrs['class']: "form-control";
135
  $options = $attrs['options'];
136
  unset($attrs['options']);
193
  $form_html .= "<button class='{$this->submit_button['class']}'>{$this->submit_button['label']}</button>";
194
  }
195
  $after_form_fields = "";
196
+ $form_html .= apply_filters("{$this->id}_after_fields", $after_form_fields, $this);
197
  $form_html .= $this->noForm ? "" : "</form>";
198
  return $form_html;
199
  }
libs/class.Installer.php CHANGED
@@ -12,7 +12,7 @@ if (!class_exists('\WPDM\Installer')):
12
  class Installer
13
  {
14
 
15
- private $dbVersion = 311.1;
16
 
17
  function __construct()
18
  {
@@ -111,6 +111,14 @@ if (!class_exists('\WPDM\Installer')):
111
  PRIMARY KEY (`ID`)
112
  )";
113
 
 
 
 
 
 
 
 
 
114
  foreach ($sqls as $qry) {
115
  $wpdb->query($qry);
116
  }
12
  class Installer
13
  {
14
 
15
+ private $dbVersion = 311.6;
16
 
17
  function __construct()
18
  {
111
  PRIMARY KEY (`ID`)
112
  )";
113
 
114
+ $sqls[] = "CREATE TABLE `{$wpdb->prefix}ahm_user_download_counts` (
115
+ `ID` int(11) NOT NULL AUTO_INCREMENT,
116
+ `user` varchar(255) NOT NULL,
117
+ `package_id` int(11) NOT NULL,
118
+ `download_count` int(11) NOT NULL,
119
+ PRIMARY KEY (`ID`)
120
+ )";
121
+
122
  foreach ($sqls as $qry) {
123
  $wpdb->query($qry);
124
  }
libs/class.Package.php CHANGED
@@ -215,7 +215,7 @@ class Package {
215
  }
216
 
217
  if(isset($data['terms_lock']) && $data['terms_lock'] != 0 && (!function_exists('wpdmpp_effective_price') || wpdmpp_effective_price($post_vars['ID']) ==0) && $limit_over == 0){
218
- $terms_page = (int)$data['terms_page'];
219
  if($terms_page > 0) {
220
  $terms_page = get_post($terms_page);
221
  $data['terms_title'] = $terms_page->post_title;
@@ -392,16 +392,22 @@ class Package {
392
  else
393
  $index = $_SERVER['REMOTE_ADDR'];
394
 
395
- $udl = maybe_unserialize(get_post_meta($ID, "__wpdmx_user_download_count", true));
396
- $td = isset($udl[$index])?$udl[$index]:0;
397
- $mx = get_post_meta($ID, '__wpdm_download_limit_per_user', true);
398
 
399
- $stock = get_post_meta($ID, '__wpdm_quota', true);
400
- $download_count = get_post_meta($ID, '__wpdm_download_count', true);
401
- if($stock > 0 && $download_count >= $stock) return true;
402
 
403
- if ($mx > 0 && $td >= $mx) return true;
404
- return false;
 
 
 
 
 
 
 
 
 
405
  }
406
 
407
  /**
@@ -1007,6 +1013,7 @@ class Package {
1007
  if(self::isLocked($ID) && !Session::get( '__wpdm_unlocked_'.$ID )) return '#locked';
1008
  if ($ext) $ext = '&' . $ext;
1009
  $permalink = get_permalink($ID);
 
1010
  $sap = strpos($permalink, '?')?'&':'?';
1011
  return $permalink.$sap."wpdmdl={$ID}{$ext}&refresh=".uniqid().time();
1012
  }
@@ -1345,6 +1352,52 @@ class Package {
1345
  }
1346
 
1347
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1348
 
1349
 
1350
  }
215
  }
216
 
217
  if(isset($data['terms_lock']) && $data['terms_lock'] != 0 && (!function_exists('wpdmpp_effective_price') || wpdmpp_effective_price($post_vars['ID']) ==0) && $limit_over == 0){
218
+ $terms_page = wpdm_valueof($data, 'terms_page', 'int');
219
  if($terms_page > 0) {
220
  $terms_page = get_post($terms_page);
221
  $data['terms_title'] = $terms_page->post_title;
392
  else
393
  $index = $_SERVER['REMOTE_ADDR'];
394
 
395
+ $stock = (int)get_post_meta($ID, '__wpdm_quota', true);
396
+ $download_count = (int)get_post_meta($ID, '__wpdm_download_count', true);
 
397
 
398
+ $user_download_count = WPDM()->downloadHistory->userDownloadCount($ID);
 
 
399
 
400
+ $download_limit_per_user = (int)get_post_meta($ID, '__wpdm_download_limit_per_user', true);
401
+
402
+ if ($download_limit_per_user > 0 && $user_download_count >= $download_limit_per_user) return apply_filters("wpdm_user_download_limit_exceeded", true, $ID);
403
+
404
+ $exceeded = false;
405
+
406
+ if($stock > 0 && $download_count >= $stock) $exceeded = true;;
407
+
408
+ $exceeded = apply_filters("wpdm_user_download_limit_exceeded", $exceeded, $ID);
409
+
410
+ return $exceeded;
411
  }
412
 
413
  /**
1013
  if(self::isLocked($ID) && !Session::get( '__wpdm_unlocked_'.$ID )) return '#locked';
1014
  if ($ext) $ext = '&' . $ext;
1015
  $permalink = get_permalink($ID);
1016
+ $permalink = apply_filters("wpdm_download_url_base", $permalink, $ID);
1017
  $sap = strpos($permalink, '?')?'&':'?';
1018
  return $permalink.$sap."wpdmdl={$ID}{$ext}&refresh=".uniqid().time();
1019
  }
1352
  }
1353
 
1354
 
1355
+ /**
1356
+ * Create a copy of a given package
1357
+ * @param $ID
1358
+ * @return int|\WP_Error
1359
+ */
1360
+ static function copy($ID, $author = null, $new_meta = array()){
1361
+ $old_pack = (array)get_post($ID);
1362
+ $package = array(
1363
+ 'post_title' => $old_pack['post_title'],
1364
+ 'post_content' => $old_pack['post_content'],
1365
+ 'post_status' => $old_pack['post_status'],
1366
+ 'comment_status' => $old_pack['comment_status'],
1367
+ 'ping_status' => $old_pack['ping_status'],
1368
+ 'post_type' => 'wpdmpro'
1369
+ );
1370
+
1371
+ if($author)
1372
+ $package['post_author'] = $author;
1373
+ $new_ID = wp_insert_post($package);
1374
+
1375
+ $meta = get_post_meta($ID);
1376
+
1377
+ foreach($meta as $key => $value){
1378
+ foreach ($value as $v) {
1379
+ update_post_meta($new_ID, $key, maybe_unserialize($v));
1380
+ }
1381
+ }
1382
+ if(is_array($new_meta)) {
1383
+ foreach ($new_meta as $key => $value) {
1384
+ update_post_meta($new_ID, $key, maybe_unserialize($value));
1385
+ }
1386
+ }
1387
+ return $new_ID;
1388
+ }
1389
+
1390
+ static function dummy(){
1391
+ $package = array(
1392
+ 'post_title' => __('Sample Package', 'download-manager'),
1393
+ 'post_content' => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. ',
1394
+ 'excerpt' => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s',
1395
+ 'post_status' => 'publish',
1396
+ 'download_link' => '<a href="#">Download</a>',
1397
+ 'download_link_extended' => '<a href="#">Download</a>',
1398
+ );
1399
+ return $package;
1400
+ }
1401
 
1402
 
1403
  }
libs/class.Query.php CHANGED
@@ -11,10 +11,11 @@ class Query
11
  public $result;
12
  public $packages = [];
13
  public $count = 0;
 
14
 
15
  function __construct()
16
  {
17
-
18
  }
19
 
20
  /**
@@ -113,7 +114,7 @@ class Query
113
  {
114
  if($tags)
115
  {
116
- $this->taxonomy('wpdmtag', $tags, $field, $operator);
117
  }
118
  return $this;
119
  }
@@ -126,7 +127,7 @@ class Query
126
  {
127
  if($tags)
128
  {
129
- $this->taxonomy('wpdmtag', $tags, $field, 'AND');
130
  }
131
  return $this;
132
  }
@@ -138,7 +139,7 @@ class Query
138
  {
139
  if($tags)
140
  {
141
- $this->taxonomy('wpdmtag', $tags, 'slug', 'AND');
142
  }
143
  return $this;
144
  }
@@ -151,7 +152,7 @@ class Query
151
  {
152
  if($tags)
153
  {
154
- $this->taxonomy('wpdmtag', $tags, $field, 'IN');
155
  }
156
  return $this;
157
  }
@@ -163,7 +164,7 @@ class Query
163
  {
164
  if($tags)
165
  {
166
- $this->taxonomy('wpdmtag', $tags, 'slug', 'IN');
167
  }
168
  return $this;
169
  }
@@ -176,7 +177,7 @@ class Query
176
  {
177
  if($tags)
178
  {
179
- $this->taxonomy('wpdmtag', $tags, $field, 'NOT IN');
180
  }
181
  return $this;
182
  }
@@ -241,6 +242,7 @@ class Query
241
  */
242
  function paged($paged)
243
  {
 
244
  $this->params['paged'] = $paged;
245
  return $this;
246
  }
@@ -310,4 +312,4 @@ class Query
310
  }
311
 
312
 
313
- }
11
  public $result;
12
  public $packages = [];
13
  public $count = 0;
14
+ public $tag_tax;
15
 
16
  function __construct()
17
  {
18
+ $this->tag_tax = version_compare(WPDM_Version, '5.0.0', '>') ? 'wpdmtag' : 'post_tag';
19
  }
20
 
21
  /**
114
  {
115
  if($tags)
116
  {
117
+ $this->taxonomy($this->tag_tax, $tags, $field, $operator);
118
  }
119
  return $this;
120
  }
127
  {
128
  if($tags)
129
  {
130
+ $this->taxonomy($this->tag_tax, $tags, $field, 'AND');
131
  }
132
  return $this;
133
  }
139
  {
140
  if($tags)
141
  {
142
+ $this->taxonomy($this->tag_tax, $tags, 'slug', 'AND');
143
  }
144
  return $this;
145
  }
152
  {
153
  if($tags)
154
  {
155
+ $this->taxonomy($this->tag_tax, $tags, $field, 'IN');
156
  }
157
  return $this;
158
  }
164
  {
165
  if($tags)
166
  {
167
+ $this->taxonomy($this->tag_tax, $tags, 'slug', 'IN');
168
  }
169
  return $this;
170
  }
177
  {
178
  if($tags)
179
  {
180
+ $this->taxonomy($this->tag_tax, $tags, $field, 'NOT IN');
181
  }
182
  return $this;
183
  }
242
  */
243
  function paged($paged)
244
  {
245
+ if($paged <=1) return $this;
246
  $this->params['paged'] = $paged;
247
  return $this;
248
  }
312
  }
313
 
314
 
315
+ }
libs/class.UserAgent.php CHANGED
@@ -13,7 +13,7 @@ class UserAgent
13
 
14
  function __construct()
15
  {
16
- $this->HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
17
  //$this->parse($this->HTTP_USER_AGENT);
18
  }
19
 
13
 
14
  function __construct()
15
  {
16
+ $this->HTTP_USER_AGENT = isset($_SERVER, $_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
17
  //$this->parse($this->HTTP_USER_AGENT);
18
  }
19
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: w3eden, codename065, shahriar0822, shimo16ab, shafayat-alam
3
  Donate link:
4
  Tags: download manager, document management, file manager, digital store, ecommerce, document management plugin, download monitor, download counter, password protection, download protection
5
  Requires at least: 3.4
6
- Tested up to: 5.6
7
  License: GPLv2 or later
8
 
9
 
@@ -119,15 +119,14 @@ Use [Premium Package – Complete Digital Store Solution](https://www.wpdownload
119
  = Google Drive =
120
  Use [Google Drive Explorer](https://www.wpdownloadmanager.com/download/google-drive-explorer/) add-on ( free ) to store your files in google drive and link with download manager, get 15 GB free storage space and save your server bandwidth
121
 
122
- = OneDrive =
123
- Use [OneDrive Explorer](https://www.wpdownloadmanager.com/download/wpdm-onedrive/) add-on ( free ) to store your files in Microsoft OneDrive and link with download manager, get 15 GB free storage space and save your server bandwidth
124
-
125
  = DropBox =
126
  Use [DropBox Explorer](https://www.wpdownloadmanager.com/download/dropbox-explorer/) add-on ( free ) to store your files in dropbox and link with download manager, get 2 GB free storage space and save your server bandwidth
127
 
128
  = Box.com =
129
  Use [Box.com Explorer](https://www.wpdownloadmanager.com/download/box-com-explorer/) add-on ( free ) to store your files in Box.com and link with download manager, get 10 GB free storage space and save your server bandwidth
130
 
 
 
131
 
132
  = Add-ons =
133
  Download and Install following free add-on to add additional features as per your need
@@ -182,6 +181,20 @@ Check download stats and get a push notification when someone downloads, install
182
 
183
  == Changelog ==
184
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  = 3.1.14 - 2021.02.09 =
186
  * Fixed an issue with the file size function
187
  * Fixed an issue with UI selection option
3
  Donate link:
4
  Tags: download manager, document management, file manager, digital store, ecommerce, document management plugin, download monitor, download counter, password protection, download protection
5
  Requires at least: 3.4
6
+ Tested up to: 5.7
7
  License: GPLv2 or later
8
 
9
 
119
  = Google Drive =
120
  Use [Google Drive Explorer](https://www.wpdownloadmanager.com/download/google-drive-explorer/) add-on ( free ) to store your files in google drive and link with download manager, get 15 GB free storage space and save your server bandwidth
121
 
 
 
 
122
  = DropBox =
123
  Use [DropBox Explorer](https://www.wpdownloadmanager.com/download/dropbox-explorer/) add-on ( free ) to store your files in dropbox and link with download manager, get 2 GB free storage space and save your server bandwidth
124
 
125
  = Box.com =
126
  Use [Box.com Explorer](https://www.wpdownloadmanager.com/download/box-com-explorer/) add-on ( free ) to store your files in Box.com and link with download manager, get 10 GB free storage space and save your server bandwidth
127
 
128
+ = OneDrive =
129
+ Use [OneDrive Explorer](https://www.wpdownloadmanager.com/download/wpdm-onedrive/) add-on ( free ) to store your files in Microsoft OneDrive and link with download manager, get 15 GB free storage space and save your server bandwidth
130
 
131
  = Add-ons =
132
  Download and Install following free add-on to add additional features as per your need
181
 
182
  == Changelog ==
183
 
184
+ = 3.1.17 - 2021.04.08 =
185
+ * Adjusted shortcode column, removed the popup trigger button and reinstated the preview text field showing the shortcode
186
+
187
+ = 3.1.16 - 2021.03.23 =
188
+ * Fixed the issue with the password reset form
189
+ * Fixed 2 `undefined variable` notice in class.Package.php
190
+ * Fixed 1 `undefined variable` notice in class.Email.php
191
+
192
+ = 3.1.15 - 2021.02.24 =
193
+ * Fixed an issue user agent detection
194
+ * Added new option to duplicate downloads
195
+ * Improved shortcode column
196
+ * Improved Query class
197
+
198
  = 3.1.14 - 2021.02.09 =
199
  * Fixed an issue with the file size function
200
  * Fixed an issue with UI selection option
tpls/link-templates/link-template-bsthumnail.php CHANGED
@@ -10,14 +10,13 @@
10
  <h3 class="p-0 m-0">[page_link]</h3>
11
  </div>
12
  <div class="list-group-item d-flex justify-content-between align-items-cente">
13
- File Size <span class="badge">[file_size]</span>
14
  </div>
15
  <div class="list-group-item d-flex justify-content-between align-items-cente">
16
- Downloads <span class="badge">[download_count]</span>
17
  </div>
18
  <div class="list-group-item d-flex justify-content-between align-items-center">
19
  [download_link]
20
  </div>
21
  </div>
22
 
23
-
10
  <h3 class="p-0 m-0">[page_link]</h3>
11
  </div>
12
  <div class="list-group-item d-flex justify-content-between align-items-cente">
13
+ [txt=File Size] <span class="badge">[file_size]</span>
14
  </div>
15
  <div class="list-group-item d-flex justify-content-between align-items-cente">
16
+ [txt=Downloads] <span class="badge">[download_count]</span>
17
  </div>
18
  <div class="list-group-item d-flex justify-content-between align-items-center">
19
  [download_link]
20
  </div>
21
  </div>
22
 
 
tpls/link-templates/link-template-default-wdc.php CHANGED
@@ -4,7 +4,7 @@
4
  <div class="wpdm-link-tpl link-btn [color]" data-durl="[download_url]" >
5
  <div class="media">
6
  <div class="pull-left">[icon]</div>
7
- <div class="media-body"><strong class="ptitle">[title] <span class="label label-default" style="font-weight: 400;">[download_count] downloads</span>&nbsp;<span class="label label-default" style="font-weight: 400;">[file_size]</span></strong>
8
  <div><strong>[download_link_extended]</strong></div>
9
  </div>
10
  </div>
4
  <div class="wpdm-link-tpl link-btn [color]" data-durl="[download_url]" >
5
  <div class="media">
6
  <div class="pull-left">[icon]</div>
7
+ <div class="media-body"><strong class="ptitle">[title] <span class="label label-default" style="font-weight: 400;">[download_count] [txt=downloads]</span>&nbsp;<span class="label label-default" style="font-weight: 400;">[file_size]</span></strong>
8
  <div><strong>[download_link_extended]</strong></div>
9
  </div>
10
  </div>
tpls/reset-password-form.php CHANGED
@@ -8,26 +8,27 @@
8
 
9
  if(!defined("ABSPATH")) die();
10
 
11
- $user = check_password_reset_key(wpdm_query_var('key'), wpdm_query_var('login'));
 
12
  if(!is_wp_error($user)){
13
-
14
- \WPDM\Session::set('__up_user', $user);
15
 
16
  ?>
17
  <div class="w3eden">
18
  <div id="wpdmlogin" class="lostpass">
19
  <form name="loginform" id="updatePassword" action="<?php echo admin_url('/admin-ajax.php?action=updatePassword'); ?>" method="post" class="login-form" >
20
  <?php wp_nonce_field(NONCE_KEY,'__update_pass' ); ?>
 
21
  <h3><?php _e( "New Password" , "download-manager" ); ?></h3>
22
  <p>
23
  <?php _e('Please enter a new password', 'download-manager'); ?>
24
  </p>
25
  <div class="form-group">
26
- <input placeholder="<?php _e( "New Password" , "download-manager" ); ?>" type="password" name="password" id="password" class="form-control input-lg required text" value="" size="20" />
27
  </div>
28
 
29
  <div class="form-group">
30
- <input placeholder="<?php _e( "Confirm Password" , "download-manager" ); ?>" type="password" name="cpassword" id="cpassword" class="form-control input-lg required text" value="" size="20" />
31
  </div>
32
 
33
  <div class="row">
@@ -76,4 +77,4 @@ if(!is_wp_error($user)){
76
  </div>
77
  </div>
78
 
79
- <?php }
8
 
9
  if(!defined("ABSPATH")) die();
10
 
11
+ $login = \WPDM\libs\Crypt::decrypt(wpdm_query_var('login'));
12
+ $user = check_password_reset_key(wpdm_query_var('key'), $login);
13
  if(!is_wp_error($user)){
14
+ //\WPDM\Session::set('__up_user', $user);
 
15
 
16
  ?>
17
  <div class="w3eden">
18
  <div id="wpdmlogin" class="lostpass">
19
  <form name="loginform" id="updatePassword" action="<?php echo admin_url('/admin-ajax.php?action=updatePassword'); ?>" method="post" class="login-form" >
20
  <?php wp_nonce_field(NONCE_KEY,'__update_pass' ); ?>
21
+ <input type="hidden" name="__up_user" value="<?php echo \WPDM\libs\Crypt::encrypt($user); ?>">
22
  <h3><?php _e( "New Password" , "download-manager" ); ?></h3>
23
  <p>
24
  <?php _e('Please enter a new password', 'download-manager'); ?>
25
  </p>
26
  <div class="form-group">
27
+ <input placeholder="<?php _e( "New Password" , "download-manager" ); ?>" type="password" name="password" id="password" class="form-control form-control-lg required text" value="" size="20" />
28
  </div>
29
 
30
  <div class="form-group">
31
+ <input placeholder="<?php _e( "Confirm Password" , "download-manager" ); ?>" type="password" name="cpassword" id="cpassword" class="form-control form-control-lg required text" value="" size="20" />
32
  </div>
33
 
34
  <div class="row">
77
  </div>
78
  </div>
79
 
80
+ <?php }
tpls3/reset-password-form.php CHANGED
@@ -8,16 +8,17 @@
8
 
9
  if(!defined("ABSPATH")) die();
10
 
11
- $user = check_password_reset_key(wpdm_query_var('key'), wpdm_query_var('login'));
12
- if(!is_wp_error($user)){
13
 
14
- \WPDM\Session::set('__up_user', $user);
15
 
16
  ?>
17
  <div class="w3eden">
18
  <div id="wpdmlogin" class="lostpass">
19
  <form name="loginform" id="updatePassword" action="<?php echo admin_url('/admin-ajax.php?action=updatePassword'); ?>" method="post" class="login-form" >
20
  <?php wp_nonce_field(NONCE_KEY,'__update_pass' ); ?>
 
21
  <h3><?php _e( "New Password" , "download-manager" ); ?></h3>
22
  <p>
23
  <?php _e('Please enter a new password', 'download-manager'); ?>
@@ -76,4 +77,4 @@ if(!is_wp_error($user)){
76
  </div>
77
  </div>
78
 
79
- <?php }
8
 
9
  if(!defined("ABSPATH")) die();
10
 
11
+ $login = \WPDM\libs\Crypt::decrypt(wpdm_query_var('login'));
12
+ $user = check_password_reset_key(wpdm_query_var('key'), $login);
13
 
14
+ if(!is_wp_error($user)){
15
 
16
  ?>
17
  <div class="w3eden">
18
  <div id="wpdmlogin" class="lostpass">
19
  <form name="loginform" id="updatePassword" action="<?php echo admin_url('/admin-ajax.php?action=updatePassword'); ?>" method="post" class="login-form" >
20
  <?php wp_nonce_field(NONCE_KEY,'__update_pass' ); ?>
21
+ <input type="hidden" name="__up_user" value="<?php echo \WPDM\libs\Crypt::encrypt($user); ?>">
22
  <h3><?php _e( "New Password" , "download-manager" ); ?></h3>
23
  <p>
24
  <?php _e('Please enter a new password', 'download-manager'); ?>
77
  </div>
78
  </div>
79
 
80
+ <?php }