Download Monitor - Version 4.5.94

Version Description

  • 31.05.2022 = Changed: Remove Duplicator Upsells ( https://github.com/WPChill/download-monitor/issues/959 ) Fixed: Download url not working while permalinks are set to plain ( https://github.com/WPChill/download-monitor/issues/964 ) Fixed: User IPs now showing in logs/download notification emails ( https://github.com/WPChill/download-monitor/issues/965 )
Download this release

Release Info

Developer raldea89
Plugin Icon 128x128 Download Monitor
Version 4.5.94
Comparing to
See all releases

Code changes from version 4.5.93 to 4.5.94

Files changed (129) hide show
  1. assets/blocks/src/blocks.js +165 -165
  2. assets/blocks/src/components/DownloadButton/index.js +67 -67
  3. assets/blocks/src/components/DownloadInput/index.js +33 -33
  4. assets/blocks/src/components/TemplateInput/index.js +22 -22
  5. assets/css/cart.less +87 -87
  6. assets/css/checkout.less +205 -205
  7. assets/css/gb-editor.less +10 -10
  8. assets/css/preview.less +18 -18
  9. assets/images/filetypes/document-code.png +0 -0
  10. assets/images/filetypes/document-excel.png +0 -0
  11. assets/images/filetypes/document-film.png +0 -0
  12. assets/images/filetypes/document-flash-movie.png +0 -0
  13. assets/images/filetypes/document-illustrator.png +0 -0
  14. assets/images/filetypes/document-image.png +0 -0
  15. assets/images/filetypes/document-music.png +0 -0
  16. assets/images/filetypes/document-pdf.png +0 -0
  17. assets/images/filetypes/document-photoshop.png +0 -0
  18. assets/images/filetypes/document-powerpoint.png +0 -0
  19. assets/images/filetypes/document-text-image.png +0 -0
  20. assets/images/filetypes/document-text.png +0 -0
  21. assets/images/filetypes/document-word-text.png +0 -0
  22. assets/images/filetypes/document-zipper.png +0 -0
  23. assets/images/filetypes/document.png +0 -0
  24. assets/images/filetypes/readme.txt +0 -0
  25. assets/js/blockui.js +615 -615
  26. assets/js/chosen/chosen-sprite.png +0 -0
  27. assets/js/chosen/chosen-sprite@2x.png +0 -0
  28. assets/js/chosen/chosen.css +413 -413
  29. assets/js/chosen/chosen.jquery.js +1090 -1090
  30. assets/js/chosen/chosen.jquery.min.js +9 -9
  31. assets/js/dlm-uninstall.js +69 -69
  32. assets/js/extensions.js +41 -41
  33. assets/js/insert-download.js +8 -8
  34. assets/js/legacy-upgrader/build/style.css +1 -1
  35. assets/js/legacy-upgrader/package.json +101 -101
  36. assets/js/legacy-upgrader/src/components/app.js +69 -69
  37. assets/js/legacy-upgrader/src/components/content/QueueItem.js +13 -13
  38. assets/js/legacy-upgrader/src/components/content/index.js +149 -149
  39. assets/js/legacy-upgrader/src/components/content/style.less +49 -49
  40. assets/js/legacy-upgrader/src/components/done/index.js +36 -36
  41. assets/js/legacy-upgrader/src/components/done/style.less +5 -5
  42. assets/js/legacy-upgrader/src/components/downloads/QueueItem.js +12 -12
  43. assets/js/legacy-upgrader/src/components/downloads/index.js +145 -145
  44. assets/js/legacy-upgrader/src/components/downloads/style.less +49 -49
  45. assets/js/legacy-upgrader/src/components/welcome/index.js +16 -16
  46. assets/js/legacy-upgrader/src/components/welcome/style.less +5 -5
  47. assets/js/legacy-upgrader/src/config.json +3 -3
  48. assets/js/legacy-upgrader/src/index.ejs +408 -408
  49. assets/js/legacy-upgrader/src/index.js +20 -20
  50. assets/js/legacy-upgrader/src/style/helpers.less +19 -19
  51. assets/js/legacy-upgrader/src/style/index.less +6 -6
  52. assets/js/legacy-upgrader/src/style/mixins.less +18 -18
  53. assets/js/legacy-upgrader/src/style/variables.less +5 -5
  54. assets/js/legacy-upgrader/webpack.config.babel.js +184 -184
  55. assets/js/notices.js +20 -20
  56. assets/js/onboarding.js +69 -69
  57. assets/js/select2/select2.min.css +1 -1
  58. assets/js/shop/admin-order-details.js +45 -45
  59. assets/js/shop/checkout.js +127 -127
  60. assets/views/notice-lu-upgrade.php +12 -12
  61. changelog.txt +5 -0
  62. download-monitor.php +2 -2
  63. includes/admin/class-dlm-upsells.php +0 -10
  64. includes/deprecated.php +37 -37
  65. includes/download-functions.php +15 -15
  66. includes/php-too-low.php +43 -43
  67. includes/submodules/banner/assets/css/wpchill-welcome.css +364 -364
  68. includes/submodules/banner/assets/img/star.svg +12 -12
  69. includes/submodules/banner/class-wpchill-welcome.php +260 -260
  70. includes/submodules/banner/readme.txt +1 -1
  71. readme.txt +602 -2
  72. src/Admin/CategoryWalker.php +52 -52
  73. src/Admin/CustomLabels.php +59 -59
  74. src/Admin/OptionsUpsells.php +95 -95
  75. src/Admin/Settings/Fields/ActionButton.php +55 -55
  76. src/Admin/Settings/Fields/Desc.php +13 -13
  77. src/Admin/Settings/Fields/Title.php +29 -29
  78. src/Admin/ViewManager.php +32 -32
  79. src/Ajax/Ajax.php +32 -32
  80. src/Ajax/GetDownloads.php +40 -40
  81. src/Ajax/Manager.php +84 -84
  82. src/AjaxHandler.php +286 -286
  83. src/Constants.php +15 -15
  84. src/CookieManager.php +67 -67
  85. src/DebugLogger.php +49 -49
  86. src/DownloadHandler.php +1 -1
  87. src/DownloadNoAccessPageEndpoint.php +40 -40
  88. src/DownloadPreview/Config.php +48 -48
  89. src/DownloadPreview/Preview.php +111 -111
  90. src/Hasher.php +102 -102
  91. src/Integrations/PostTypesOrder.php +20 -20
  92. src/Integrations/YoastSEO.php +26 -26
  93. src/LegacyUpgrader/Ajax.php +157 -157
  94. src/LegacyUpgrader/Checker.php +107 -107
  95. src/LegacyUpgrader/ContentQueue.php +115 -115
  96. src/LegacyUpgrader/ContentUpgrader.php +68 -68
  97. src/LegacyUpgrader/DownloadQueue.php +135 -135
  98. src/LegacyUpgrader/DownloadUpgrader.php +346 -346
  99. src/LegacyUpgrader/Message.php +47 -47
  100. src/LegacyUpgrader/Page.php +59 -59
  101. src/Polyfill/DateTimeImmutable/DateTimeInterface.php +28 -28
  102. src/Product/ProductErrorHandler.php +89 -89
  103. src/Product/ProductLicense.php +109 -109
  104. src/Product/ProductManager.php +0 -6
  105. src/Search.php +50 -50
  106. src/TaxonomyManager.php +98 -98
  107. src/TransientManager.php +32 -32
  108. src/Utils.php +2 -2
  109. src/Version/VersionRepository.php +39 -39
  110. src/Widgets/Manager.php +22 -22
  111. templates/content-download-box.php +35 -35
  112. templates/content-download-filename.php +16 -16
  113. templates/content-download-no-version.php +12 -12
  114. templates/content-download-title.php +14 -14
  115. templates/content-download-version-list.php +31 -31
  116. templates/no-access.php +20 -20
  117. templates/pagination.php +33 -33
  118. templates/shop/cart/empty.php +6 -6
  119. templates/shop/checkout/empty.php +6 -6
  120. templates/shop/checkout/error.php +13 -13
  121. templates/shop/checkout/no-access.php +6 -6
  122. templates/shop/checkout/order-review-item.php +10 -10
  123. templates/shop/checkout/submit-button.php +5 -5
  124. templates/shop/email/elements/order-table-plain.php +10 -10
  125. templates/shop/email/elements/order-table.php +16 -16
  126. templates/shop/email/new-order-admin-plain.php +14 -14
  127. templates/shop/email/new-order-admin.php +57 -57
  128. templates/shop/email/new-order-plain.php +17 -17
  129. templates/shop/email/new-order.php +82 -82
assets/blocks/src/blocks.js CHANGED
@@ -1,165 +1,165 @@
1
- //import 'whatwg-fetch';
2
- import Select from 'react-select';
3
-
4
- import { __ } from '@wordpress/i18n';
5
- import { registerBlockType } from '@wordpress/blocks';
6
- import { InspectorControls } from '@wordpress/block-editor';
7
- import { PanelBody } from '@wordpress/components';
8
- import { Fragment } from '@wordpress/element';
9
-
10
- import DownloadButton from './components/DownloadButton';
11
- import DownloadInput from './components/DownloadInput';
12
- import VersionInput from './components/VersionInput';
13
- import TemplateInput from './components/TemplateInput';
14
-
15
- //setLocaleData( window.gutenberg_dlm_blocks.localeData, 'download-monitor' );
16
-
17
- registerBlockType( 'download-monitor/download-button', {
18
- title: __( 'Download Button', 'download-monitor' ),
19
- icon: 'download',
20
- keywords: [
21
- __( 'download', 'download-monitor' ),
22
- 'download monitor',
23
- __( 'file', 'download-monitor' ),
24
- ],
25
- category: 'common',
26
- attributes: {
27
- download_id: {
28
- type: 'number',
29
- default: 0,
30
- },
31
- version_id: {
32
- type: 'number',
33
- default: 0,
34
- },
35
- template: {
36
- type: 'string',
37
- default: 'settings',
38
- },
39
- custom_template: {
40
- type: 'string',
41
- default: '',
42
- },
43
- autop: {
44
- type: 'number',
45
- default: 0,
46
- },
47
- },
48
- edit: ( props ) => {
49
- const {
50
- attributes: {
51
- download_id,
52
- version_id,
53
- template,
54
- custom_template,
55
- autop,
56
- },
57
- setAttributes,
58
- } = props;
59
-
60
- const valueFromId = ( opts, id ) =>
61
- opts.find( ( o ) => o.value === id );
62
- const autoPOptions = [
63
- { value: 0, label: 'No' },
64
- { value: 1, label: 'Yes' },
65
- ];
66
-
67
- return (
68
- <Fragment>
69
- <InspectorControls>
70
- <PanelBody
71
- title={ __(
72
- 'Download Information',
73
- 'download-monitor'
74
- ) }
75
- >
76
- <div className="components-base-control">
77
- <span className="components-base-control__label">
78
- { __( 'Download', 'download-monitor' ) }
79
- </span>
80
- <DownloadInput
81
- onChange={ ( v ) =>
82
- setAttributes( { download_id: v } )
83
- }
84
- selectedDownloadId={ download_id }
85
- />
86
- </div>
87
-
88
- <div className="components-base-control">
89
- <span className="components-base-control__label">
90
- { __( 'Version', 'download-monitor' ) }
91
- </span>
92
- <VersionInput
93
- onChange={ ( v ) =>
94
- setAttributes( { version_id: v } )
95
- }
96
- selectedVersionId={ version_id }
97
- downloadId={ download_id }
98
- />
99
- </div>
100
- </PanelBody>
101
-
102
- <PanelBody title={ __( 'Template', 'download-monitor' ) }>
103
- <div className="components-base-control dlmGbEditorTemplateWrapper">
104
- <span className="components-base-control__label">
105
- { __( 'Template', 'download-monitor' ) }
106
- </span>
107
- <TemplateInput
108
- onChange={ ( v ) =>
109
- setAttributes( { template: v } )
110
- }
111
- selectedTemplate={ template }
112
- templatesStr={ window.dlmBlocks.templates }
113
- />
114
- </div>
115
- { template === 'custom' && (
116
- <div className="components-base-control">
117
- <span className="components-base-control__label">
118
- { __(
119
- 'Custom Template',
120
- 'download-monitor'
121
- ) }
122
- </span>
123
- <input
124
- className="components-text-control__input"
125
- onChange={ ( e ) =>
126
- setAttributes( {
127
- custom_template: e.target.value,
128
- } )
129
- }
130
- value={ custom_template }
131
- />
132
- </div>
133
- ) }
134
- <div className="components-base-control dlmGbEditorTemplateWrapper">
135
- <span className="components-base-control__label">
136
- { __(
137
- 'Wrap in paragraph tag (<p>)?',
138
- 'download-monitor'
139
- ) }
140
- </span>
141
- <Select
142
- value={ valueFromId( autoPOptions, autop ) }
143
- onChange={ ( selectedOption ) => {
144
- setAttributes( {
145
- autop: selectedOption.value,
146
- } );
147
- } }
148
- options={ autoPOptions }
149
- isSearchable="false"
150
- />
151
- </div>
152
- </PanelBody>
153
- </InspectorControls>
154
-
155
- <DownloadButton
156
- download_id={ download_id }
157
- version_id={ version_id }
158
- template={ template }
159
- custom_template={ custom_template }
160
- />
161
- </Fragment>
162
- );
163
- },
164
- save: () => null,
165
- } );
1
+ //import 'whatwg-fetch';
2
+ import Select from 'react-select';
3
+
4
+ import { __ } from '@wordpress/i18n';
5
+ import { registerBlockType } from '@wordpress/blocks';
6
+ import { InspectorControls } from '@wordpress/block-editor';
7
+ import { PanelBody } from '@wordpress/components';
8
+ import { Fragment } from '@wordpress/element';
9
+
10
+ import DownloadButton from './components/DownloadButton';
11
+ import DownloadInput from './components/DownloadInput';
12
+ import VersionInput from './components/VersionInput';
13
+ import TemplateInput from './components/TemplateInput';
14
+
15
+ //setLocaleData( window.gutenberg_dlm_blocks.localeData, 'download-monitor' );
16
+
17
+ registerBlockType( 'download-monitor/download-button', {
18
+ title: __( 'Download Button', 'download-monitor' ),
19
+ icon: 'download',
20
+ keywords: [
21
+ __( 'download', 'download-monitor' ),
22
+ 'download monitor',
23
+ __( 'file', 'download-monitor' ),
24
+ ],
25
+ category: 'common',
26
+ attributes: {
27
+ download_id: {
28
+ type: 'number',
29
+ default: 0,
30
+ },
31
+ version_id: {
32
+ type: 'number',
33
+ default: 0,
34
+ },
35
+ template: {
36
+ type: 'string',
37
+ default: 'settings',
38
+ },
39
+ custom_template: {
40
+ type: 'string',
41
+ default: '',
42
+ },
43
+ autop: {
44
+ type: 'number',
45
+ default: 0,
46
+ },
47
+ },
48
+ edit: ( props ) => {
49
+ const {
50
+ attributes: {
51
+ download_id,
52
+ version_id,
53
+ template,
54
+ custom_template,
55
+ autop,
56
+ },
57
+ setAttributes,
58
+ } = props;
59
+
60
+ const valueFromId = ( opts, id ) =>
61
+ opts.find( ( o ) => o.value === id );
62
+ const autoPOptions = [
63
+ { value: 0, label: 'No' },
64
+ { value: 1, label: 'Yes' },
65
+ ];
66
+
67
+ return (
68
+ <Fragment>
69
+ <InspectorControls>
70
+ <PanelBody
71
+ title={ __(
72
+ 'Download Information',
73
+ 'download-monitor'
74
+ ) }
75
+ >
76
+ <div className="components-base-control">
77
+ <span className="components-base-control__label">
78
+ { __( 'Download', 'download-monitor' ) }
79
+ </span>
80
+ <DownloadInput
81
+ onChange={ ( v ) =>
82
+ setAttributes( { download_id: v } )
83
+ }
84
+ selectedDownloadId={ download_id }
85
+ />
86
+ </div>
87
+
88
+ <div className="components-base-control">
89
+ <span className="components-base-control__label">
90
+ { __( 'Version', 'download-monitor' ) }
91
+ </span>
92
+ <VersionInput
93
+ onChange={ ( v ) =>
94
+ setAttributes( { version_id: v } )
95
+ }
96
+ selectedVersionId={ version_id }
97
+ downloadId={ download_id }
98
+ />
99
+ </div>
100
+ </PanelBody>
101
+
102
+ <PanelBody title={ __( 'Template', 'download-monitor' ) }>
103
+ <div className="components-base-control dlmGbEditorTemplateWrapper">
104
+ <span className="components-base-control__label">
105
+ { __( 'Template', 'download-monitor' ) }
106
+ </span>
107
+ <TemplateInput
108
+ onChange={ ( v ) =>
109
+ setAttributes( { template: v } )
110
+ }
111
+ selectedTemplate={ template }
112
+ templatesStr={ window.dlmBlocks.templates }
113
+ />
114
+ </div>
115
+ { template === 'custom' && (
116
+ <div className="components-base-control">
117
+ <span className="components-base-control__label">
118
+ { __(
119
+ 'Custom Template',
120
+ 'download-monitor'
121
+ ) }
122
+ </span>
123
+ <input
124
+ className="components-text-control__input"
125
+ onChange={ ( e ) =>
126
+ setAttributes( {
127
+ custom_template: e.target.value,
128
+ } )
129
+ }
130
+ value={ custom_template }
131
+ />
132
+ </div>
133
+ ) }
134
+ <div className="components-base-control dlmGbEditorTemplateWrapper">
135
+ <span className="components-base-control__label">
136
+ { __(
137
+ 'Wrap in paragraph tag (<p>)?',
138
+ 'download-monitor'
139
+ ) }
140
+ </span>
141
+ <Select
142
+ value={ valueFromId( autoPOptions, autop ) }
143
+ onChange={ ( selectedOption ) => {
144
+ setAttributes( {
145
+ autop: selectedOption.value,
146
+ } );
147
+ } }
148
+ options={ autoPOptions }
149
+ isSearchable="false"
150
+ />
151
+ </div>
152
+ </PanelBody>
153
+ </InspectorControls>
154
+
155
+ <DownloadButton
156
+ download_id={ download_id }
157
+ version_id={ version_id }
158
+ template={ template }
159
+ custom_template={ custom_template }
160
+ />
161
+ </Fragment>
162
+ );
163
+ },
164
+ save: () => null,
165
+ } );
assets/blocks/src/components/DownloadButton/index.js CHANGED
@@ -1,67 +1,67 @@
1
- import { useState } from '@wordpress/element';
2
-
3
- const DownloadButton = ( {
4
- download_id,
5
- version_id,
6
- template,
7
- custom_template,
8
- } ) => {
9
- const [ calculatedHeight, setCalculatedHeight ] = useState( {
10
- cacheKey: '',
11
- height: 100,
12
- } );
13
-
14
- const getIframeUrl = () => {
15
- let iframeURL = window.dlmBlocks.urlButtonPreview;
16
-
17
- if ( download_id !== 0 ) {
18
- iframeURL += '&download_id=' + download_id;
19
- }
20
-
21
- if ( version_id !== 0 ) {
22
- iframeURL += '&version_id=' + version_id;
23
- }
24
-
25
- if ( template !== '' ) {
26
- iframeURL += '&template=' + template;
27
- }
28
-
29
- if ( custom_template !== '' ) {
30
- iframeURL += '&custom_template=' + custom_template;
31
- }
32
-
33
- return iframeURL;
34
- };
35
-
36
- const updateHeight = ( target ) => {
37
- const cacheKey = encodeURI( getIframeUrl() );
38
-
39
- // check if we need to reset height to new URL
40
- if ( calculatedHeight.chacheKey !== cacheKey ) {
41
- setCalculatedHeight( {
42
- cacheKey,
43
- height: target.contentDocument.getElementById(
44
- 'dlmPreviewContainer'
45
- ).scrollHeight,
46
- } );
47
- }
48
- };
49
-
50
- const iframeURL = getIframeUrl();
51
- const frameHeight = calculatedHeight.height + 'px';
52
-
53
- return (
54
- <div className="dlmPreviewButton">
55
- <iframe
56
- src={ iframeURL }
57
- width="100%"
58
- height={ frameHeight }
59
- onLoad={ ( e ) => {
60
- updateHeight( e.target );
61
- } }
62
- ></iframe>
63
- </div>
64
- );
65
- };
66
-
67
- export default DownloadButton;
1
+ import { useState } from '@wordpress/element';
2
+
3
+ const DownloadButton = ( {
4
+ download_id,
5
+ version_id,
6
+ template,
7
+ custom_template,
8
+ } ) => {
9
+ const [ calculatedHeight, setCalculatedHeight ] = useState( {
10
+ cacheKey: '',
11
+ height: 100,
12
+ } );
13
+
14
+ const getIframeUrl = () => {
15
+ let iframeURL = window.dlmBlocks.urlButtonPreview;
16
+
17
+ if ( download_id !== 0 ) {
18
+ iframeURL += '&download_id=' + download_id;
19
+ }
20
+
21
+ if ( version_id !== 0 ) {
22
+ iframeURL += '&version_id=' + version_id;
23
+ }
24
+
25
+ if ( template !== '' ) {
26
+ iframeURL += '&template=' + template;
27
+ }
28
+
29
+ if ( custom_template !== '' ) {
30
+ iframeURL += '&custom_template=' + custom_template;
31
+ }
32
+
33
+ return iframeURL;
34
+ };
35
+
36
+ const updateHeight = ( target ) => {
37
+ const cacheKey = encodeURI( getIframeUrl() );
38
+
39
+ // check if we need to reset height to new URL
40
+ if ( calculatedHeight.chacheKey !== cacheKey ) {
41
+ setCalculatedHeight( {
42
+ cacheKey,
43
+ height: target.contentDocument.getElementById(
44
+ 'dlmPreviewContainer'
45
+ ).scrollHeight,
46
+ } );
47
+ }
48
+ };
49
+
50
+ const iframeURL = getIframeUrl();
51
+ const frameHeight = calculatedHeight.height + 'px';
52
+
53
+ return (
54
+ <div className="dlmPreviewButton">
55
+ <iframe
56
+ src={ iframeURL }
57
+ width="100%"
58
+ height={ frameHeight }
59
+ onLoad={ ( e ) => {
60
+ updateHeight( e.target );
61
+ } }
62
+ ></iframe>
63
+ </div>
64
+ );
65
+ };
66
+
67
+ export default DownloadButton;
assets/blocks/src/components/DownloadInput/index.js CHANGED
@@ -1,33 +1,33 @@
1
- import Select from 'react-select';
2
-
3
- import { useEffect, useState } from '@wordpress/element';
4
- import apiFetch from '@wordpress/api-fetch';
5
-
6
- const DownloadInput = ( { selectedDownloadId, onChange } ) => {
7
- const [ downloads, setDownloads ] = useState( [] );
8
-
9
- useEffect( () => {
10
- apiFetch( { url: window.dlmBlocks.ajax_getDownloads } ).then(
11
- ( results ) => {
12
- setDownloads( results );
13
- }
14
- );
15
- }, [] );
16
-
17
- const valueFromId = ( opts, id ) => opts.find( ( o ) => o.value === id );
18
-
19
- return (
20
- <div>
21
- <Select
22
- value={ valueFromId( downloads, selectedDownloadId ) }
23
- onChange={ ( selectedOption ) =>
24
- onChange( selectedOption.value )
25
- }
26
- options={ downloads }
27
- isSearchable="true"
28
- />
29
- </div>
30
- );
31
- };
32
-
33
- export default DownloadInput;
1
+ import Select from 'react-select';
2
+
3
+ import { useEffect, useState } from '@wordpress/element';
4
+ import apiFetch from '@wordpress/api-fetch';
5
+
6
+ const DownloadInput = ( { selectedDownloadId, onChange } ) => {
7
+ const [ downloads, setDownloads ] = useState( [] );
8
+
9
+ useEffect( () => {
10
+ apiFetch( { url: window.dlmBlocks.ajax_getDownloads } ).then(
11
+ ( results ) => {
12
+ setDownloads( results );
13
+ }
14
+ );
15
+ }, [] );
16
+
17
+ const valueFromId = ( opts, id ) => opts.find( ( o ) => o.value === id );
18
+
19
+ return (
20
+ <div>
21
+ <Select
22
+ value={ valueFromId( downloads, selectedDownloadId ) }
23
+ onChange={ ( selectedOption ) =>
24
+ onChange( selectedOption.value )
25
+ }
26
+ options={ downloads }
27
+ isSearchable="true"
28
+ />
29
+ </div>
30
+ );
31
+ };
32
+
33
+ export default DownloadInput;
assets/blocks/src/components/TemplateInput/index.js CHANGED
@@ -1,22 +1,22 @@
1
- import Select from 'react-select';
2
-
3
- const TemplateInput = ( { templatesStr, selectedTemplate, onChange } ) => {
4
- const templates = JSON.parse( templatesStr );
5
-
6
- const valueFromId = ( opts, id ) => opts.find( ( o ) => o.value === id );
7
-
8
- return (
9
- <div>
10
- <Select
11
- value={ valueFromId( templates, selectedTemplate ) }
12
- onChange={ ( selectedOption ) =>
13
- onChange( selectedOption.value )
14
- }
15
- options={ templates }
16
- isSearchable="true"
17
- />
18
- </div>
19
- );
20
- };
21
-
22
- export default TemplateInput;
1
+ import Select from 'react-select';
2
+
3
+ const TemplateInput = ( { templatesStr, selectedTemplate, onChange } ) => {
4
+ const templates = JSON.parse( templatesStr );
5
+
6
+ const valueFromId = ( opts, id ) => opts.find( ( o ) => o.value === id );
7
+
8
+ return (
9
+ <div>
10
+ <Select
11
+ value={ valueFromId( templates, selectedTemplate ) }
12
+ onChange={ ( selectedOption ) =>
13
+ onChange( selectedOption.value )
14
+ }
15
+ options={ templates }
16
+ isSearchable="true"
17
+ />
18
+ </div>
19
+ );
20
+ };
21
+
22
+ export default TemplateInput;
assets/css/cart.less CHANGED
@@ -1,88 +1,88 @@
1
- @cart_bottom_bg: #f8f8f8;
2
-
3
- .dlm-cart {
4
-
5
- .dlm-cart-table-items {
6
- table {
7
- tr {
8
- th, td {
9
- background: none;
10
- padding: 1em;
11
- }
12
- th {
13
- font-size: 1.1em;
14
- padding-top: 0.5em;
15
- padding-bottom: 0.5em;
16
- border-bottom: 2px solid #c3c1bc;
17
- }
18
- td {
19
- padding-top: 1.5em;
20
- padding-bottom: 1.5em;
21
- border-bottom: 1px solid #c3c1bc;
22
-
23
- .dlm-cart-remove-item {
24
- display: inline-block;
25
- width: 18px;
26
- height: 18px;
27
- line-height: 14px;
28
- font-size: 15px;
29
- color: #000;
30
- text-align: center;
31
- border: 1px solid #000;
32
- -webkit-border-radius: 100%;
33
- -moz-border-radius: 100%;
34
- border-radius: 100%;
35
- }
36
- }
37
- }
38
- }
39
- }
40
-
41
- .dlm-cart-bottom {
42
- background: @cart_bottom_bg;
43
- padding: 1em;
44
- overflow: hidden;
45
-
46
- .dlm-cart-coupons {
47
- width: 40%;
48
- float: left;
49
- }
50
-
51
- .dlm-cart-bottom-right {
52
- width: 40%;
53
- float: right;
54
-
55
- .dlm-cart-totals {
56
- h2 {
57
- font-size: 1.6em;
58
- }
59
-
60
- table {
61
- tr {
62
- th, td {
63
- padding: .75em .5em;
64
- background: @cart_bottom_bg;
65
- }
66
- }
67
- tr.dlm-totals-last-row {
68
- th, td {
69
- border-top: 1px solid #c3c1bc;
70
- }
71
- }
72
- }
73
- }
74
-
75
- .dlm-proceed-to-checkout {
76
- a.dlm-button-checkout {
77
- display: block;
78
- color: #000;
79
- padding: 1em 2em;
80
- border: 2px solid #000;
81
- text-align: center;
82
- font-weight: 800;
83
- box-shadow: none !important;
84
- }
85
- }
86
- }
87
- }
88
  }
1
+ @cart_bottom_bg: #f8f8f8;
2
+
3
+ .dlm-cart {
4
+
5
+ .dlm-cart-table-items {
6
+ table {
7
+ tr {
8
+ th, td {
9
+ background: none;
10
+ padding: 1em;
11
+ }
12
+ th {
13
+ font-size: 1.1em;
14
+ padding-top: 0.5em;
15
+ padding-bottom: 0.5em;
16
+ border-bottom: 2px solid #c3c1bc;
17
+ }
18
+ td {
19
+ padding-top: 1.5em;
20
+ padding-bottom: 1.5em;
21
+ border-bottom: 1px solid #c3c1bc;
22
+
23
+ .dlm-cart-remove-item {
24
+ display: inline-block;
25
+ width: 18px;
26
+ height: 18px;
27
+ line-height: 14px;
28
+ font-size: 15px;
29
+ color: #000;
30
+ text-align: center;
31
+ border: 1px solid #000;
32
+ -webkit-border-radius: 100%;
33
+ -moz-border-radius: 100%;
34
+ border-radius: 100%;
35
+ }
36
+ }
37
+ }
38
+ }
39
+ }
40
+
41
+ .dlm-cart-bottom {
42
+ background: @cart_bottom_bg;
43
+ padding: 1em;
44
+ overflow: hidden;
45
+
46
+ .dlm-cart-coupons {
47
+ width: 40%;
48
+ float: left;
49
+ }
50
+
51
+ .dlm-cart-bottom-right {
52
+ width: 40%;
53
+ float: right;
54
+
55
+ .dlm-cart-totals {
56
+ h2 {
57
+ font-size: 1.6em;
58
+ }
59
+
60
+ table {
61
+ tr {
62
+ th, td {
63
+ padding: .75em .5em;
64
+ background: @cart_bottom_bg;
65
+ }
66
+ }
67
+ tr.dlm-totals-last-row {
68
+ th, td {
69
+ border-top: 1px solid #c3c1bc;
70
+ }
71
+ }
72
+ }
73
+ }
74
+
75
+ .dlm-proceed-to-checkout {
76
+ a.dlm-button-checkout {
77
+ display: block;
78
+ color: #000;
79
+ padding: 1em 2em;
80
+ border: 2px solid #000;
81
+ text-align: center;
82
+ font-weight: 800;
83
+ box-shadow: none !important;
84
+ }
85
+ }
86
+ }
87
+ }
88
  }
assets/css/checkout.less CHANGED
@@ -1,206 +1,206 @@
1
- @cart_bottom_bg: #f8f8f8;
2
-
3
- .dlm-checkout {
4
-
5
- width: 100% !important;
6
- max-width: 100% !important;
7
- overflow: hidden;
8
-
9
- .dlm-checkout-error {
10
- padding: 1em;
11
- margin-bottom: 15px;
12
- background: #dc3232;
13
- box-shadow: 0 1px 1px 0 rgba( 0, 0, 0, 0.1 );
14
-
15
- .dlm-checkout-error-icon {
16
- display: inline-block;
17
- width: 25px;
18
- color: #fff;
19
- vertical-align: middle;
20
- margin-right: 10px;
21
- }
22
-
23
- p {
24
- display: inline-block;
25
- color: #fff;
26
- font-weight: bold;
27
- padding: 0;
28
- margin: 0;
29
- }
30
- }
31
-
32
- form {
33
- padding: 0;
34
- margin: 0;
35
- }
36
-
37
- .dlm-checkout-billing {
38
- width: 55%;
39
- float: left;
40
- }
41
-
42
- .dlm-checkout-order-review {
43
- width: 40%;
44
- float: right;
45
-
46
- table {
47
- th {
48
- text-align: left;
49
- }
50
- }
51
- }
52
-
53
- .dlm-checkout-row {
54
- width: 100%;
55
- padding: 5px 0;
56
-
57
- label {
58
- display: inline-block;
59
- width: 100%;
60
- .dlm-checkout-required {
61
- padding: 0 5px;
62
- color: #ff0000;
63
- }
64
- }
65
-
66
- .dlm-checkout-input-wrapper {
67
- display: inline-block;
68
- width: 100%;
69
- padding: 5px 0;
70
-
71
- input, select {
72
- width: 100%;
73
- }
74
- select {
75
- padding: 5px;
76
- }
77
-
78
- .dlm-checkout-field {
79
- &.dlm-checkout-field-error {
80
- border: 1px solid #dc3232;
81
- }
82
- }
83
-
84
- }
85
- }
86
-
87
- .dlm-checkout-row-half {
88
- width: 45%;
89
- float: left;
90
- }
91
-
92
- .dlm-checkout-row-last {
93
- float: right;
94
- }
95
-
96
- .dlm-checkout-payment {
97
- ul, li {
98
- padding: 0;
99
- margin: 0;
100
- list-style: none;
101
- }
102
- ul {
103
- li {
104
- background: #fbfbfb;
105
- margin-bottom: 20px;
106
- label {
107
- display: inline-block;
108
- width: 100%;
109
- padding: 15px 25px;
110
- background: #f8f8f8;
111
- cursor: pointer;
112
-
113
- input {
114
- margin-right: 10px;
115
- }
116
- }
117
- .dlm_gateway_details {
118
- padding: 15px 25px;
119
-
120
- p {
121
- padding: 0;
122
- margin: 0;
123
- }
124
- }
125
- }
126
- }
127
- }
128
-
129
- }
130
-
131
- .dlm-checkout-complete {
132
-
133
- table {
134
- th {
135
- text-align: left;
136
- }
137
- }
138
-
139
- .dlm-checkout-download-button {
140
- display: inline-block;
141
- padding: 1em 1.5em;
142
- background-color: #eeeeee;
143
- border-color: #eeeeee;
144
- color: #333333;
145
- }
146
- }
147
-
148
- .dlm-checkout-overlay-bg {
149
- position: fixed;
150
- top: 0;
151
- left: 0;
152
- width: 100%;
153
- height:100%;
154
- background: #000;
155
- opacity: 0.5;
156
- z-index: 9998;
157
-
158
- display: none;
159
- }
160
-
161
- .dlm-checkout-overlay {
162
- box-sizing: border-box;
163
- position: fixed;
164
- top: 50%;
165
- left: 50%;
166
- width: 350px;
167
- height:150px;
168
- margin-top: -75px;
169
- margin-left: -175px;
170
- padding: 25px;
171
- background: #fff;
172
- border-radius: 8px;
173
- box-shadow: 1px 2px;
174
- z-index: 9999;
175
- text-align: center;
176
- display: none;
177
-
178
- h2 {
179
- padding: 0;
180
- margin: 0;
181
- font-size: 26px;
182
- font-weight: 400;
183
- text-align: center;
184
-
185
- &:before {
186
- content:"";
187
- display: none;
188
- }
189
- }
190
-
191
- span {
192
- font-size: 16px;
193
- display: inline-block;
194
- width: 100%;
195
- padding: 10px 0 20px;
196
- text-align: center;
197
- }
198
-
199
- img {
200
- position: absolute;
201
- bottom: 25px;
202
- left: 50%;
203
- margin-left: -22px;
204
- }
205
-
206
  }
1
+ @cart_bottom_bg: #f8f8f8;
2
+
3
+ .dlm-checkout {
4
+
5
+ width: 100% !important;
6
+ max-width: 100% !important;
7
+ overflow: hidden;
8
+
9
+ .dlm-checkout-error {
10
+ padding: 1em;
11
+ margin-bottom: 15px;
12
+ background: #dc3232;
13
+ box-shadow: 0 1px 1px 0 rgba( 0, 0, 0, 0.1 );
14
+
15
+ .dlm-checkout-error-icon {
16
+ display: inline-block;
17
+ width: 25px;
18
+ color: #fff;
19
+ vertical-align: middle;
20
+ margin-right: 10px;
21
+ }
22
+
23
+ p {
24
+ display: inline-block;
25
+ color: #fff;
26
+ font-weight: bold;
27
+ padding: 0;
28
+ margin: 0;
29
+ }
30
+ }
31
+
32
+ form {
33
+ padding: 0;
34
+ margin: 0;
35
+ }
36
+
37
+ .dlm-checkout-billing {
38
+ width: 55%;
39
+ float: left;
40
+ }
41
+
42
+ .dlm-checkout-order-review {
43
+ width: 40%;
44
+ float: right;
45
+
46
+ table {
47
+ th {
48
+ text-align: left;
49
+ }
50
+ }
51
+ }
52
+
53
+ .dlm-checkout-row {
54
+ width: 100%;
55
+ padding: 5px 0;
56
+
57
+ label {
58
+ display: inline-block;
59
+ width: 100%;
60
+ .dlm-checkout-required {
61
+ padding: 0 5px;
62
+ color: #ff0000;
63
+ }
64
+ }
65
+
66
+ .dlm-checkout-input-wrapper {
67
+ display: inline-block;
68
+ width: 100%;
69
+ padding: 5px 0;
70
+
71
+ input, select {
72
+ width: 100%;
73
+ }
74
+ select {
75
+ padding: 5px;
76
+ }
77
+
78
+ .dlm-checkout-field {
79
+ &.dlm-checkout-field-error {
80
+ border: 1px solid #dc3232;
81
+ }
82
+ }
83
+
84
+ }
85
+ }
86
+
87
+ .dlm-checkout-row-half {
88
+ width: 45%;
89
+ float: left;
90
+ }
91
+
92
+ .dlm-checkout-row-last {
93
+ float: right;
94
+ }
95
+
96
+ .dlm-checkout-payment {
97
+ ul, li {
98
+ padding: 0;
99
+ margin: 0;
100
+ list-style: none;
101
+ }
102
+ ul {
103
+ li {
104
+ background: #fbfbfb;
105
+ margin-bottom: 20px;
106
+ label {
107
+ display: inline-block;
108
+ width: 100%;
109
+ padding: 15px 25px;
110
+ background: #f8f8f8;
111
+ cursor: pointer;
112
+
113
+ input {
114
+ margin-right: 10px;
115
+ }
116
+ }
117
+ .dlm_gateway_details {
118
+ padding: 15px 25px;
119
+
120
+ p {
121
+ padding: 0;
122
+ margin: 0;
123
+ }
124
+ }
125
+ }
126
+ }
127
+ }
128
+
129
+ }
130
+
131
+ .dlm-checkout-complete {
132
+
133
+ table {
134
+ th {
135
+ text-align: left;
136
+ }
137
+ }
138
+
139
+ .dlm-checkout-download-button {
140
+ display: inline-block;
141
+ padding: 1em 1.5em;
142
+ background-color: #eeeeee;
143
+ border-color: #eeeeee;
144
+ color: #333333;
145
+ }
146
+ }
147
+
148
+ .dlm-checkout-overlay-bg {
149
+ position: fixed;
150
+ top: 0;
151
+ left: 0;
152
+ width: 100%;
153
+ height:100%;
154
+ background: #000;
155
+ opacity: 0.5;
156
+ z-index: 9998;
157
+
158
+ display: none;
159
+ }
160
+
161
+ .dlm-checkout-overlay {
162
+ box-sizing: border-box;
163
+ position: fixed;
164
+ top: 50%;
165
+ left: 50%;
166
+ width: 350px;
167
+ height:150px;
168
+ margin-top: -75px;
169
+ margin-left: -175px;
170
+ padding: 25px;
171
+ background: #fff;
172
+ border-radius: 8px;
173
+ box-shadow: 1px 2px;
174
+ z-index: 9999;
175
+ text-align: center;
176
+ display: none;
177
+
178
+ h2 {
179
+ padding: 0;
180
+ margin: 0;
181
+ font-size: 26px;
182
+ font-weight: 400;
183
+ text-align: center;
184
+
185
+ &:before {
186
+ content:"";
187
+ display: none;
188
+ }
189
+ }
190
+
191
+ span {
192
+ font-size: 16px;
193
+ display: inline-block;
194
+ width: 100%;
195
+ padding: 10px 0 20px;
196
+ text-align: center;
197
+ }
198
+
199
+ img {
200
+ position: absolute;
201
+ bottom: 25px;
202
+ left: 50%;
203
+ margin-left: -22px;
204
+ }
205
+
206
  }
assets/css/gb-editor.less CHANGED
@@ -1,11 +1,11 @@
1
- .dlmPreviewButton {
2
- border: 2px dashed #419ccb;
3
- color: #fff;
4
- padding: 1em;
5
- overflow: hidden;
6
-
7
- iframe {
8
- overflow: hidden;
9
- float: left;
10
- }
11
  }
1
+ .dlmPreviewButton {
2
+ border: 2px dashed #419ccb;
3
+ color: #fff;
4
+ padding: 1em;
5
+ overflow: hidden;
6
+
7
+ iframe {
8
+ overflow: hidden;
9
+ float: left;
10
+ }
11
  }
assets/css/preview.less CHANGED
@@ -1,19 +1,19 @@
1
- html,body {
2
- padding: 0;
3
- margin: 0;
4
- overflow: hidden !important;
5
- }
6
-
7
- table,tr,td {
8
- padding: 0 !important;
9
- margin: 0 !important;
10
- }
11
-
12
- p {
13
- padding: 0 !important;
14
- margin: 0 !important;
15
- }
16
-
17
- .dlmPreviewContainer {
18
- overflow: hidden;
19
  }
1
+ html,body {
2
+ padding: 0;
3
+ margin: 0;
4
+ overflow: hidden !important;
5
+ }
6
+
7
+ table,tr,td {
8
+ padding: 0 !important;
9
+ margin: 0 !important;
10
+ }
11
+
12
+ p {
13
+ padding: 0 !important;
14
+ margin: 0 !important;
15
+ }
16
+
17
+ .dlmPreviewContainer {
18
+ overflow: hidden;
19
  }
assets/images/filetypes/document-code.png CHANGED
File without changes
assets/images/filetypes/document-excel.png CHANGED
File without changes
assets/images/filetypes/document-film.png CHANGED
File without changes
assets/images/filetypes/document-flash-movie.png CHANGED
File without changes
assets/images/filetypes/document-illustrator.png CHANGED
File without changes
assets/images/filetypes/document-image.png CHANGED
File without changes
assets/images/filetypes/document-music.png CHANGED
File without changes
assets/images/filetypes/document-pdf.png CHANGED
File without changes
assets/images/filetypes/document-photoshop.png CHANGED
File without changes
assets/images/filetypes/document-powerpoint.png CHANGED
File without changes
assets/images/filetypes/document-text-image.png CHANGED
File without changes
assets/images/filetypes/document-text.png CHANGED
File without changes
assets/images/filetypes/document-word-text.png CHANGED
File without changes
assets/images/filetypes/document-zipper.png CHANGED
File without changes
assets/images/filetypes/document.png CHANGED
File without changes
assets/images/filetypes/readme.txt CHANGED
File without changes
assets/js/blockui.js CHANGED
@@ -1,616 +1,616 @@
1
- /*!
2
- * jQuery blockUI plugin
3
- * Version 2.61.0-2013.06.06
4
- * @requires jQuery v1.7 or later
5
- *
6
- * Examples at: http://malsup.com/jquery/block/
7
- * Copyright (c) 2007-2013 M. Alsup
8
- * Dual licensed under the MIT and GPL licenses:
9
- * http://www.opensource.org/licenses/mit-license.php
10
- * http://www.gnu.org/licenses/gpl.html
11
- *
12
- * Thanks to Amir-Hossein Sobhi for some excellent contributions!
13
- */
14
-
15
- ;(function() {
16
- /*jshint eqeqeq:false curly:false latedef:false */
17
- "use strict";
18
-
19
- function setup($) {
20
- $.fn._fadeIn = $.fn.fadeIn;
21
-
22
- var noOp = $.noop || function() {};
23
-
24
- // this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
25
- // retarded userAgent strings on Vista)
26
- var msie = /MSIE/.test(navigator.userAgent);
27
- var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent);
28
- var mode = document.documentMode || 0;
29
- var setExpr = $.isFunction( document.createElement('div').style.setExpression );
30
-
31
- // global $ methods for blocking/unblocking the entire page
32
- $.blockUI = function(opts) { install(window, opts); };
33
- $.unblockUI = function(opts) { remove(window, opts); };
34
-
35
- // convenience method for quick growl-like notifications (http://www.google.com/search?q=growl)
36
- $.growlUI = function(title, message, timeout, onClose) {
37
- var $m = $('<div class="growlUI"></div>');
38
- if (title) $m.append('<h1>'+title+'</h1>');
39
- if (message) $m.append('<h2>'+message+'</h2>');
40
- if (timeout === undefined) timeout = 3000;
41
-
42
- // Added by konapun: Set timeout to 30 seconds if this growl is moused over, like normal toast notifications
43
- var callBlock = function(opts) {
44
- opts = opts || {};
45
-
46
- $.blockUI({
47
- message: $m,
48
- fadeIn : typeof opts.fadeIn !== 'undefined' ? opts.fadeIn : 700,
49
- fadeOut: typeof opts.fadeOut !== 'undefined' ? opts.fadeOut : 1000,
50
- timeout: typeof opts.timeout !== 'undefined' ? opts.timeout : timeout,
51
- centerY: false,
52
- showOverlay: false,
53
- onUnblock: onClose,
54
- css: $.blockUI.defaults.growlCSS
55
- });
56
- };
57
-
58
- callBlock();
59
- var nonmousedOpacity = $m.css('opacity');
60
- $m.mouseover(function() {
61
- callBlock({
62
- fadeIn: 0,
63
- timeout: 30000
64
- });
65
-
66
- var displayBlock = $('.blockMsg');
67
- displayBlock.stop(); // cancel fadeout if it has started
68
- displayBlock.fadeTo(300, 1); // make it easier to read the message by removing transparency
69
- }).mouseout(function() {
70
- $('.blockMsg').fadeOut(1000);
71
- });
72
- // End konapun additions
73
- };
74
-
75
- // plugin method for blocking element content
76
- $.fn.block = function(opts) {
77
- if ( this[0] === window ) {
78
- $.blockUI( opts );
79
- return this;
80
- }
81
- var fullOpts = $.extend({}, $.blockUI.defaults, opts || {});
82
- this.each(function() {
83
- var $el = $(this);
84
- if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked'))
85
- return;
86
- $el.unblock({ fadeOut: 0 });
87
- });
88
-
89
- return this.each(function() {
90
- if ($.css(this,'position') == 'static') {
91
- this.style.position = 'relative';
92
- $(this).data('blockUI.static', true);
93
- }
94
- this.style.zoom = 1; // force 'hasLayout' in ie
95
- install(this, opts);
96
- });
97
- };
98
-
99
- // plugin method for unblocking element content
100
- $.fn.unblock = function(opts) {
101
- if ( this[0] === window ) {
102
- $.unblockUI( opts );
103
- return this;
104
- }
105
- return this.each(function() {
106
- remove(this, opts);
107
- });
108
- };
109
-
110
- $.blockUI.version = 2.60; // 2nd generation blocking at no extra cost!
111
-
112
- // override these in your code to change the default behavior and style
113
- $.blockUI.defaults = {
114
- // message displayed when blocking (use null for no message)
115
- message: '<h1>Please wait...</h1>',
116
-
117
- title: null, // title string; only used when theme == true
118
- draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded)
119
-
120
- theme: false, // set to true to use with jQuery UI themes
121
-
122
- // styles for the message when blocking; if you wish to disable
123
- // these and use an external stylesheet then do this in your code:
124
- // $.blockUI.defaults.css = {};
125
- css: {
126
- padding: 0,
127
- margin: 0,
128
- width: '30%',
129
- top: '40%',
130
- left: '35%',
131
- textAlign: 'center',
132
- color: '#000',
133
- border: '3px solid #aaa',
134
- backgroundColor:'#fff',
135
- cursor: 'wait'
136
- },
137
-
138
- // minimal style set used when themes are used
139
- themedCSS: {
140
- width: '30%',
141
- top: '40%',
142
- left: '35%'
143
- },
144
-
145
- // styles for the overlay
146
- overlayCSS: {
147
- backgroundColor: '#000',
148
- opacity: 0.6,
149
- cursor: 'wait'
150
- },
151
-
152
- // style to replace wait cursor before unblocking to correct issue
153
- // of lingering wait cursor
154
- cursorReset: 'default',
155
-
156
- // styles applied when using $.growlUI
157
- growlCSS: {
158
- width: '350px',
159
- top: '10px',
160
- left: '',
161
- right: '10px',
162
- border: 'none',
163
- padding: '5px',
164
- opacity: 0.6,
165
- cursor: 'default',
166
- color: '#fff',
167
- backgroundColor: '#000',
168
- '-webkit-border-radius':'10px',
169
- '-moz-border-radius': '10px',
170
- 'border-radius': '10px'
171
- },
172
-
173
- // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
174
- // (hat tip to Jorge H. N. de Vasconcelos)
175
- /*jshint scripturl:true */
176
- iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
177
-
178
- // force usage of iframe in non-IE browsers (handy for blocking applets)
179
- forceIframe: false,
180
-
181
- // z-index for the blocking overlay
182
- baseZ: 1000,
183
-
184
- // set these to true to have the message automatically centered
185
- centerX: true, // <-- only effects element blocking (page block controlled via css above)
186
- centerY: true,
187
-
188
- // allow body element to be stetched in ie6; this makes blocking look better
189
- // on "short" pages. disable if you wish to prevent changes to the body height
190
- allowBodyStretch: true,
191
-
192
- // enable if you want key and mouse events to be disabled for content that is blocked
193
- bindEvents: true,
194
-
195
- // be default blockUI will supress tab navigation from leaving blocking content
196
- // (if bindEvents is true)
197
- constrainTabKey: true,
198
-
199
- // fadeIn time in millis; set to 0 to disable fadeIn on block
200
- fadeIn: 200,
201
-
202
- // fadeOut time in millis; set to 0 to disable fadeOut on unblock
203
- fadeOut: 400,
204
-
205
- // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
206
- timeout: 0,
207
-
208
- // disable if you don't want to show the overlay
209
- showOverlay: true,
210
-
211
- // if true, focus will be placed in the first available input field when
212
- // page blocking
213
- focusInput: true,
214
-
215
- // elements that can receive focus
216
- focusableElements: ':input:enabled:visible',
217
-
218
- // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
219
- // no longer needed in 2012
220
- // applyPlatformOpacityRules: true,
221
-
222
- // callback method invoked when fadeIn has completed and blocking message is visible
223
- onBlock: null,
224
-
225
- // callback method invoked when unblocking has completed; the callback is
226
- // passed the element that has been unblocked (which is the window object for page
227
- // blocks) and the options that were passed to the unblock call:
228
- // onUnblock(element, options)
229
- onUnblock: null,
230
-
231
- // callback method invoked when the overlay area is clicked.
232
- // setting this will turn the cursor to a pointer, otherwise cursor defined in overlayCss will be used.
233
- onOverlayClick: null,
234
-
235
- // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
236
- quirksmodeOffsetHack: 4,
237
-
238
- // class name of the message block
239
- blockMsgClass: 'blockMsg',
240
-
241
- // if it is already blocked, then ignore it (don't unblock and reblock)
242
- ignoreIfBlocked: false
243
- };
244
-
245
- // private data and functions follow...
246
-
247
- var pageBlock = null;
248
- var pageBlockEls = [];
249
-
250
- function install(el, opts) {
251
- var css, themedCSS;
252
- var full = (el == window);
253
- var msg = (opts && opts.message !== undefined ? opts.message : undefined);
254
- opts = $.extend({}, $.blockUI.defaults, opts || {});
255
-
256
- if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked'))
257
- return;
258
-
259
- opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
260
- css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
261
- if (opts.onOverlayClick)
262
- opts.overlayCSS.cursor = 'pointer';
263
-
264
- themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
265
- msg = msg === undefined ? opts.message : msg;
266
-
267
- // remove the current block (if there is one)
268
- if (full && pageBlock)
269
- remove(window, {fadeOut:0});
270
-
271
- // if an existing element is being used as the blocking content then we capture
272
- // its current place in the DOM (and current display style) so we can restore
273
- // it when we unblock
274
- if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
275
- var node = msg.jquery ? msg[0] : msg;
276
- var data = {};
277
- $(el).data('blockUI.history', data);
278
- data.el = node;
279
- data.parent = node.parentNode;
280
- data.display = node.style.display;
281
- data.position = node.style.position;
282
- if (data.parent)
283
- data.parent.removeChild(node);
284
- }
285
-
286
- $(el).data('blockUI.onUnblock', opts.onUnblock);
287
- var z = opts.baseZ;
288
-
289
- // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
290
- // layer1 is the iframe layer which is used to supress bleed through of underlying content
291
- // layer2 is the overlay layer which has opacity and a wait cursor (by default)
292
- // layer3 is the message content that is displayed while blocking
293
- var lyr1, lyr2, lyr3, s;
294
- if (msie || opts.forceIframe)
295
- lyr1 = $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>');
296
- else
297
- lyr1 = $('<div class="blockUI" style="display:none"></div>');
298
-
299
- if (opts.theme)
300
- lyr2 = $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+ (z++) +';display:none"></div>');
301
- else
302
- lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
303
-
304
- if (opts.theme && full) {
305
- s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">';
306
- if ( opts.title ) {
307
- s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>';
308
- }
309
- s += '<div class="ui-widget-content ui-dialog-content"></div>';
310
- s += '</div>';
311
- }
312
- else if (opts.theme) {
313
- s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">';
314
- if ( opts.title ) {
315
- s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>';
316
- }
317
- s += '<div class="ui-widget-content ui-dialog-content"></div>';
318
- s += '</div>';
319
- }
320
- else if (full) {
321
- s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+(z+10)+';display:none;position:fixed"></div>';
322
- }
323
- else {
324
- s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+(z+10)+';display:none;position:absolute"></div>';
325
- }
326
- lyr3 = $(s);
327
-
328
- // if we have a message, style it
329
- if (msg) {
330
- if (opts.theme) {
331
- lyr3.css(themedCSS);
332
- lyr3.addClass('ui-widget-content');
333
- }
334
- else
335
- lyr3.css(css);
336
- }
337
-
338
- // style the overlay
339
- if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/)
340
- lyr2.css(opts.overlayCSS);
341
- lyr2.css('position', full ? 'fixed' : 'absolute');
342
-
343
- // make iframe layer transparent in IE
344
- if (msie || opts.forceIframe)
345
- lyr1.css('opacity',0.0);
346
-
347
- //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
348
- var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
349
- $.each(layers, function() {
350
- this.appendTo($par);
351
- });
352
-
353
- if (opts.theme && opts.draggable && $.fn.draggable) {
354
- lyr3.draggable({
355
- handle: '.ui-dialog-titlebar',
356
- cancel: 'li'
357
- });
358
- }
359
-
360
- // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
361
- var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null : el).length > 0);
362
- if (ie6 || expr) {
363
- // give body 100% height
364
- if (full && opts.allowBodyStretch && $.support.boxModel)
365
- $('html,body').css('height','100%');
366
-
367
- // fix ie6 issue when blocked element has a border width
368
- if ((ie6 || !$.support.boxModel) && !full) {
369
- var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
370
- var fixT = t ? '(0 - '+t+')' : 0;
371
- var fixL = l ? '(0 - '+l+')' : 0;
372
- }
373
-
374
- // simulate fixed position
375
- $.each(layers, function(i,o) {
376
- var s = o[0].style;
377
- s.position = 'absolute';
378
- if (i < 2) {
379
- if (full)
380
- s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"');
381
- else
382
- s.setExpression('height','this.parentNode.offsetHeight + "px"');
383
- if (full)
384
- s.setExpression('width','jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"');
385
- else
386
- s.setExpression('width','this.parentNode.offsetWidth + "px"');
387
- if (fixL) s.setExpression('left', fixL);
388
- if (fixT) s.setExpression('top', fixT);
389
- }
390
- else if (opts.centerY) {
391
- if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
392
- s.marginTop = 0;
393
- }
394
- else if (!opts.centerY && full) {
395
- var top = (opts.css && opts.css.top) ? parseInt(opts.css.top, 10) : 0;
396
- var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
397
- s.setExpression('top',expression);
398
- }
399
- });
400
- }
401
-
402
- // show the message
403
- if (msg) {
404
- if (opts.theme)
405
- lyr3.find('.ui-widget-content').append(msg);
406
- else
407
- lyr3.append(msg);
408
- if (msg.jquery || msg.nodeType)
409
- $(msg).show();
410
- }
411
-
412
- if ((msie || opts.forceIframe) && opts.showOverlay)
413
- lyr1.show(); // opacity is zero
414
- if (opts.fadeIn) {
415
- var cb = opts.onBlock ? opts.onBlock : noOp;
416
- var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
417
- var cb2 = msg ? cb : noOp;
418
- if (opts.showOverlay)
419
- lyr2._fadeIn(opts.fadeIn, cb1);
420
- if (msg)
421
- lyr3._fadeIn(opts.fadeIn, cb2);
422
- }
423
- else {
424
- if (opts.showOverlay)
425
- lyr2.show();
426
- if (msg)
427
- lyr3.show();
428
- if (opts.onBlock)
429
- opts.onBlock();
430
- }
431
-
432
- // bind key and mouse events
433
- bind(1, el, opts);
434
-
435
- if (full) {
436
- pageBlock = lyr3[0];
437
- pageBlockEls = $(opts.focusableElements,pageBlock);
438
- if (opts.focusInput)
439
- setTimeout(focus, 20);
440
- }
441
- else
442
- center(lyr3[0], opts.centerX, opts.centerY);
443
-
444
- if (opts.timeout) {
445
- // auto-unblock
446
- var to = setTimeout(function() {
447
- if (full)
448
- $.unblockUI(opts);
449
- else
450
- $(el).unblock(opts);
451
- }, opts.timeout);
452
- $(el).data('blockUI.timeout', to);
453
- }
454
- }
455
-
456
- // remove the block
457
- function remove(el, opts) {
458
- var count;
459
- var full = (el == window);
460
- var $el = $(el);
461
- var data = $el.data('blockUI.history');
462
- var to = $el.data('blockUI.timeout');
463
- if (to) {
464
- clearTimeout(to);
465
- $el.removeData('blockUI.timeout');
466
- }
467
- opts = $.extend({}, $.blockUI.defaults, opts || {});
468
- bind(0, el, opts); // unbind events
469
-
470
- if (opts.onUnblock === null) {
471
- opts.onUnblock = $el.data('blockUI.onUnblock');
472
- $el.removeData('blockUI.onUnblock');
473
- }
474
-
475
- var els;
476
- if (full) // crazy selector to handle odd field errors in ie6/7
477
- els = $('body').children().filter('.blockUI').add('body > .blockUI');
478
- else
479
- els = $el.find('>.blockUI');
480
-
481
- // fix cursor issue
482
- if ( opts.cursorReset ) {
483
- if ( els.length > 1 )
484
- els[1].style.cursor = opts.cursorReset;
485
- if ( els.length > 2 )
486
- els[2].style.cursor = opts.cursorReset;
487
- }
488
-
489
- if (full)
490
- pageBlock = pageBlockEls = null;
491
-
492
- if (opts.fadeOut) {
493
- count = els.length;
494
- els.fadeOut(opts.fadeOut, function() {
495
- if ( --count === 0)
496
- reset(els,data,opts,el);
497
- });
498
- }
499
- else
500
- reset(els, data, opts, el);
501
- }
502
-
503
- // move blocking element back into the DOM where it started
504
- function reset(els,data,opts,el) {
505
- var $el = $(el);
506
- els.each(function(i,o) {
507
- // remove via DOM calls so we don't lose event handlers
508
- if (this.parentNode)
509
- this.parentNode.removeChild(this);
510
- });
511
-
512
- if (data && data.el) {
513
- data.el.style.display = data.display;
514
- data.el.style.position = data.position;
515
- if (data.parent)
516
- data.parent.appendChild(data.el);
517
- $el.removeData('blockUI.history');
518
- }
519
-
520
- if ($el.data('blockUI.static')) {
521
- $el.css('position', 'static'); // #22
522
- }
523
-
524
- if (typeof opts.onUnblock == 'function')
525
- opts.onUnblock(el,opts);
526
-
527
- // fix issue in Safari 6 where block artifacts remain until reflow
528
- var body = $(document.body), w = body.width(), cssW = body[0].style.width;
529
- body.width(w-1).width(w);
530
- body[0].style.width = cssW;
531
- }
532
-
533
- // bind/unbind the handler
534
- function bind(b, el, opts) {
535
- var full = el == window, $el = $(el);
536
-
537
- // don't bother unbinding if there is nothing to unbind
538
- if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
539
- return;
540
-
541
- $el.data('blockUI.isBlocked', b);
542
-
543
- // don't bind events when overlay is not in use or if bindEvents is false
544
- if (!full || !opts.bindEvents || (b && !opts.showOverlay))
545
- return;
546
-
547
- // bind anchors and inputs for mouse and key events
548
- var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove';
549
- if (b)
550
- $(document).bind(events, opts, handler);
551
- else
552
- $(document).unbind(events, handler);
553
-
554
- // former impl...
555
- // var $e = $('a,:input');
556
- // b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
557
- }
558
-
559
- // event handler to suppress keyboard/mouse events when blocking
560
- function handler(e) {
561
- // allow tab navigation (conditionally)
562
- if (e.keyCode && e.keyCode == 9) {
563
- if (pageBlock && e.data.constrainTabKey) {
564
- var els = pageBlockEls;
565
- var fwd = !e.shiftKey && e.target === els[els.length-1];
566
- var back = e.shiftKey && e.target === els[0];
567
- if (fwd || back) {
568
- setTimeout(function(){focus(back);},10);
569
- return false;
570
- }
571
- }
572
- }
573
- var opts = e.data;
574
- var target = $(e.target);
575
- if (target.hasClass('blockOverlay') && opts.onOverlayClick)
576
- opts.onOverlayClick();
577
-
578
- // allow events within the message content
579
- if (target.parents('div.' + opts.blockMsgClass).length > 0)
580
- return true;
581
-
582
- // allow events for content that is not being blocked
583
- return target.parents().children().filter('div.blockUI').length === 0;
584
- }
585
-
586
- function focus(back) {
587
- if (!pageBlockEls)
588
- return;
589
- var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
590
- if (e)
591
- e.focus();
592
- }
593
-
594
- function center(el, x, y) {
595
- var p = el.parentNode, s = el.style;
596
- var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
597
- var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
598
- if (x) s.left = l > 0 ? (l+'px') : '0';
599
- if (y) s.top = t > 0 ? (t+'px') : '0';
600
- }
601
-
602
- function sz(el, p) {
603
- return parseInt($.css(el,p),10)||0;
604
- }
605
-
606
- }
607
-
608
-
609
- /*global define:true */
610
- if (typeof define === 'function' && define.amd && define.amd.jQuery) {
611
- define(['jquery'], setup);
612
- } else {
613
- setup(jQuery);
614
- }
615
-
616
  })();
1
+ /*!
2
+ * jQuery blockUI plugin
3
+ * Version 2.61.0-2013.06.06
4
+ * @requires jQuery v1.7 or later
5
+ *
6
+ * Examples at: http://malsup.com/jquery/block/
7
+ * Copyright (c) 2007-2013 M. Alsup
8
+ * Dual licensed under the MIT and GPL licenses:
9
+ * http://www.opensource.org/licenses/mit-license.php
10
+ * http://www.gnu.org/licenses/gpl.html
11
+ *
12
+ * Thanks to Amir-Hossein Sobhi for some excellent contributions!
13
+ */
14
+
15
+ ;(function() {
16
+ /*jshint eqeqeq:false curly:false latedef:false */
17
+ "use strict";
18
+
19
+ function setup($) {
20
+ $.fn._fadeIn = $.fn.fadeIn;
21
+
22
+ var noOp = $.noop || function() {};
23
+
24
+ // this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle
25
+ // retarded userAgent strings on Vista)
26
+ var msie = /MSIE/.test(navigator.userAgent);
27
+ var ie6 = /MSIE 6.0/.test(navigator.userAgent) && ! /MSIE 8.0/.test(navigator.userAgent);
28
+ var mode = document.documentMode || 0;
29
+ var setExpr = $.isFunction( document.createElement('div').style.setExpression );
30
+
31
+ // global $ methods for blocking/unblocking the entire page
32
+ $.blockUI = function(opts) { install(window, opts); };
33
+ $.unblockUI = function(opts) { remove(window, opts); };
34
+
35
+ // convenience method for quick growl-like notifications (http://www.google.com/search?q=growl)
36
+ $.growlUI = function(title, message, timeout, onClose) {
37
+ var $m = $('<div class="growlUI"></div>');
38
+ if (title) $m.append('<h1>'+title+'</h1>');
39
+ if (message) $m.append('<h2>'+message+'</h2>');
40
+ if (timeout === undefined) timeout = 3000;
41
+
42
+ // Added by konapun: Set timeout to 30 seconds if this growl is moused over, like normal toast notifications
43
+ var callBlock = function(opts) {
44
+ opts = opts || {};
45
+
46
+ $.blockUI({
47
+ message: $m,
48
+ fadeIn : typeof opts.fadeIn !== 'undefined' ? opts.fadeIn : 700,
49
+ fadeOut: typeof opts.fadeOut !== 'undefined' ? opts.fadeOut : 1000,
50
+ timeout: typeof opts.timeout !== 'undefined' ? opts.timeout : timeout,
51
+ centerY: false,
52
+ showOverlay: false,
53
+ onUnblock: onClose,
54
+ css: $.blockUI.defaults.growlCSS
55
+ });
56
+ };
57
+
58
+ callBlock();
59
+ var nonmousedOpacity = $m.css('opacity');
60
+ $m.mouseover(function() {
61
+ callBlock({
62
+ fadeIn: 0,
63
+ timeout: 30000
64
+ });
65
+
66
+ var displayBlock = $('.blockMsg');
67
+ displayBlock.stop(); // cancel fadeout if it has started
68
+ displayBlock.fadeTo(300, 1); // make it easier to read the message by removing transparency
69
+ }).mouseout(function() {
70
+ $('.blockMsg').fadeOut(1000);
71
+ });
72
+ // End konapun additions
73
+ };
74
+
75
+ // plugin method for blocking element content
76
+ $.fn.block = function(opts) {
77
+ if ( this[0] === window ) {
78
+ $.blockUI( opts );
79
+ return this;
80
+ }
81
+ var fullOpts = $.extend({}, $.blockUI.defaults, opts || {});
82
+ this.each(function() {
83
+ var $el = $(this);
84
+ if (fullOpts.ignoreIfBlocked && $el.data('blockUI.isBlocked'))
85
+ return;
86
+ $el.unblock({ fadeOut: 0 });
87
+ });
88
+
89
+ return this.each(function() {
90
+ if ($.css(this,'position') == 'static') {
91
+ this.style.position = 'relative';
92
+ $(this).data('blockUI.static', true);
93
+ }
94
+ this.style.zoom = 1; // force 'hasLayout' in ie
95
+ install(this, opts);
96
+ });
97
+ };
98
+
99
+ // plugin method for unblocking element content
100
+ $.fn.unblock = function(opts) {
101
+ if ( this[0] === window ) {
102
+ $.unblockUI( opts );
103
+ return this;
104
+ }
105
+ return this.each(function() {
106
+ remove(this, opts);
107
+ });
108
+ };
109
+
110
+ $.blockUI.version = 2.60; // 2nd generation blocking at no extra cost!
111
+
112
+ // override these in your code to change the default behavior and style
113
+ $.blockUI.defaults = {
114
+ // message displayed when blocking (use null for no message)
115
+ message: '<h1>Please wait...</h1>',
116
+
117
+ title: null, // title string; only used when theme == true
118
+ draggable: true, // only used when theme == true (requires jquery-ui.js to be loaded)
119
+
120
+ theme: false, // set to true to use with jQuery UI themes
121
+
122
+ // styles for the message when blocking; if you wish to disable
123
+ // these and use an external stylesheet then do this in your code:
124
+ // $.blockUI.defaults.css = {};
125
+ css: {
126
+ padding: 0,
127
+ margin: 0,
128
+ width: '30%',
129
+ top: '40%',
130
+ left: '35%',
131
+ textAlign: 'center',
132
+ color: '#000',
133
+ border: '3px solid #aaa',
134
+ backgroundColor:'#fff',
135
+ cursor: 'wait'
136
+ },
137
+
138
+ // minimal style set used when themes are used
139
+ themedCSS: {
140
+ width: '30%',
141
+ top: '40%',
142
+ left: '35%'
143
+ },
144
+
145
+ // styles for the overlay
146
+ overlayCSS: {
147
+ backgroundColor: '#000',
148
+ opacity: 0.6,
149
+ cursor: 'wait'
150
+ },
151
+
152
+ // style to replace wait cursor before unblocking to correct issue
153
+ // of lingering wait cursor
154
+ cursorReset: 'default',
155
+
156
+ // styles applied when using $.growlUI
157
+ growlCSS: {
158
+ width: '350px',
159
+ top: '10px',
160
+ left: '',
161
+ right: '10px',
162
+ border: 'none',
163
+ padding: '5px',
164
+ opacity: 0.6,
165
+ cursor: 'default',
166
+ color: '#fff',
167
+ backgroundColor: '#000',
168
+ '-webkit-border-radius':'10px',
169
+ '-moz-border-radius': '10px',
170
+ 'border-radius': '10px'
171
+ },
172
+
173
+ // IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w
174
+ // (hat tip to Jorge H. N. de Vasconcelos)
175
+ /*jshint scripturl:true */
176
+ iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',
177
+
178
+ // force usage of iframe in non-IE browsers (handy for blocking applets)
179
+ forceIframe: false,
180
+
181
+ // z-index for the blocking overlay
182
+ baseZ: 1000,
183
+
184
+ // set these to true to have the message automatically centered
185
+ centerX: true, // <-- only effects element blocking (page block controlled via css above)
186
+ centerY: true,
187
+
188
+ // allow body element to be stetched in ie6; this makes blocking look better
189
+ // on "short" pages. disable if you wish to prevent changes to the body height
190
+ allowBodyStretch: true,
191
+
192
+ // enable if you want key and mouse events to be disabled for content that is blocked
193
+ bindEvents: true,
194
+
195
+ // be default blockUI will supress tab navigation from leaving blocking content
196
+ // (if bindEvents is true)
197
+ constrainTabKey: true,
198
+
199
+ // fadeIn time in millis; set to 0 to disable fadeIn on block
200
+ fadeIn: 200,
201
+
202
+ // fadeOut time in millis; set to 0 to disable fadeOut on unblock
203
+ fadeOut: 400,
204
+
205
+ // time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock
206
+ timeout: 0,
207
+
208
+ // disable if you don't want to show the overlay
209
+ showOverlay: true,
210
+
211
+ // if true, focus will be placed in the first available input field when
212
+ // page blocking
213
+ focusInput: true,
214
+
215
+ // elements that can receive focus
216
+ focusableElements: ':input:enabled:visible',
217
+
218
+ // suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)
219
+ // no longer needed in 2012
220
+ // applyPlatformOpacityRules: true,
221
+
222
+ // callback method invoked when fadeIn has completed and blocking message is visible
223
+ onBlock: null,
224
+
225
+ // callback method invoked when unblocking has completed; the callback is
226
+ // passed the element that has been unblocked (which is the window object for page
227
+ // blocks) and the options that were passed to the unblock call:
228
+ // onUnblock(element, options)
229
+ onUnblock: null,
230
+
231
+ // callback method invoked when the overlay area is clicked.
232
+ // setting this will turn the cursor to a pointer, otherwise cursor defined in overlayCss will be used.
233
+ onOverlayClick: null,
234
+
235
+ // don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493
236
+ quirksmodeOffsetHack: 4,
237
+
238
+ // class name of the message block
239
+ blockMsgClass: 'blockMsg',
240
+
241
+ // if it is already blocked, then ignore it (don't unblock and reblock)
242
+ ignoreIfBlocked: false
243
+ };
244
+
245
+ // private data and functions follow...
246
+
247
+ var pageBlock = null;
248
+ var pageBlockEls = [];
249
+
250
+ function install(el, opts) {
251
+ var css, themedCSS;
252
+ var full = (el == window);
253
+ var msg = (opts && opts.message !== undefined ? opts.message : undefined);
254
+ opts = $.extend({}, $.blockUI.defaults, opts || {});
255
+
256
+ if (opts.ignoreIfBlocked && $(el).data('blockUI.isBlocked'))
257
+ return;
258
+
259
+ opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});
260
+ css = $.extend({}, $.blockUI.defaults.css, opts.css || {});
261
+ if (opts.onOverlayClick)
262
+ opts.overlayCSS.cursor = 'pointer';
263
+
264
+ themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});
265
+ msg = msg === undefined ? opts.message : msg;
266
+
267
+ // remove the current block (if there is one)
268
+ if (full && pageBlock)
269
+ remove(window, {fadeOut:0});
270
+
271
+ // if an existing element is being used as the blocking content then we capture
272
+ // its current place in the DOM (and current display style) so we can restore
273
+ // it when we unblock
274
+ if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {
275
+ var node = msg.jquery ? msg[0] : msg;
276
+ var data = {};
277
+ $(el).data('blockUI.history', data);
278
+ data.el = node;
279
+ data.parent = node.parentNode;
280
+ data.display = node.style.display;
281
+ data.position = node.style.position;
282
+ if (data.parent)
283
+ data.parent.removeChild(node);
284
+ }
285
+
286
+ $(el).data('blockUI.onUnblock', opts.onUnblock);
287
+ var z = opts.baseZ;
288
+
289
+ // blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;
290
+ // layer1 is the iframe layer which is used to supress bleed through of underlying content
291
+ // layer2 is the overlay layer which has opacity and a wait cursor (by default)
292
+ // layer3 is the message content that is displayed while blocking
293
+ var lyr1, lyr2, lyr3, s;
294
+ if (msie || opts.forceIframe)
295
+ lyr1 = $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>');
296
+ else
297
+ lyr1 = $('<div class="blockUI" style="display:none"></div>');
298
+
299
+ if (opts.theme)
300
+ lyr2 = $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+ (z++) +';display:none"></div>');
301
+ else
302
+ lyr2 = $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');
303
+
304
+ if (opts.theme && full) {
305
+ s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:fixed">';
306
+ if ( opts.title ) {
307
+ s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>';
308
+ }
309
+ s += '<div class="ui-widget-content ui-dialog-content"></div>';
310
+ s += '</div>';
311
+ }
312
+ else if (opts.theme) {
313
+ s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(z+10)+';display:none;position:absolute">';
314
+ if ( opts.title ) {
315
+ s += '<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>';
316
+ }
317
+ s += '<div class="ui-widget-content ui-dialog-content"></div>';
318
+ s += '</div>';
319
+ }
320
+ else if (full) {
321
+ s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+(z+10)+';display:none;position:fixed"></div>';
322
+ }
323
+ else {
324
+ s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+(z+10)+';display:none;position:absolute"></div>';
325
+ }
326
+ lyr3 = $(s);
327
+
328
+ // if we have a message, style it
329
+ if (msg) {
330
+ if (opts.theme) {
331
+ lyr3.css(themedCSS);
332
+ lyr3.addClass('ui-widget-content');
333
+ }
334
+ else
335
+ lyr3.css(css);
336
+ }
337
+
338
+ // style the overlay
339
+ if (!opts.theme /*&& (!opts.applyPlatformOpacityRules)*/)
340
+ lyr2.css(opts.overlayCSS);
341
+ lyr2.css('position', full ? 'fixed' : 'absolute');
342
+
343
+ // make iframe layer transparent in IE
344
+ if (msie || opts.forceIframe)
345
+ lyr1.css('opacity',0.0);
346
+
347
+ //$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);
348
+ var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);
349
+ $.each(layers, function() {
350
+ this.appendTo($par);
351
+ });
352
+
353
+ if (opts.theme && opts.draggable && $.fn.draggable) {
354
+ lyr3.draggable({
355
+ handle: '.ui-dialog-titlebar',
356
+ cancel: 'li'
357
+ });
358
+ }
359
+
360
+ // ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)
361
+ var expr = setExpr && (!$.support.boxModel || $('object,embed', full ? null : el).length > 0);
362
+ if (ie6 || expr) {
363
+ // give body 100% height
364
+ if (full && opts.allowBodyStretch && $.support.boxModel)
365
+ $('html,body').css('height','100%');
366
+
367
+ // fix ie6 issue when blocked element has a border width
368
+ if ((ie6 || !$.support.boxModel) && !full) {
369
+ var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');
370
+ var fixT = t ? '(0 - '+t+')' : 0;
371
+ var fixL = l ? '(0 - '+l+')' : 0;
372
+ }
373
+
374
+ // simulate fixed position
375
+ $.each(layers, function(i,o) {
376
+ var s = o[0].style;
377
+ s.position = 'absolute';
378
+ if (i < 2) {
379
+ if (full)
380
+ s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"');
381
+ else
382
+ s.setExpression('height','this.parentNode.offsetHeight + "px"');
383
+ if (full)
384
+ s.setExpression('width','jQuery.support.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"');
385
+ else
386
+ s.setExpression('width','this.parentNode.offsetWidth + "px"');
387
+ if (fixL) s.setExpression('left', fixL);
388
+ if (fixT) s.setExpression('top', fixT);
389
+ }
390
+ else if (opts.centerY) {
391
+ if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');
392
+ s.marginTop = 0;
393
+ }
394
+ else if (!opts.centerY && full) {
395
+ var top = (opts.css && opts.css.top) ? parseInt(opts.css.top, 10) : 0;
396
+ var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';
397
+ s.setExpression('top',expression);
398
+ }
399
+ });
400
+ }
401
+
402
+ // show the message
403
+ if (msg) {
404
+ if (opts.theme)
405
+ lyr3.find('.ui-widget-content').append(msg);
406
+ else
407
+ lyr3.append(msg);
408
+ if (msg.jquery || msg.nodeType)
409
+ $(msg).show();
410
+ }
411
+
412
+ if ((msie || opts.forceIframe) && opts.showOverlay)
413
+ lyr1.show(); // opacity is zero
414
+ if (opts.fadeIn) {
415
+ var cb = opts.onBlock ? opts.onBlock : noOp;
416
+ var cb1 = (opts.showOverlay && !msg) ? cb : noOp;
417
+ var cb2 = msg ? cb : noOp;
418
+ if (opts.showOverlay)
419
+ lyr2._fadeIn(opts.fadeIn, cb1);
420
+ if (msg)
421
+ lyr3._fadeIn(opts.fadeIn, cb2);
422
+ }
423
+ else {
424
+ if (opts.showOverlay)
425
+ lyr2.show();
426
+ if (msg)
427
+ lyr3.show();
428
+ if (opts.onBlock)
429
+ opts.onBlock();
430
+ }
431
+
432
+ // bind key and mouse events
433
+ bind(1, el, opts);
434
+
435
+ if (full) {
436
+ pageBlock = lyr3[0];
437
+ pageBlockEls = $(opts.focusableElements,pageBlock);
438
+ if (opts.focusInput)
439
+ setTimeout(focus, 20);
440
+ }
441
+ else
442
+ center(lyr3[0], opts.centerX, opts.centerY);
443
+
444
+ if (opts.timeout) {
445
+ // auto-unblock
446
+ var to = setTimeout(function() {
447
+ if (full)
448
+ $.unblockUI(opts);
449
+ else
450
+ $(el).unblock(opts);
451
+ }, opts.timeout);
452
+ $(el).data('blockUI.timeout', to);
453
+ }
454
+ }
455
+
456
+ // remove the block
457
+ function remove(el, opts) {
458
+ var count;
459
+ var full = (el == window);
460
+ var $el = $(el);
461
+ var data = $el.data('blockUI.history');
462
+ var to = $el.data('blockUI.timeout');
463
+ if (to) {
464
+ clearTimeout(to);
465
+ $el.removeData('blockUI.timeout');
466
+ }
467
+ opts = $.extend({}, $.blockUI.defaults, opts || {});
468
+ bind(0, el, opts); // unbind events
469
+
470
+ if (opts.onUnblock === null) {
471
+ opts.onUnblock = $el.data('blockUI.onUnblock');
472
+ $el.removeData('blockUI.onUnblock');
473
+ }
474
+
475
+ var els;
476
+ if (full) // crazy selector to handle odd field errors in ie6/7
477
+ els = $('body').children().filter('.blockUI').add('body > .blockUI');
478
+ else
479
+ els = $el.find('>.blockUI');
480
+
481
+ // fix cursor issue
482
+ if ( opts.cursorReset ) {
483
+ if ( els.length > 1 )
484
+ els[1].style.cursor = opts.cursorReset;
485
+ if ( els.length > 2 )
486
+ els[2].style.cursor = opts.cursorReset;
487
+ }
488
+
489
+ if (full)
490
+ pageBlock = pageBlockEls = null;
491
+
492
+ if (opts.fadeOut) {
493
+ count = els.length;
494
+ els.fadeOut(opts.fadeOut, function() {
495
+ if ( --count === 0)
496
+ reset(els,data,opts,el);
497
+ });
498
+ }
499
+ else
500
+ reset(els, data, opts, el);
501
+ }
502
+
503
+ // move blocking element back into the DOM where it started
504
+ function reset(els,data,opts,el) {
505
+ var $el = $(el);
506
+ els.each(function(i,o) {
507
+ // remove via DOM calls so we don't lose event handlers
508
+ if (this.parentNode)
509
+ this.parentNode.removeChild(this);
510
+ });
511
+
512
+ if (data && data.el) {
513
+ data.el.style.display = data.display;
514
+ data.el.style.position = data.position;
515
+ if (data.parent)
516
+ data.parent.appendChild(data.el);
517
+ $el.removeData('blockUI.history');
518
+ }
519
+
520
+ if ($el.data('blockUI.static')) {
521
+ $el.css('position', 'static'); // #22
522
+ }
523
+
524
+ if (typeof opts.onUnblock == 'function')
525
+ opts.onUnblock(el,opts);
526
+
527
+ // fix issue in Safari 6 where block artifacts remain until reflow
528
+ var body = $(document.body), w = body.width(), cssW = body[0].style.width;
529
+ body.width(w-1).width(w);
530
+ body[0].style.width = cssW;
531
+ }
532
+
533
+ // bind/unbind the handler
534
+ function bind(b, el, opts) {
535
+ var full = el == window, $el = $(el);
536
+
537
+ // don't bother unbinding if there is nothing to unbind
538
+ if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))
539
+ return;
540
+
541
+ $el.data('blockUI.isBlocked', b);
542
+
543
+ // don't bind events when overlay is not in use or if bindEvents is false
544
+ if (!full || !opts.bindEvents || (b && !opts.showOverlay))
545
+ return;
546
+
547
+ // bind anchors and inputs for mouse and key events
548
+ var events = 'mousedown mouseup keydown keypress keyup touchstart touchend touchmove';
549
+ if (b)
550
+ $(document).bind(events, opts, handler);
551
+ else
552
+ $(document).unbind(events, handler);
553
+
554
+ // former impl...
555
+ // var $e = $('a,:input');
556
+ // b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);
557
+ }
558
+
559
+ // event handler to suppress keyboard/mouse events when blocking
560
+ function handler(e) {
561
+ // allow tab navigation (conditionally)
562
+ if (e.keyCode && e.keyCode == 9) {
563
+ if (pageBlock && e.data.constrainTabKey) {
564
+ var els = pageBlockEls;
565
+ var fwd = !e.shiftKey && e.target === els[els.length-1];
566
+ var back = e.shiftKey && e.target === els[0];
567
+ if (fwd || back) {
568
+ setTimeout(function(){focus(back);},10);
569
+ return false;
570
+ }
571
+ }
572
+ }
573
+ var opts = e.data;
574
+ var target = $(e.target);
575
+ if (target.hasClass('blockOverlay') && opts.onOverlayClick)
576
+ opts.onOverlayClick();
577
+
578
+ // allow events within the message content
579
+ if (target.parents('div.' + opts.blockMsgClass).length > 0)
580
+ return true;
581
+
582
+ // allow events for content that is not being blocked
583
+ return target.parents().children().filter('div.blockUI').length === 0;
584
+ }
585
+
586
+ function focus(back) {
587
+ if (!pageBlockEls)
588
+ return;
589
+ var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];
590
+ if (e)
591
+ e.focus();
592
+ }
593
+
594
+ function center(el, x, y) {
595
+ var p = el.parentNode, s = el.style;
596
+ var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');
597
+ var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');
598
+ if (x) s.left = l > 0 ? (l+'px') : '0';
599
+ if (y) s.top = t > 0 ? (t+'px') : '0';
600
+ }
601
+
602
+ function sz(el, p) {
603
+ return parseInt($.css(el,p),10)||0;
604
+ }
605
+
606
+ }
607
+
608
+
609
+ /*global define:true */
610
+ if (typeof define === 'function' && define.amd && define.amd.jQuery) {
611
+ define(['jquery'], setup);
612
+ } else {
613
+ setup(jQuery);
614
+ }
615
+
616
  })();
assets/js/chosen/chosen-sprite.png CHANGED
File without changes
assets/js/chosen/chosen-sprite@2x.png CHANGED
File without changes
assets/js/chosen/chosen.css CHANGED
@@ -1,413 +1,413 @@
1
- /* @group Base */
2
- .chzn-container {
3
- font-size: 13px;
4
- position: relative;
5
- display: inline-block;
6
- zoom: 1;
7
- *display: inline;
8
- }
9
- .chzn-container .chzn-drop {
10
- background: #fff;
11
- border: 1px solid #aaa;
12
- border-top: 0;
13
- position: absolute;
14
- top: 29px;
15
- left: 0;
16
- -webkit-box-shadow: 0 4px 5px rgba(0,0,0,.15);
17
- -moz-box-shadow : 0 4px 5px rgba(0,0,0,.15);
18
- box-shadow : 0 4px 5px rgba(0,0,0,.15);
19
- z-index: 1010;
20
- }
21
- /* @end */
22
-
23
- /* @group Single Chosen */
24
- .chzn-container-single .chzn-single {
25
- background-color: #ffffff;
26
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0 );
27
- background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
28
- background-image: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
29
- background-image: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
30
- background-image: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
31
- background-image: linear-gradient(#ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
32
- -webkit-border-radius: 5px;
33
- -moz-border-radius : 5px;
34
- border-radius : 5px;
35
- -moz-background-clip : padding;
36
- -webkit-background-clip: padding-box;
37
- background-clip : padding-box;
38
- border: 1px solid #aaaaaa;
39
- -webkit-box-shadow: 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
40
- -moz-box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
41
- box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
42
- display: block;
43
- overflow: hidden;
44
- white-space: nowrap;
45
- position: relative;
46
- height: 23px;
47
- line-height: 24px;
48
- padding: 0 0 0 8px;
49
- color: #444444;
50
- text-decoration: none;
51
- }
52
- .chzn-container-single .chzn-default {
53
- color: #999;
54
- }
55
- .chzn-container-single .chzn-single span {
56
- margin-right: 26px;
57
- display: block;
58
- overflow: hidden;
59
- white-space: nowrap;
60
- -o-text-overflow: ellipsis;
61
- -ms-text-overflow: ellipsis;
62
- text-overflow: ellipsis;
63
- }
64
- .chzn-container-single .chzn-single abbr {
65
- display: block;
66
- position: absolute;
67
- right: 26px;
68
- top: 6px;
69
- width: 12px;
70
- height: 12px;
71
- font-size: 1px;
72
- background: url('chosen-sprite.png') -42px 1px no-repeat;
73
- }
74
- .chzn-container-single .chzn-single abbr:hover {
75
- background-position: -42px -10px;
76
- }
77
- .chzn-container-single.chzn-disabled .chzn-single abbr:hover {
78
- background-position: -42px -10px;
79
- }
80
- .chzn-container-single .chzn-single div {
81
- position: absolute;
82
- right: 0;
83
- top: 0;
84
- display: block;
85
- height: 100%;
86
- width: 18px;
87
- }
88
- .chzn-container-single .chzn-single div b {
89
- background: url('chosen-sprite.png') no-repeat 0px 2px;
90
- display: block;
91
- width: 100%;
92
- height: 100%;
93
- }
94
- .chzn-container-single .chzn-search {
95
- padding: 3px 4px;
96
- position: relative;
97
- margin: 0;
98
- white-space: nowrap;
99
- z-index: 1010;
100
- }
101
- .chzn-container-single .chzn-search input {
102
- background: #fff url('chosen-sprite.png') no-repeat 100% -20px;
103
- background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-gradient(linear, 0 0, 0 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
104
- background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
105
- background: url('chosen-sprite.png') no-repeat 100% -20px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
106
- background: url('chosen-sprite.png') no-repeat 100% -20px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
107
- background: url('chosen-sprite.png') no-repeat 100% -20px, linear-gradient(#eeeeee 1%, #ffffff 15%);
108
- margin: 1px 0;
109
- padding: 4px 20px 4px 5px;
110
- outline: 0;
111
- border: 1px solid #aaa;
112
- font-family: sans-serif;
113
- font-size: 1em;
114
- }
115
- .chzn-container-single .chzn-drop {
116
- -webkit-border-radius: 0 0 4px 4px;
117
- -moz-border-radius : 0 0 4px 4px;
118
- border-radius : 0 0 4px 4px;
119
- -moz-background-clip : padding;
120
- -webkit-background-clip: padding-box;
121
- background-clip : padding-box;
122
- }
123
- /* @end */
124
-
125
- .chzn-container-single-nosearch .chzn-search input {
126
- position: absolute;
127
- left: -9000px;
128
- }
129
-
130
- /* @group Multi Chosen */
131
- .chzn-container-multi .chzn-choices {
132
- background-color: #fff;
133
- background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
134
- background-image: -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
135
- background-image: -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
136
- background-image: -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
137
- background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);
138
- border: 1px solid #aaa;
139
- margin: 0;
140
- padding: 0;
141
- cursor: text;
142
- overflow: hidden;
143
- height: auto !important;
144
- height: 1%;
145
- position: relative;
146
- }
147
- .chzn-container-multi .chzn-choices li {
148
- float: left;
149
- list-style: none;
150
- }
151
- .chzn-container-multi .chzn-choices .search-field {
152
- white-space: nowrap;
153
- margin: 0;
154
- padding: 0;
155
- }
156
- .chzn-container-multi .chzn-choices .search-field input {
157
- color: #666;
158
- background: transparent !important;
159
- border: 0 !important;
160
- font-family: sans-serif;
161
- font-size: 100%;
162
- height: 15px;
163
- padding: 5px;
164
- margin: 1px 0;
165
- outline: 0;
166
- -webkit-box-shadow: none;
167
- -moz-box-shadow : none;
168
- box-shadow : none;
169
- }
170
- .chzn-container-multi .chzn-choices .search-field .default {
171
- color: #999;
172
- }
173
- .chzn-container-multi .chzn-choices .search-choice {
174
- -webkit-border-radius: 3px;
175
- -moz-border-radius : 3px;
176
- border-radius : 3px;
177
- -moz-background-clip : padding;
178
- -webkit-background-clip: padding-box;
179
- background-clip : padding-box;
180
- background-color: #e4e4e4;
181
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee', GradientType=0 );
182
- background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
183
- background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
184
- background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
185
- background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
186
- background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
187
- -webkit-box-shadow: 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
188
- -moz-box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
189
- box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
190
- color: #333;
191
- border: 1px solid #aaaaaa;
192
- line-height: 13px;
193
- padding: 3px 20px 3px 5px;
194
- margin: 3px 0 3px 5px;
195
- position: relative;
196
- cursor: default;
197
- }
198
- .chzn-container-multi .chzn-choices .search-choice.search-choice-disabled {
199
- background-color: #e4e4e4;
200
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee', GradientType=0 );
201
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
202
- background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
203
- background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
204
- background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
205
- background-image: -ms-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
206
- background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
207
- color: #666;
208
- border: 1px solid #cccccc;
209
- padding-right: 5px;
210
- }
211
- .chzn-container-multi .chzn-choices .search-choice-focus {
212
- background: #d4d4d4;
213
- }
214
- .chzn-container-multi .chzn-choices .search-choice .search-choice-close {
215
- display: block;
216
- position: absolute;
217
- right: 3px;
218
- top: 4px;
219
- width: 12px;
220
- height: 12px;
221
- font-size: 1px;
222
- background: url('chosen-sprite.png') -42px 1px no-repeat;
223
- }
224
- .chzn-container-multi .chzn-choices .search-choice .search-choice-close:hover {
225
- background-position: -42px -10px;
226
- }
227
- .chzn-container-multi .chzn-choices .search-choice-focus .search-choice-close {
228
- background-position: -42px -10px;
229
- }
230
- /* @end */
231
-
232
- /* @group Results */
233
- .chzn-container .chzn-results {
234
- margin: 0 4px 4px 0;
235
- max-height: 240px;
236
- padding: 0 0 0 4px;
237
- position: relative;
238
- overflow-x: hidden;
239
- overflow-y: auto;
240
- -webkit-overflow-scrolling: touch;
241
- }
242
- .chzn-container-multi .chzn-results {
243
- margin: -1px 0 0;
244
- padding: 0;
245
- }
246
- .chzn-container .chzn-results li {
247
- display: none;
248
- line-height: 15px;
249
- padding: 5px 6px;
250
- margin: 0;
251
- list-style: none;
252
- }
253
- .chzn-container .chzn-results .active-result {
254
- cursor: pointer;
255
- display: list-item;
256
- }
257
- .chzn-container .chzn-results .highlighted {
258
- background-color: #3875d7;
259
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3875d7', endColorstr='#2a62bc', GradientType=0 );
260
- background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
261
- background-image: -webkit-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
262
- background-image: -moz-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
263
- background-image: -o-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
264
- background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
265
- color: #fff;
266
- }
267
- .chzn-container .chzn-results li em {
268
- background: #feffde;
269
- font-style: normal;
270
- }
271
- .chzn-container .chzn-results .highlighted em {
272
- background: transparent;
273
- }
274
- .chzn-container .chzn-results .no-results {
275
- background: #f4f4f4;
276
- display: list-item;
277
- }
278
- .chzn-container .chzn-results .group-result {
279
- cursor: default;
280
- color: #999;
281
- font-weight: bold;
282
- }
283
- .chzn-container .chzn-results .group-option {
284
- padding-left: 15px;
285
- }
286
- .chzn-container-multi .chzn-drop .result-selected {
287
- display: none;
288
- }
289
- .chzn-container .chzn-results-scroll {
290
- background: white;
291
- margin: 0 4px;
292
- position: absolute;
293
- text-align: center;
294
- width: 321px; /* This should by dynamic with js */
295
- z-index: 1;
296
- }
297
- .chzn-container .chzn-results-scroll span {
298
- display: inline-block;
299
- height: 17px;
300
- text-indent: -5000px;
301
- width: 9px;
302
- }
303
- .chzn-container .chzn-results-scroll-down {
304
- bottom: 0;
305
- }
306
- .chzn-container .chzn-results-scroll-down span {
307
- background: url('chosen-sprite.png') no-repeat -4px -3px;
308
- }
309
- .chzn-container .chzn-results-scroll-up span {
310
- background: url('chosen-sprite.png') no-repeat -22px -3px;
311
- }
312
- /* @end */
313
-
314
- /* @group Active */
315
- .chzn-container-active .chzn-single {
316
- -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
317
- -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
318
- box-shadow : 0 0 5px rgba(0,0,0,.3);
319
- border: 1px solid #5897fb;
320
- }
321
- .chzn-container-active .chzn-single-with-drop {
322
- border: 1px solid #aaa;
323
- -webkit-box-shadow: 0 1px 0 #fff inset;
324
- -moz-box-shadow : 0 1px 0 #fff inset;
325
- box-shadow : 0 1px 0 #fff inset;
326
- background-color: #eee;
327
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0 );
328
- background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
329
- background-image: -webkit-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
330
- background-image: -moz-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
331
- background-image: -o-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
332
- background-image: linear-gradient(#eeeeee 20%, #ffffff 80%);
333
- -webkit-border-bottom-left-radius : 0;
334
- -webkit-border-bottom-right-radius: 0;
335
- -moz-border-radius-bottomleft : 0;
336
- -moz-border-radius-bottomright: 0;
337
- border-bottom-left-radius : 0;
338
- border-bottom-right-radius: 0;
339
- }
340
- .chzn-container-active .chzn-single-with-drop div {
341
- background: transparent;
342
- border-left: none;
343
- }
344
- .chzn-container-active .chzn-single-with-drop div b {
345
- background-position: -18px 2px;
346
- }
347
- .chzn-container-active .chzn-choices {
348
- -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
349
- -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
350
- box-shadow : 0 0 5px rgba(0,0,0,.3);
351
- border: 1px solid #5897fb;
352
- }
353
- .chzn-container-active .chzn-choices .search-field input {
354
- color: #111 !important;
355
- }
356
- /* @end */
357
-
358
- /* @group Disabled Support */
359
- .chzn-disabled {
360
- cursor: default;
361
- opacity:0.5 !important;
362
- }
363
- .chzn-disabled .chzn-single {
364
- cursor: default;
365
- }
366
- .chzn-disabled .chzn-choices .search-choice .search-choice-close {
367
- cursor: default;
368
- }
369
-
370
- /* @group Right to Left */
371
- .chzn-rtl { text-align: right; }
372
- .chzn-rtl .chzn-single { padding: 0 8px 0 0; overflow: visible; }
373
- .chzn-rtl .chzn-single span { margin-left: 26px; margin-right: 0; direction: rtl; }
374
-
375
- .chzn-rtl .chzn-single div { left: 3px; right: auto; }
376
- .chzn-rtl .chzn-single abbr {
377
- left: 26px;
378
- right: auto;
379
- }
380
- .chzn-rtl .chzn-choices .search-field input { direction: rtl; }
381
- .chzn-rtl .chzn-choices li { float: right; }
382
- .chzn-rtl .chzn-choices .search-choice { padding: 3px 5px 3px 19px; margin: 3px 5px 3px 0; }
383
- .chzn-rtl .chzn-choices .search-choice .search-choice-close { left: 4px; right: auto; }
384
- .chzn-rtl.chzn-container-single .chzn-results { margin: 0 0 4px 4px; padding: 0 4px 0 0; }
385
- .chzn-rtl .chzn-results .group-option { padding-left: 0; padding-right: 15px; }
386
- .chzn-rtl.chzn-container-active .chzn-single-with-drop div { border-right: none; }
387
- .chzn-rtl .chzn-search input {
388
- background: #fff url('chosen-sprite.png') no-repeat -30px -20px;
389
- background: url('chosen-sprite.png') no-repeat -30px -20px, -webkit-gradient(linear, 0 0, 0 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
390
- background: url('chosen-sprite.png') no-repeat -30px -20px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
391
- background: url('chosen-sprite.png') no-repeat -30px -20px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
392
- background: url('chosen-sprite.png') no-repeat -30px -20px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
393
- background: url('chosen-sprite.png') no-repeat -30px -20px, linear-gradient(#eeeeee 1%, #ffffff 15%);
394
- padding: 4px 5px 4px 20px;
395
- direction: rtl;
396
- }
397
- .chzn-container-single.chzn-rtl .chzn-single div b {
398
- background-position: 6px 2px;
399
- }
400
- .chzn-container-single.chzn-rtl .chzn-single-with-drop div b {
401
- background-position: -12px 2px;
402
- }
403
- /* @end */
404
-
405
- /* @group Retina compatibility */
406
- @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi) {
407
- .chzn-rtl .chzn-search input, .chzn-container-single .chzn-single abbr, .chzn-container-single .chzn-single div b, .chzn-container-single .chzn-search input, .chzn-container-multi .chzn-choices .search-choice .search-choice-close, .chzn-container .chzn-results-scroll-down span, .chzn-container .chzn-results-scroll-up span {
408
- background-image: url('chosen-sprite@2x.png') !important;
409
- background-repeat: no-repeat !important;
410
- background-size: 52px 37px !important;
411
- }
412
- }
413
- /* @end */
1
+ /* @group Base */
2
+ .chzn-container {
3
+ font-size: 13px;
4
+ position: relative;
5
+ display: inline-block;
6
+ zoom: 1;
7
+ *display: inline;
8
+ }
9
+ .chzn-container .chzn-drop {
10
+ background: #fff;
11
+ border: 1px solid #aaa;
12
+ border-top: 0;
13
+ position: absolute;
14
+ top: 29px;
15
+ left: 0;
16
+ -webkit-box-shadow: 0 4px 5px rgba(0,0,0,.15);
17
+ -moz-box-shadow : 0 4px 5px rgba(0,0,0,.15);
18
+ box-shadow : 0 4px 5px rgba(0,0,0,.15);
19
+ z-index: 1010;
20
+ }
21
+ /* @end */
22
+
23
+ /* @group Single Chosen */
24
+ .chzn-container-single .chzn-single {
25
+ background-color: #ffffff;
26
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee', GradientType=0 );
27
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
28
+ background-image: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
29
+ background-image: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
30
+ background-image: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
31
+ background-image: linear-gradient(#ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
32
+ -webkit-border-radius: 5px;
33
+ -moz-border-radius : 5px;
34
+ border-radius : 5px;
35
+ -moz-background-clip : padding;
36
+ -webkit-background-clip: padding-box;
37
+ background-clip : padding-box;
38
+ border: 1px solid #aaaaaa;
39
+ -webkit-box-shadow: 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
40
+ -moz-box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
41
+ box-shadow : 0 0 3px #ffffff inset, 0 1px 1px rgba(0,0,0,0.1);
42
+ display: block;
43
+ overflow: hidden;
44
+ white-space: nowrap;
45
+ position: relative;
46
+ height: 23px;
47
+ line-height: 24px;
48
+ padding: 0 0 0 8px;
49
+ color: #444444;
50
+ text-decoration: none;
51
+ }
52
+ .chzn-container-single .chzn-default {
53
+ color: #999;
54
+ }
55
+ .chzn-container-single .chzn-single span {
56
+ margin-right: 26px;
57
+ display: block;
58
+ overflow: hidden;
59
+ white-space: nowrap;
60
+ -o-text-overflow: ellipsis;
61
+ -ms-text-overflow: ellipsis;
62
+ text-overflow: ellipsis;
63
+ }
64
+ .chzn-container-single .chzn-single abbr {
65
+ display: block;
66
+ position: absolute;
67
+ right: 26px;
68
+ top: 6px;
69
+ width: 12px;
70
+ height: 12px;
71
+ font-size: 1px;
72
+ background: url('chosen-sprite.png') -42px 1px no-repeat;
73
+ }
74
+ .chzn-container-single .chzn-single abbr:hover {
75
+ background-position: -42px -10px;
76
+ }
77
+ .chzn-container-single.chzn-disabled .chzn-single abbr:hover {
78
+ background-position: -42px -10px;
79
+ }
80
+ .chzn-container-single .chzn-single div {
81
+ position: absolute;
82
+ right: 0;
83
+ top: 0;
84
+ display: block;
85
+ height: 100%;
86
+ width: 18px;
87
+ }
88
+ .chzn-container-single .chzn-single div b {
89
+ background: url('chosen-sprite.png') no-repeat 0px 2px;
90
+ display: block;
91
+ width: 100%;
92
+ height: 100%;
93
+ }
94
+ .chzn-container-single .chzn-search {
95
+ padding: 3px 4px;
96
+ position: relative;
97
+ margin: 0;
98
+ white-space: nowrap;
99
+ z-index: 1010;
100
+ }
101
+ .chzn-container-single .chzn-search input {
102
+ background: #fff url('chosen-sprite.png') no-repeat 100% -20px;
103
+ background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-gradient(linear, 0 0, 0 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
104
+ background: url('chosen-sprite.png') no-repeat 100% -20px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
105
+ background: url('chosen-sprite.png') no-repeat 100% -20px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
106
+ background: url('chosen-sprite.png') no-repeat 100% -20px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
107
+ background: url('chosen-sprite.png') no-repeat 100% -20px, linear-gradient(#eeeeee 1%, #ffffff 15%);
108
+ margin: 1px 0;
109
+ padding: 4px 20px 4px 5px;
110
+ outline: 0;
111
+ border: 1px solid #aaa;
112
+ font-family: sans-serif;
113
+ font-size: 1em;
114
+ }
115
+ .chzn-container-single .chzn-drop {
116
+ -webkit-border-radius: 0 0 4px 4px;
117
+ -moz-border-radius : 0 0 4px 4px;
118
+ border-radius : 0 0 4px 4px;
119
+ -moz-background-clip : padding;
120
+ -webkit-background-clip: padding-box;
121
+ background-clip : padding-box;
122
+ }
123
+ /* @end */
124
+
125
+ .chzn-container-single-nosearch .chzn-search input {
126
+ position: absolute;
127
+ left: -9000px;
128
+ }
129
+
130
+ /* @group Multi Chosen */
131
+ .chzn-container-multi .chzn-choices {
132
+ background-color: #fff;
133
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
134
+ background-image: -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
135
+ background-image: -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
136
+ background-image: -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
137
+ background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);
138
+ border: 1px solid #aaa;
139
+ margin: 0;
140
+ padding: 0;
141
+ cursor: text;
142
+ overflow: hidden;
143
+ height: auto !important;
144
+ height: 1%;
145
+ position: relative;
146
+ }
147
+ .chzn-container-multi .chzn-choices li {
148
+ float: left;
149
+ list-style: none;
150
+ }
151
+ .chzn-container-multi .chzn-choices .search-field {
152
+ white-space: nowrap;
153
+ margin: 0;
154
+ padding: 0;
155
+ }
156
+ .chzn-container-multi .chzn-choices .search-field input {
157
+ color: #666;
158
+ background: transparent !important;
159
+ border: 0 !important;
160
+ font-family: sans-serif;
161
+ font-size: 100%;
162
+ height: 15px;
163
+ padding: 5px;
164
+ margin: 1px 0;
165
+ outline: 0;
166
+ -webkit-box-shadow: none;
167
+ -moz-box-shadow : none;
168
+ box-shadow : none;
169
+ }
170
+ .chzn-container-multi .chzn-choices .search-field .default {
171
+ color: #999;
172
+ }
173
+ .chzn-container-multi .chzn-choices .search-choice {
174
+ -webkit-border-radius: 3px;
175
+ -moz-border-radius : 3px;
176
+ border-radius : 3px;
177
+ -moz-background-clip : padding;
178
+ -webkit-background-clip: padding-box;
179
+ background-clip : padding-box;
180
+ background-color: #e4e4e4;
181
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee', GradientType=0 );
182
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
183
+ background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
184
+ background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
185
+ background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
186
+ background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
187
+ -webkit-box-shadow: 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
188
+ -moz-box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
189
+ box-shadow : 0 0 2px #ffffff inset, 0 1px 0 rgba(0,0,0,0.05);
190
+ color: #333;
191
+ border: 1px solid #aaaaaa;
192
+ line-height: 13px;
193
+ padding: 3px 20px 3px 5px;
194
+ margin: 3px 0 3px 5px;
195
+ position: relative;
196
+ cursor: default;
197
+ }
198
+ .chzn-container-multi .chzn-choices .search-choice.search-choice-disabled {
199
+ background-color: #e4e4e4;
200
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f4f4', endColorstr='#eeeeee', GradientType=0 );
201
+ background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
202
+ background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
203
+ background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
204
+ background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
205
+ background-image: -ms-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
206
+ background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
207
+ color: #666;
208
+ border: 1px solid #cccccc;
209
+ padding-right: 5px;
210
+ }
211
+ .chzn-container-multi .chzn-choices .search-choice-focus {
212
+ background: #d4d4d4;
213
+ }
214
+ .chzn-container-multi .chzn-choices .search-choice .search-choice-close {
215
+ display: block;
216
+ position: absolute;
217
+ right: 3px;
218
+ top: 4px;
219
+ width: 12px;
220
+ height: 12px;
221
+ font-size: 1px;
222
+ background: url('chosen-sprite.png') -42px 1px no-repeat;
223
+ }
224
+ .chzn-container-multi .chzn-choices .search-choice .search-choice-close:hover {
225
+ background-position: -42px -10px;
226
+ }
227
+ .chzn-container-multi .chzn-choices .search-choice-focus .search-choice-close {
228
+ background-position: -42px -10px;
229
+ }
230
+ /* @end */
231
+
232
+ /* @group Results */
233
+ .chzn-container .chzn-results {
234
+ margin: 0 4px 4px 0;
235
+ max-height: 240px;
236
+ padding: 0 0 0 4px;
237
+ position: relative;
238
+ overflow-x: hidden;
239
+ overflow-y: auto;
240
+ -webkit-overflow-scrolling: touch;
241
+ }
242
+ .chzn-container-multi .chzn-results {
243
+ margin: -1px 0 0;
244
+ padding: 0;
245
+ }
246
+ .chzn-container .chzn-results li {
247
+ display: none;
248
+ line-height: 15px;
249
+ padding: 5px 6px;
250
+ margin: 0;
251
+ list-style: none;
252
+ }
253
+ .chzn-container .chzn-results .active-result {
254
+ cursor: pointer;
255
+ display: list-item;
256
+ }
257
+ .chzn-container .chzn-results .highlighted {
258
+ background-color: #3875d7;
259
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3875d7', endColorstr='#2a62bc', GradientType=0 );
260
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
261
+ background-image: -webkit-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
262
+ background-image: -moz-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
263
+ background-image: -o-linear-gradient(top, #3875d7 20%, #2a62bc 90%);
264
+ background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
265
+ color: #fff;
266
+ }
267
+ .chzn-container .chzn-results li em {
268
+ background: #feffde;
269
+ font-style: normal;
270
+ }
271
+ .chzn-container .chzn-results .highlighted em {
272
+ background: transparent;
273
+ }
274
+ .chzn-container .chzn-results .no-results {
275
+ background: #f4f4f4;
276
+ display: list-item;
277
+ }
278
+ .chzn-container .chzn-results .group-result {
279
+ cursor: default;
280
+ color: #999;
281
+ font-weight: bold;
282
+ }
283
+ .chzn-container .chzn-results .group-option {
284
+ padding-left: 15px;
285
+ }
286
+ .chzn-container-multi .chzn-drop .result-selected {
287
+ display: none;
288
+ }
289
+ .chzn-container .chzn-results-scroll {
290
+ background: white;
291
+ margin: 0 4px;
292
+ position: absolute;
293
+ text-align: center;
294
+ width: 321px; /* This should by dynamic with js */
295
+ z-index: 1;
296
+ }
297
+ .chzn-container .chzn-results-scroll span {
298
+ display: inline-block;
299
+ height: 17px;
300
+ text-indent: -5000px;
301
+ width: 9px;
302
+ }
303
+ .chzn-container .chzn-results-scroll-down {
304
+ bottom: 0;
305
+ }
306
+ .chzn-container .chzn-results-scroll-down span {
307
+ background: url('chosen-sprite.png') no-repeat -4px -3px;
308
+ }
309
+ .chzn-container .chzn-results-scroll-up span {
310
+ background: url('chosen-sprite.png') no-repeat -22px -3px;
311
+ }
312
+ /* @end */
313
+
314
+ /* @group Active */
315
+ .chzn-container-active .chzn-single {
316
+ -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
317
+ -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
318
+ box-shadow : 0 0 5px rgba(0,0,0,.3);
319
+ border: 1px solid #5897fb;
320
+ }
321
+ .chzn-container-active .chzn-single-with-drop {
322
+ border: 1px solid #aaa;
323
+ -webkit-box-shadow: 0 1px 0 #fff inset;
324
+ -moz-box-shadow : 0 1px 0 #fff inset;
325
+ box-shadow : 0 1px 0 #fff inset;
326
+ background-color: #eee;
327
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff', GradientType=0 );
328
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
329
+ background-image: -webkit-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
330
+ background-image: -moz-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
331
+ background-image: -o-linear-gradient(top, #eeeeee 20%, #ffffff 80%);
332
+ background-image: linear-gradient(#eeeeee 20%, #ffffff 80%);
333
+ -webkit-border-bottom-left-radius : 0;
334
+ -webkit-border-bottom-right-radius: 0;
335
+ -moz-border-radius-bottomleft : 0;
336
+ -moz-border-radius-bottomright: 0;
337
+ border-bottom-left-radius : 0;
338
+ border-bottom-right-radius: 0;
339
+ }
340
+ .chzn-container-active .chzn-single-with-drop div {
341
+ background: transparent;
342
+ border-left: none;
343
+ }
344
+ .chzn-container-active .chzn-single-with-drop div b {
345
+ background-position: -18px 2px;
346
+ }
347
+ .chzn-container-active .chzn-choices {
348
+ -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
349
+ -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
350
+ box-shadow : 0 0 5px rgba(0,0,0,.3);
351
+ border: 1px solid #5897fb;
352
+ }
353
+ .chzn-container-active .chzn-choices .search-field input {
354
+ color: #111 !important;
355
+ }
356
+ /* @end */
357
+
358
+ /* @group Disabled Support */
359
+ .chzn-disabled {
360
+ cursor: default;
361
+ opacity:0.5 !important;
362
+ }
363
+ .chzn-disabled .chzn-single {
364
+ cursor: default;
365
+ }
366
+ .chzn-disabled .chzn-choices .search-choice .search-choice-close {
367
+ cursor: default;
368
+ }
369
+
370
+ /* @group Right to Left */
371
+ .chzn-rtl { text-align: right; }
372
+ .chzn-rtl .chzn-single { padding: 0 8px 0 0; overflow: visible; }
373
+ .chzn-rtl .chzn-single span { margin-left: 26px; margin-right: 0; direction: rtl; }
374
+
375
+ .chzn-rtl .chzn-single div { left: 3px; right: auto; }
376
+ .chzn-rtl .chzn-single abbr {
377
+ left: 26px;
378
+ right: auto;
379
+ }
380
+ .chzn-rtl .chzn-choices .search-field input { direction: rtl; }
381
+ .chzn-rtl .chzn-choices li { float: right; }
382
+ .chzn-rtl .chzn-choices .search-choice { padding: 3px 5px 3px 19px; margin: 3px 5px 3px 0; }
383
+ .chzn-rtl .chzn-choices .search-choice .search-choice-close { left: 4px; right: auto; }
384
+ .chzn-rtl.chzn-container-single .chzn-results { margin: 0 0 4px 4px; padding: 0 4px 0 0; }
385
+ .chzn-rtl .chzn-results .group-option { padding-left: 0; padding-right: 15px; }
386
+ .chzn-rtl.chzn-container-active .chzn-single-with-drop div { border-right: none; }
387
+ .chzn-rtl .chzn-search input {
388
+ background: #fff url('chosen-sprite.png') no-repeat -30px -20px;
389
+ background: url('chosen-sprite.png') no-repeat -30px -20px, -webkit-gradient(linear, 0 0, 0 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
390
+ background: url('chosen-sprite.png') no-repeat -30px -20px, -webkit-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
391
+ background: url('chosen-sprite.png') no-repeat -30px -20px, -moz-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
392
+ background: url('chosen-sprite.png') no-repeat -30px -20px, -o-linear-gradient(top, #eeeeee 1%, #ffffff 15%);
393
+ background: url('chosen-sprite.png') no-repeat -30px -20px, linear-gradient(#eeeeee 1%, #ffffff 15%);
394
+ padding: 4px 5px 4px 20px;
395
+ direction: rtl;
396
+ }
397
+ .chzn-container-single.chzn-rtl .chzn-single div b {
398
+ background-position: 6px 2px;
399
+ }
400
+ .chzn-container-single.chzn-rtl .chzn-single-with-drop div b {
401
+ background-position: -12px 2px;
402
+ }
403
+ /* @end */
404
+
405
+ /* @group Retina compatibility */
406
+ @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi) {
407
+ .chzn-rtl .chzn-search input, .chzn-container-single .chzn-single abbr, .chzn-container-single .chzn-single div b, .chzn-container-single .chzn-search input, .chzn-container-multi .chzn-choices .search-choice .search-choice-close, .chzn-container .chzn-results-scroll-down span, .chzn-container .chzn-results-scroll-up span {
408
+ background-image: url('chosen-sprite@2x.png') !important;
409
+ background-repeat: no-repeat !important;
410
+ background-size: 52px 37px !important;
411
+ }
412
+ }
413
+ /* @end */
assets/js/chosen/chosen.jquery.js CHANGED
@@ -1,1090 +1,1090 @@
1
- // Chosen, a Select Box Enhancer for jQuery and Protoype
2
- // by Patrick Filler for Harvest, http://getharvest.com
3
- //
4
- // Version 0.9.12
5
- // Full source at https://github.com/harvesthq/chosen
6
- // Copyright (c) 2011 Harvest http://getharvest.com
7
-
8
- // MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
9
- // This file is generated by `cake build`, do not edit it by hand.
10
- (function() {
11
- var SelectParser;
12
-
13
- SelectParser = (function() {
14
-
15
- function SelectParser() {
16
- this.options_index = 0;
17
- this.parsed = [];
18
- }
19
-
20
- SelectParser.prototype.add_node = function(child) {
21
- if (child.nodeName.toUpperCase() === "OPTGROUP") {
22
- return this.add_group(child);
23
- } else {
24
- return this.add_option(child);
25
- }
26
- };
27
-
28
- SelectParser.prototype.add_group = function(group) {
29
- var group_position, option, _i, _len, _ref, _results;
30
- group_position = this.parsed.length;
31
- this.parsed.push({
32
- array_index: group_position,
33
- group: true,
34
- label: group.label,
35
- children: 0,
36
- disabled: group.disabled
37
- });
38
- _ref = group.childNodes;
39
- _results = [];
40
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
41
- option = _ref[_i];
42
- _results.push(this.add_option(option, group_position, group.disabled));
43
- }
44
- return _results;
45
- };
46
-
47
- SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
48
- if (option.nodeName.toUpperCase() === "OPTION") {
49
- if (option.text !== "") {
50
- if (group_position != null) {
51
- this.parsed[group_position].children += 1;
52
- }
53
- this.parsed.push({
54
- array_index: this.parsed.length,
55
- options_index: this.options_index,
56
- value: option.value,
57
- text: option.text,
58
- html: option.innerHTML,
59
- selected: option.selected,
60
- disabled: group_disabled === true ? group_disabled : option.disabled,
61
- group_array_index: group_position,
62
- classes: option.className,
63
- style: option.style.cssText
64
- });
65
- } else {
66
- this.parsed.push({
67
- array_index: this.parsed.length,
68
- options_index: this.options_index,
69
- empty: true
70
- });
71
- }
72
- return this.options_index += 1;
73
- }
74
- };
75
-
76
- return SelectParser;
77
-
78
- })();
79
-
80
- SelectParser.select_to_array = function(select) {
81
- var child, parser, _i, _len, _ref;
82
- parser = new SelectParser();
83
- _ref = select.childNodes;
84
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
85
- child = _ref[_i];
86
- parser.add_node(child);
87
- }
88
- return parser.parsed;
89
- };
90
-
91
- this.SelectParser = SelectParser;
92
-
93
- }).call(this);
94
-
95
- /*
96
- Chosen source: generate output using 'cake build'
97
- Copyright (c) 2011 by Harvest
98
- */
99
-
100
-
101
- (function() {
102
- var AbstractChosen, root;
103
-
104
- root = this;
105
-
106
- AbstractChosen = (function() {
107
-
108
- function AbstractChosen(form_field, options) {
109
- this.form_field = form_field;
110
- this.options = options != null ? options : {};
111
- this.is_multiple = this.form_field.multiple;
112
- this.set_default_text();
113
- this.set_default_values();
114
- this.setup();
115
- this.set_up_html();
116
- this.register_observers();
117
- this.finish_setup();
118
- }
119
-
120
- AbstractChosen.prototype.set_default_values = function() {
121
- var _this = this;
122
- this.click_test_action = function(evt) {
123
- return _this.test_active_click(evt);
124
- };
125
- this.activate_action = function(evt) {
126
- return _this.activate_field(evt);
127
- };
128
- this.active_field = false;
129
- this.mouse_on_container = false;
130
- this.results_showing = false;
131
- this.result_highlighted = null;
132
- this.result_single_selected = null;
133
- this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
134
- this.disable_search_threshold = this.options.disable_search_threshold || 0;
135
- this.disable_search = this.options.disable_search || false;
136
- this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
137
- this.search_contains = this.options.search_contains || false;
138
- this.choices = 0;
139
- this.single_backstroke_delete = this.options.single_backstroke_delete || false;
140
- this.max_selected_options = this.options.max_selected_options || Infinity;
141
- return this.inherit_select_classes = this.options.inherit_select_classes || false;
142
- };
143
-
144
- AbstractChosen.prototype.set_default_text = function() {
145
- if (this.form_field.getAttribute("data-placeholder")) {
146
- this.default_text = this.form_field.getAttribute("data-placeholder");
147
- } else if (this.is_multiple) {
148
- this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || "Select Some Options";
149
- } else {
150
- this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || "Select an Option";
151
- }
152
- return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || "No results match";
153
- };
154
-
155
- AbstractChosen.prototype.mouse_enter = function() {
156
- return this.mouse_on_container = true;
157
- };
158
-
159
- AbstractChosen.prototype.mouse_leave = function() {
160
- return this.mouse_on_container = false;
161
- };
162
-
163
- AbstractChosen.prototype.input_focus = function(evt) {
164
- var _this = this;
165
- if (this.is_multiple) {
166
- if (!this.active_field) {
167
- return setTimeout((function() {
168
- return _this.container_mousedown();
169
- }), 50);
170
- }
171
- } else {
172
- if (!this.active_field) {
173
- return this.activate_field();
174
- }
175
- }
176
- };
177
-
178
- AbstractChosen.prototype.input_blur = function(evt) {
179
- var _this = this;
180
- if (!this.mouse_on_container) {
181
- this.active_field = false;
182
- return setTimeout((function() {
183
- return _this.blur_test();
184
- }), 100);
185
- }
186
- };
187
-
188
- AbstractChosen.prototype.result_add_option = function(option) {
189
- var classes, style;
190
- if (!option.disabled) {
191
- option.dom_id = this.container_id + "_o_" + option.array_index;
192
- classes = option.selected && this.is_multiple ? [] : ["active-result"];
193
- if (option.selected) {
194
- classes.push("result-selected");
195
- }
196
- if (option.group_array_index != null) {
197
- classes.push("group-option");
198
- }
199
- if (option.classes !== "") {
200
- classes.push(option.classes);
201
- }
202
- style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : "";
203
- return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '"' + style + '>' + option.html + '</li>';
204
- } else {
205
- return "";
206
- }
207
- };
208
-
209
- AbstractChosen.prototype.results_update_field = function() {
210
- this.set_default_text();
211
- if (!this.is_multiple) {
212
- this.results_reset_cleanup();
213
- }
214
- this.result_clear_highlight();
215
- this.result_single_selected = null;
216
- return this.results_build();
217
- };
218
-
219
- AbstractChosen.prototype.results_toggle = function() {
220
- if (this.results_showing) {
221
- return this.results_hide();
222
- } else {
223
- return this.results_show();
224
- }
225
- };
226
-
227
- AbstractChosen.prototype.results_search = function(evt) {
228
- if (this.results_showing) {
229
- return this.winnow_results();
230
- } else {
231
- return this.results_show();
232
- }
233
- };
234
-
235
- AbstractChosen.prototype.keyup_checker = function(evt) {
236
- var stroke, _ref;
237
- stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
238
- this.search_field_scale();
239
- switch (stroke) {
240
- case 8:
241
- if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) {
242
- return this.keydown_backstroke();
243
- } else if (!this.pending_backstroke) {
244
- this.result_clear_highlight();
245
- return this.results_search();
246
- }
247
- break;
248
- case 13:
249
- evt.preventDefault();
250
- if (this.results_showing) {
251
- return this.result_select(evt);
252
- }
253
- break;
254
- case 27:
255
- if (this.results_showing) {
256
- this.results_hide();
257
- }
258
- return true;
259
- case 9:
260
- case 38:
261
- case 40:
262
- case 16:
263
- case 91:
264
- case 17:
265
- break;
266
- default:
267
- return this.results_search();
268
- }
269
- };
270
-
271
- AbstractChosen.prototype.generate_field_id = function() {
272
- var new_id;
273
- new_id = this.generate_random_id();
274
- this.form_field.id = new_id;
275
- return new_id;
276
- };
277
-
278
- AbstractChosen.prototype.generate_random_char = function() {
279
- var chars, newchar, rand;
280
- chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
281
- rand = Math.floor(Math.random() * chars.length);
282
- return newchar = chars.substring(rand, rand + 1);
283
- };
284
-
285
- return AbstractChosen;
286
-
287
- })();
288
-
289
- root.AbstractChosen = AbstractChosen;
290
-
291
- }).call(this);
292
-
293
- /*
294
- Chosen source: generate output using 'cake build'
295
- Copyright (c) 2011 by Harvest
296
- */
297
-
298
-
299
- (function() {
300
- var $, Chosen, get_side_border_padding, root,
301
- __hasProp = {}.hasOwnProperty,
302
- __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
303
-
304
- root = this;
305
-
306
- $ = jQuery;
307
-
308
- $.fn.extend({
309
- chosen: function(options) {
310
- var browser, match, ua;
311
- ua = navigator.userAgent.toLowerCase();
312
- match = /(msie) ([\w.]+)/.exec(ua) || [];
313
- browser = {
314
- name: match[1] || "",
315
- version: match[2] || "0"
316
- };
317
- if (browser.name === "msie" && (browser.version === "6.0" || (browser.version === "7.0" && document.documentMode === 7))) {
318
- return this;
319
- }
320
- return this.each(function(input_field) {
321
- var $this;
322
- $this = $(this);
323
- if (!$this.hasClass("chzn-done")) {
324
- return $this.data('chosen', new Chosen(this, options));
325
- }
326
- });
327
- }
328
- });
329
-
330
- Chosen = (function(_super) {
331
-
332
- __extends(Chosen, _super);
333
-
334
- function Chosen() {
335
- return Chosen.__super__.constructor.apply(this, arguments);
336
- }
337
-
338
- Chosen.prototype.setup = function() {
339
- this.form_field_jq = $(this.form_field);
340
- this.current_value = this.form_field_jq.val();
341
- return this.is_rtl = this.form_field_jq.hasClass("chzn-rtl");
342
- };
343
-
344
- Chosen.prototype.finish_setup = function() {
345
- return this.form_field_jq.addClass("chzn-done");
346
- };
347
-
348
- Chosen.prototype.set_up_html = function() {
349
- var container_classes, container_div, container_props, dd_top, dd_width, sf_width;
350
- this.container_id = this.form_field.id.length ? this.form_field.id.replace(/[^\w]/g, '_') : this.generate_field_id();
351
- this.container_id += "_chzn";
352
- container_classes = ["chzn-container"];
353
- container_classes.push("chzn-container-" + (this.is_multiple ? "multi" : "single"));
354
- if (this.inherit_select_classes && this.form_field.className) {
355
- container_classes.push(this.form_field.className);
356
- }
357
- if (this.is_rtl) {
358
- container_classes.push("chzn-rtl");
359
- }
360
- this.f_width = this.form_field_jq.outerWidth();
361
- container_props = {
362
- id: this.container_id,
363
- "class": container_classes.join(' '),
364
- style: 'width: ' + this.f_width + 'px;',
365
- title: this.form_field.title
366
- };
367
- container_div = $("<div />", container_props);
368
- if (this.is_multiple) {
369
- container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
370
- } else {
371
- container_div.html('<a href="javascript:void(0)" class="chzn-single chzn-default" tabindex="-1"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');
372
- }
373
- this.form_field_jq.hide().after(container_div);
374
- this.container = $('#' + this.container_id);
375
- this.dropdown = this.container.find('div.chzn-drop').first();
376
- dd_top = this.container.height();
377
- dd_width = this.f_width - get_side_border_padding(this.dropdown);
378
- this.dropdown.css({
379
- "width": dd_width + "px",
380
- "top": dd_top + "px"
381
- });
382
- this.search_field = this.container.find('input').first();
383
- this.search_results = this.container.find('ul.chzn-results').first();
384
- this.search_field_scale();
385
- this.search_no_results = this.container.find('li.no-results').first();
386
- if (this.is_multiple) {
387
- this.search_choices = this.container.find('ul.chzn-choices').first();
388
- this.search_container = this.container.find('li.search-field').first();
389
- } else {
390
- this.search_container = this.container.find('div.chzn-search').first();
391
- this.selected_item = this.container.find('.chzn-single').first();
392
- sf_width = dd_width - get_side_border_padding(this.search_container) - get_side_border_padding(this.search_field);
393
- this.search_field.css({
394
- "width": sf_width + "px"
395
- });
396
- }
397
- this.results_build();
398
- this.set_tab_index();
399
- return this.form_field_jq.trigger("liszt:ready", {
400
- chosen: this
401
- });
402
- };
403
-
404
- Chosen.prototype.register_observers = function() {
405
- var _this = this;
406
- this.container.mousedown(function(evt) {
407
- _this.container_mousedown(evt);
408
- });
409
- this.container.mouseup(function(evt) {
410
- _this.container_mouseup(evt);
411
- });
412
- this.container.mouseenter(function(evt) {
413
- _this.mouse_enter(evt);
414
- });
415
- this.container.mouseleave(function(evt) {
416
- _this.mouse_leave(evt);
417
- });
418
- this.search_results.mouseup(function(evt) {
419
- _this.search_results_mouseup(evt);
420
- });
421
- this.search_results.mouseover(function(evt) {
422
- _this.search_results_mouseover(evt);
423
- });
424
- this.search_results.mouseout(function(evt) {
425
- _this.search_results_mouseout(evt);
426
- });
427
- this.form_field_jq.bind("liszt:updated", function(evt) {
428
- _this.results_update_field(evt);
429
- });
430
- this.form_field_jq.bind("liszt:activate", function(evt) {
431
- _this.activate_field(evt);
432
- });
433
- this.form_field_jq.bind("liszt:open", function(evt) {
434
- _this.container_mousedown(evt);
435
- });
436
- this.search_field.blur(function(evt) {
437
- _this.input_blur(evt);
438
- });
439
- this.search_field.keyup(function(evt) {
440
- _this.keyup_checker(evt);
441
- });
442
- this.search_field.keydown(function(evt) {
443
- _this.keydown_checker(evt);
444
- });
445
- this.search_field.focus(function(evt) {
446
- _this.input_focus(evt);
447
- });
448
- if (this.is_multiple) {
449
- return this.search_choices.click(function(evt) {
450
- _this.choices_click(evt);
451
- });
452
- } else {
453
- return this.container.click(function(evt) {
454
- evt.preventDefault();
455
- });
456
- }
457
- };
458
-
459
- Chosen.prototype.search_field_disabled = function() {
460
- this.is_disabled = this.form_field_jq[0].disabled;
461
- if (this.is_disabled) {
462
- this.container.addClass('chzn-disabled');
463
- this.search_field[0].disabled = true;
464
- if (!this.is_multiple) {
465
- this.selected_item.unbind("focus", this.activate_action);
466
- }
467
- return this.close_field();
468
- } else {
469
- this.container.removeClass('chzn-disabled');
470
- this.search_field[0].disabled = false;
471
- if (!this.is_multiple) {
472
- return this.selected_item.bind("focus", this.activate_action);
473
- }
474
- }
475
- };
476
-
477
- Chosen.prototype.container_mousedown = function(evt) {
478
- var target_closelink;
479
- if (!this.is_disabled) {
480
- target_closelink = evt != null ? ($(evt.target)).hasClass("search-choice-close") : false;
481
- if (evt && evt.type === "mousedown" && !this.results_showing) {
482
- evt.preventDefault();
483
- }
484
- if (!this.pending_destroy_click && !target_closelink) {
485
- if (!this.active_field) {
486
- if (this.is_multiple) {
487
- this.search_field.val("");
488
- }
489
- $(document).click(this.click_test_action);
490
- this.results_show();
491
- } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chzn-single").length)) {
492
- evt.preventDefault();
493
- this.results_toggle();
494
- }
495
- return this.activate_field();
496
- } else {
497
- return this.pending_destroy_click = false;
498
- }
499
- }
500
- };
501
-
502
- Chosen.prototype.container_mouseup = function(evt) {
503
- if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
504
- return this.results_reset(evt);
505
- }
506
- };
507
-
508
- Chosen.prototype.blur_test = function(evt) {
509
- if (!this.active_field && this.container.hasClass("chzn-container-active")) {
510
- return this.close_field();
511
- }
512
- };
513
-
514
- Chosen.prototype.close_field = function() {
515
- $(document).unbind("click", this.click_test_action);
516
- this.active_field = false;
517
- this.results_hide();
518
- this.container.removeClass("chzn-container-active");
519
- this.winnow_results_clear();
520
- this.clear_backstroke();
521
- this.show_search_field_default();
522
- return this.search_field_scale();
523
- };
524
-
525
- Chosen.prototype.activate_field = function() {
526
- this.container.addClass("chzn-container-active");
527
- this.active_field = true;
528
- this.search_field.val(this.search_field.val());
529
- return this.search_field.focus();
530
- };
531
-
532
- Chosen.prototype.test_active_click = function(evt) {
533
- if ($(evt.target).parents('#' + this.container_id).length) {
534
- return this.active_field = true;
535
- } else {
536
- return this.close_field();
537
- }
538
- };
539
-
540
- Chosen.prototype.results_build = function() {
541
- var content, data, _i, _len, _ref;
542
- this.parsing = true;
543
- this.results_data = root.SelectParser.select_to_array(this.form_field);
544
- if (this.is_multiple && this.choices > 0) {
545
- this.search_choices.find("li.search-choice").remove();
546
- this.choices = 0;
547
- } else if (!this.is_multiple) {
548
- this.selected_item.addClass("chzn-default").find("span").text(this.default_text);
549
- if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
550
- this.container.addClass("chzn-container-single-nosearch");
551
- } else {
552
- this.container.removeClass("chzn-container-single-nosearch");
553
- }
554
- }
555
- content = '';
556
- _ref = this.results_data;
557
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
558
- data = _ref[_i];
559
- if (data.group) {
560
- content += this.result_add_group(data);
561
- } else if (!data.empty) {
562
- content += this.result_add_option(data);
563
- if (data.selected && this.is_multiple) {
564
- this.choice_build(data);
565
- } else if (data.selected && !this.is_multiple) {
566
- this.selected_item.removeClass("chzn-default").find("span").text(data.text);
567
- if (this.allow_single_deselect) {
568
- this.single_deselect_control_build();
569
- }
570
- }
571
- }
572
- }
573
- this.search_field_disabled();
574
- this.show_search_field_default();
575
- this.search_field_scale();
576
- this.search_results.html(content);
577
- return this.parsing = false;
578
- };
579
-
580
- Chosen.prototype.result_add_group = function(group) {
581
- if (!group.disabled) {
582
- group.dom_id = this.container_id + "_g_" + group.array_index;
583
- return '<li id="' + group.dom_id + '" class="group-result">' + $("<div />").text(group.label).html() + '</li>';
584
- } else {
585
- return "";
586
- }
587
- };
588
-
589
- Chosen.prototype.result_do_highlight = function(el) {
590
- var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
591
- if (el.length) {
592
- this.result_clear_highlight();
593
- this.result_highlight = el;
594
- this.result_highlight.addClass("highlighted");
595
- maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
596
- visible_top = this.search_results.scrollTop();
597
- visible_bottom = maxHeight + visible_top;
598
- high_top = this.result_highlight.position().top + this.search_results.scrollTop();
599
- high_bottom = high_top + this.result_highlight.outerHeight();
600
- if (high_bottom >= visible_bottom) {
601
- return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
602
- } else if (high_top < visible_top) {
603
- return this.search_results.scrollTop(high_top);
604
- }
605
- }
606
- };
607
-
608
- Chosen.prototype.result_clear_highlight = function() {
609
- if (this.result_highlight) {
610
- this.result_highlight.removeClass("highlighted");
611
- }
612
- return this.result_highlight = null;
613
- };
614
-
615
- Chosen.prototype.results_show = function() {
616
- var dd_top;
617
- if (!this.is_multiple) {
618
- this.selected_item.addClass("chzn-single-with-drop");
619
- if (this.result_single_selected) {
620
- this.result_do_highlight(this.result_single_selected);
621
- }
622
- } else if (this.max_selected_options <= this.choices) {
623
- this.form_field_jq.trigger("liszt:maxselected", {
624
- chosen: this
625
- });
626
- return false;
627
- }
628
- dd_top = this.is_multiple ? this.container.height() : this.container.height() - 1;
629
- this.form_field_jq.trigger("liszt:showing_dropdown", {
630
- chosen: this
631
- });
632
- this.dropdown.css({
633
- "top": dd_top + "px",
634
- "left": 0
635
- });
636
- this.results_showing = true;
637
- this.search_field.focus();
638
- this.search_field.val(this.search_field.val());
639
- return this.winnow_results();
640
- };
641
-
642
- Chosen.prototype.results_hide = function() {
643
- if (!this.is_multiple) {
644
- this.selected_item.removeClass("chzn-single-with-drop");
645
- }
646
- this.result_clear_highlight();
647
- this.form_field_jq.trigger("liszt:hiding_dropdown", {
648
- chosen: this
649
- });
650
- this.dropdown.css({
651
- "left": "-9000px"
652
- });
653
- return this.results_showing = false;
654
- };
655
-
656
- Chosen.prototype.set_tab_index = function(el) {
657
- var ti;
658
- if (this.form_field_jq.attr("tabindex")) {
659
- ti = this.form_field_jq.attr("tabindex");
660
- this.form_field_jq.attr("tabindex", -1);
661
- return this.search_field.attr("tabindex", ti);
662
- }
663
- };
664
-
665
- Chosen.prototype.show_search_field_default = function() {
666
- if (this.is_multiple && this.choices < 1 && !this.active_field) {
667
- this.search_field.val(this.default_text);
668
- return this.search_field.addClass("default");
669
- } else {
670
- this.search_field.val("");
671
- return this.search_field.removeClass("default");
672
- }
673
- };
674
-
675
- Chosen.prototype.search_results_mouseup = function(evt) {
676
- var target;
677
- target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
678
- if (target.length) {
679
- this.result_highlight = target;
680
- this.result_select(evt);
681
- return this.search_field.focus();
682
- }
683
- };
684
-
685
- Chosen.prototype.search_results_mouseover = function(evt) {
686
- var target;
687
- target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
688
- if (target) {
689
- return this.result_do_highlight(target);
690
- }
691
- };
692
-
693
- Chosen.prototype.search_results_mouseout = function(evt) {
694
- if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
695
- return this.result_clear_highlight();
696
- }
697
- };
698
-
699
- Chosen.prototype.choices_click = function(evt) {
700
- evt.preventDefault();
701
- if (this.active_field && !($(evt.target).hasClass("search-choice" || $(evt.target).parents('.search-choice').first)) && !this.results_showing) {
702
- return this.results_show();
703
- }
704
- };
705
-
706
- Chosen.prototype.choice_build = function(item) {
707
- var choice_id, html, link,
708
- _this = this;
709
- if (this.is_multiple && this.max_selected_options <= this.choices) {
710
- this.form_field_jq.trigger("liszt:maxselected", {
711
- chosen: this
712
- });
713
- return false;
714
- }
715
- choice_id = this.container_id + "_c_" + item.array_index;
716
- this.choices += 1;
717
- if (item.disabled) {
718
- html = '<li class="search-choice search-choice-disabled" id="' + choice_id + '"><span>' + item.html + '</span></li>';
719
- } else {
720
- html = '<li class="search-choice" id="' + choice_id + '"><span>' + item.html + '</span><a href="javascript:void(0)" class="search-choice-close" rel="' + item.array_index + '"></a></li>';
721
- }
722
- this.search_container.before(html);
723
- link = $('#' + choice_id).find("a").first();
724
- return link.click(function(evt) {
725
- return _this.choice_destroy_link_click(evt);
726
- });
727
- };
728
-
729
- Chosen.prototype.choice_destroy_link_click = function(evt) {
730
- evt.preventDefault();
731
- if (!this.is_disabled) {
732
- this.pending_destroy_click = true;
733
- return this.choice_destroy($(evt.target));
734
- } else {
735
- return evt.stopPropagation;
736
- }
737
- };
738
-
739
- Chosen.prototype.choice_destroy = function(link) {
740
- if (this.result_deselect(link.attr("rel"))) {
741
- this.choices -= 1;
742
- this.show_search_field_default();
743
- if (this.is_multiple && this.choices > 0 && this.search_field.val().length < 1) {
744
- this.results_hide();
745
- }
746
- link.parents('li').first().remove();
747
- return this.search_field_scale();
748
- }
749
- };
750
-
751
- Chosen.prototype.results_reset = function() {
752
- this.form_field.options[0].selected = true;
753
- this.selected_item.find("span").text(this.default_text);
754
- if (!this.is_multiple) {
755
- this.selected_item.addClass("chzn-default");
756
- }
757
- this.show_search_field_default();
758
- this.results_reset_cleanup();
759
- this.form_field_jq.trigger("change");
760
- if (this.active_field) {
761
- return this.results_hide();
762
- }
763
- };
764
-
765
- Chosen.prototype.results_reset_cleanup = function() {
766
- this.current_value = this.form_field_jq.val();
767
- return this.selected_item.find("abbr").remove();
768
- };
769
-
770
- Chosen.prototype.result_select = function(evt) {
771
- var high, high_id, item, position;
772
- if (this.result_highlight) {
773
- high = this.result_highlight;
774
- high_id = high.attr("id");
775
- this.result_clear_highlight();
776
- if (this.is_multiple) {
777
- this.result_deactivate(high);
778
- } else {
779
- this.search_results.find(".result-selected").removeClass("result-selected");
780
- this.result_single_selected = high;
781
- this.selected_item.removeClass("chzn-default");
782
- }
783
- high.addClass("result-selected");
784
- position = high_id.substr(high_id.lastIndexOf("_") + 1);
785
- item = this.results_data[position];
786
- item.selected = true;
787
- this.form_field.options[item.options_index].selected = true;
788
- if (this.is_multiple) {
789
- this.choice_build(item);
790
- } else {
791
- this.selected_item.find("span").first().text(item.text);
792
- if (this.allow_single_deselect) {
793
- this.single_deselect_control_build();
794
- }
795
- }
796
- if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
797
- this.results_hide();
798
- }
799
- this.search_field.val("");
800
- if (this.is_multiple || this.form_field_jq.val() !== this.current_value) {
801
- this.form_field_jq.trigger("change", {
802
- 'selected': this.form_field.options[item.options_index].value
803
- });
804
- }
805
- this.current_value = this.form_field_jq.val();
806
- return this.search_field_scale();
807
- }
808
- };
809
-
810
- Chosen.prototype.result_activate = function(el) {
811
- return el.addClass("active-result");
812
- };
813
-
814
- Chosen.prototype.result_deactivate = function(el) {
815
- return el.removeClass("active-result");
816
- };
817
-
818
- Chosen.prototype.result_deselect = function(pos) {
819
- var result, result_data;
820
- result_data = this.results_data[pos];
821
- if (!this.form_field.options[result_data.options_index].disabled) {
822
- result_data.selected = false;
823
- this.form_field.options[result_data.options_index].selected = false;
824
- result = $("#" + this.container_id + "_o_" + pos);
825
- result.removeClass("result-selected").addClass("active-result").show();
826
- this.result_clear_highlight();
827
- this.winnow_results();
828
- this.form_field_jq.trigger("change", {
829
- deselected: this.form_field.options[result_data.options_index].value
830
- });
831
- this.search_field_scale();
832
- return true;
833
- } else {
834
- return false;
835
- }
836
- };
837
-
838
- Chosen.prototype.single_deselect_control_build = function() {
839
- if (this.allow_single_deselect && this.selected_item.find("abbr").length < 1) {
840
- return this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
841
- }
842
- };
843
-
844
- Chosen.prototype.winnow_results = function() {
845
- var found, option, part, parts, regex, regexAnchor, result, result_id, results, searchText, startpos, text, zregex, _i, _j, _len, _len1, _ref;
846
- this.no_results_clear();
847
- results = 0;
848
- searchText = this.search_field.val() === this.default_text ? "" : $('<div/>').text($.trim(this.search_field.val())).html();
849
- regexAnchor = this.search_contains ? "" : "^";
850
- regex = new RegExp(regexAnchor + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
851
- zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
852
- _ref = this.results_data;
853
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
854
- option = _ref[_i];
855
- if (!option.disabled && !option.empty) {
856
- if (option.group) {
857
- $('#' + option.dom_id).css('display', 'none');
858
- } else if (!(this.is_multiple && option.selected)) {
859
- found = false;
860
- result_id = option.dom_id;
861
- result = $("#" + result_id);
862
- if (regex.test(option.html)) {
863
- found = true;
864
- results += 1;
865
- } else if (this.enable_split_word_search && (option.html.indexOf(" ") >= 0 || option.html.indexOf("[") === 0)) {
866
- parts = option.html.replace(/\[|\]/g, "").split(" ");
867
- if (parts.length) {
868
- for (_j = 0, _len1 = parts.length; _j < _len1; _j++) {
869
- part = parts[_j];
870
- if (regex.test(part)) {
871
- found = true;
872
- results += 1;
873
- }
874
- }
875
- }
876
- }
877
- if (found) {
878
- if (searchText.length) {
879
- startpos = option.html.search(zregex);
880
- text = option.html.substr(0, startpos + searchText.length) + '</em>' + option.html.substr(startpos + searchText.length);
881
- text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
882
- } else {
883
- text = option.html;
884
- }
885
- result.html(text);
886
- this.result_activate(result);
887
- if (option.group_array_index != null) {
888
- $("#" + this.results_data[option.group_array_index].dom_id).css('display', 'list-item');
889
- }
890
- } else {
891
- if (this.result_highlight && result_id === this.result_highlight.attr('id')) {
892
- this.result_clear_highlight();
893
- }
894
- this.result_deactivate(result);
895
- }
896
- }
897
- }
898
- }
899
- if (results < 1 && searchText.length) {
900
- return this.no_results(searchText);
901
- } else {
902
- return this.winnow_results_set_highlight();
903
- }
904
- };
905
-
906
- Chosen.prototype.winnow_results_clear = function() {
907
- var li, lis, _i, _len, _results;
908
- this.search_field.val("");
909
- lis = this.search_results.find("li");
910
- _results = [];
911
- for (_i = 0, _len = lis.length; _i < _len; _i++) {
912
- li = lis[_i];
913
- li = $(li);
914
- if (li.hasClass("group-result")) {
915
- _results.push(li.css('display', 'auto'));
916
- } else if (!this.is_multiple || !li.hasClass("result-selected")) {
917
- _results.push(this.result_activate(li));
918
- } else {
919
- _results.push(void 0);
920
- }
921
- }
922
- return _results;
923
- };
924
-
925
- Chosen.prototype.winnow_results_set_highlight = function() {
926
- var do_high, selected_results;
927
- if (!this.result_highlight) {
928
- selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
929
- do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
930
- if (do_high != null) {
931
- return this.result_do_highlight(do_high);
932
- }
933
- }
934
- };
935
-
936
- Chosen.prototype.no_results = function(terms) {
937
- var no_results_html;
938
- no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
939
- no_results_html.find("span").first().html(terms);
940
- return this.search_results.append(no_results_html);
941
- };
942
-
943
- Chosen.prototype.no_results_clear = function() {
944
- return this.search_results.find(".no-results").remove();
945
- };
946
-
947
- Chosen.prototype.keydown_arrow = function() {
948
- var first_active, next_sib;
949
- if (!this.result_highlight) {
950
- first_active = this.search_results.find("li.active-result").first();
951
- if (first_active) {
952
- this.result_do_highlight($(first_active));
953
- }
954
- } else if (this.results_showing) {
955
- next_sib = this.result_highlight.nextAll("li.active-result").first();
956
- if (next_sib) {
957
- this.result_do_highlight(next_sib);
958
- }
959
- }
960
- if (!this.results_showing) {
961
- return this.results_show();
962
- }
963
- };
964
-
965
- Chosen.prototype.keyup_arrow = function() {
966
- var prev_sibs;
967
- if (!this.results_showing && !this.is_multiple) {
968
- return this.results_show();
969
- } else if (this.result_highlight) {
970
- prev_sibs = this.result_highlight.prevAll("li.active-result");
971
- if (prev_sibs.length) {
972
- return this.result_do_highlight(prev_sibs.first());
973
- } else {
974
- if (this.choices > 0) {
975
- this.results_hide();
976
- }
977
- return this.result_clear_highlight();
978
- }
979
- }
980
- };
981
-
982
- Chosen.prototype.keydown_backstroke = function() {
983
- var next_available_destroy;
984
- if (this.pending_backstroke) {
985
- this.choice_destroy(this.pending_backstroke.find("a").first());
986
- return this.clear_backstroke();
987
- } else {
988
- next_available_destroy = this.search_container.siblings("li.search-choice").last();
989
- if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) {
990
- this.pending_backstroke = next_available_destroy;
991
- if (this.single_backstroke_delete) {
992
- return this.keydown_backstroke();
993
- } else {
994
- return this.pending_backstroke.addClass("search-choice-focus");
995
- }
996
- }
997
- }
998
- };
999
-
1000
- Chosen.prototype.clear_backstroke = function() {
1001
- if (this.pending_backstroke) {
1002
- this.pending_backstroke.removeClass("search-choice-focus");
1003
- }
1004
- return this.pending_backstroke = null;
1005
- };
1006
-
1007
- Chosen.prototype.keydown_checker = function(evt) {
1008
- var stroke, _ref;
1009
- stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
1010
- this.search_field_scale();
1011
- if (stroke !== 8 && this.pending_backstroke) {
1012
- this.clear_backstroke();
1013
- }
1014
- switch (stroke) {
1015
- case 8:
1016
- this.backstroke_length = this.search_field.val().length;
1017
- break;
1018
- case 9:
1019
- if (this.results_showing && !this.is_multiple) {
1020
- this.result_select(evt);
1021
- }
1022
- this.mouse_on_container = false;
1023
- break;
1024
- case 13:
1025
- evt.preventDefault();
1026
- break;
1027
- case 38:
1028
- evt.preventDefault();
1029
- this.keyup_arrow();
1030
- break;
1031
- case 40:
1032
- this.keydown_arrow();
1033
- break;
1034
- }
1035
- };
1036
-
1037
- Chosen.prototype.search_field_scale = function() {
1038
- var dd_top, div, h, style, style_block, styles, w, _i, _len;
1039
- if (this.is_multiple) {
1040
- h = 0;
1041
- w = 0;
1042
- style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
1043
- styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
1044
- for (_i = 0, _len = styles.length; _i < _len; _i++) {
1045
- style = styles[_i];
1046
- style_block += style + ":" + this.search_field.css(style) + ";";
1047
- }
1048
- div = $('<div />', {
1049
- 'style': style_block
1050
- });
1051
- div.text(this.search_field.val());
1052
- $('body').append(div);
1053
- w = div.width() + 25;
1054
- div.remove();
1055
- if (w > this.f_width - 10) {
1056
- w = this.f_width - 10;
1057
- }
1058
- this.search_field.css({
1059
- 'width': w + 'px'
1060
- });
1061
- dd_top = this.container.height();
1062
- return this.dropdown.css({
1063
- "top": dd_top + "px"
1064
- });
1065
- }
1066
- };
1067
-
1068
- Chosen.prototype.generate_random_id = function() {
1069
- var string;
1070
- string = "sel" + this.generate_random_char() + this.generate_random_char() + this.generate_random_char();
1071
- while ($("#" + string).length > 0) {
1072
- string += this.generate_random_char();
1073
- }
1074
- return string;
1075
- };
1076
-
1077
- return Chosen;
1078
-
1079
- })(AbstractChosen);
1080
-
1081
- root.Chosen = Chosen;
1082
-
1083
- get_side_border_padding = function(elmt) {
1084
- var side_border_padding;
1085
- return side_border_padding = elmt.outerWidth() - elmt.width();
1086
- };
1087
-
1088
- root.get_side_border_padding = get_side_border_padding;
1089
-
1090
- }).call(this);
1
+ // Chosen, a Select Box Enhancer for jQuery and Protoype
2
+ // by Patrick Filler for Harvest, http://getharvest.com
3
+ //
4
+ // Version 0.9.12
5
+ // Full source at https://github.com/harvesthq/chosen
6
+ // Copyright (c) 2011 Harvest http://getharvest.com
7
+
8
+ // MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
9
+ // This file is generated by `cake build`, do not edit it by hand.
10
+ (function() {
11
+ var SelectParser;
12
+
13
+ SelectParser = (function() {
14
+
15
+ function SelectParser() {
16
+ this.options_index = 0;
17
+ this.parsed = [];
18
+ }
19
+
20
+ SelectParser.prototype.add_node = function(child) {
21
+ if (child.nodeName.toUpperCase() === "OPTGROUP") {
22
+ return this.add_group(child);
23
+ } else {
24
+ return this.add_option(child);
25
+ }
26
+ };
27
+
28
+ SelectParser.prototype.add_group = function(group) {
29
+ var group_position, option, _i, _len, _ref, _results;
30
+ group_position = this.parsed.length;
31
+ this.parsed.push({
32
+ array_index: group_position,
33
+ group: true,
34
+ label: group.label,
35
+ children: 0,
36
+ disabled: group.disabled
37
+ });
38
+ _ref = group.childNodes;
39
+ _results = [];
40
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
41
+ option = _ref[_i];
42
+ _results.push(this.add_option(option, group_position, group.disabled));
43
+ }
44
+ return _results;
45
+ };
46
+
47
+ SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
48
+ if (option.nodeName.toUpperCase() === "OPTION") {
49
+ if (option.text !== "") {
50
+ if (group_position != null) {
51
+ this.parsed[group_position].children += 1;
52
+ }
53
+ this.parsed.push({
54
+ array_index: this.parsed.length,
55
+ options_index: this.options_index,
56
+ value: option.value,
57
+ text: option.text,
58
+ html: option.innerHTML,
59
+ selected: option.selected,
60
+ disabled: group_disabled === true ? group_disabled : option.disabled,
61
+ group_array_index: group_position,
62
+ classes: option.className,
63
+ style: option.style.cssText
64
+ });
65
+ } else {
66
+ this.parsed.push({
67
+ array_index: this.parsed.length,
68
+ options_index: this.options_index,
69
+ empty: true
70
+ });
71
+ }
72
+ return this.options_index += 1;
73
+ }
74
+ };
75
+
76
+ return SelectParser;
77
+
78
+ })();
79
+
80
+ SelectParser.select_to_array = function(select) {
81
+ var child, parser, _i, _len, _ref;
82
+ parser = new SelectParser();
83
+ _ref = select.childNodes;
84
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
85
+ child = _ref[_i];
86
+ parser.add_node(child);
87
+ }
88
+ return parser.parsed;
89
+ };
90
+
91
+ this.SelectParser = SelectParser;
92
+
93
+ }).call(this);
94
+
95
+ /*
96
+ Chosen source: generate output using 'cake build'
97
+ Copyright (c) 2011 by Harvest
98
+ */
99
+
100
+
101
+ (function() {
102
+ var AbstractChosen, root;
103
+
104
+ root = this;
105
+
106
+ AbstractChosen = (function() {
107
+
108
+ function AbstractChosen(form_field, options) {
109
+ this.form_field = form_field;
110
+ this.options = options != null ? options : {};
111
+ this.is_multiple = this.form_field.multiple;
112
+ this.set_default_text();
113
+ this.set_default_values();
114
+ this.setup();
115
+ this.set_up_html();
116
+ this.register_observers();
117
+ this.finish_setup();
118
+ }
119
+
120
+ AbstractChosen.prototype.set_default_values = function() {
121
+ var _this = this;
122
+ this.click_test_action = function(evt) {
123
+ return _this.test_active_click(evt);
124
+ };
125
+ this.activate_action = function(evt) {
126
+ return _this.activate_field(evt);
127
+ };
128
+ this.active_field = false;
129
+ this.mouse_on_container = false;
130
+ this.results_showing = false;
131
+ this.result_highlighted = null;
132
+ this.result_single_selected = null;
133
+ this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
134
+ this.disable_search_threshold = this.options.disable_search_threshold || 0;
135
+ this.disable_search = this.options.disable_search || false;
136
+ this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
137
+ this.search_contains = this.options.search_contains || false;
138
+ this.choices = 0;
139
+ this.single_backstroke_delete = this.options.single_backstroke_delete || false;
140
+ this.max_selected_options = this.options.max_selected_options || Infinity;
141
+ return this.inherit_select_classes = this.options.inherit_select_classes || false;
142
+ };
143
+
144
+ AbstractChosen.prototype.set_default_text = function() {
145
+ if (this.form_field.getAttribute("data-placeholder")) {
146
+ this.default_text = this.form_field.getAttribute("data-placeholder");
147
+ } else if (this.is_multiple) {
148
+ this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || "Select Some Options";
149
+ } else {
150
+ this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || "Select an Option";
151
+ }
152
+ return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || "No results match";
153
+ };
154
+
155
+ AbstractChosen.prototype.mouse_enter = function() {
156
+ return this.mouse_on_container = true;
157
+ };
158
+
159
+ AbstractChosen.prototype.mouse_leave = function() {
160
+ return this.mouse_on_container = false;
161
+ };
162
+
163
+ AbstractChosen.prototype.input_focus = function(evt) {
164
+ var _this = this;
165
+ if (this.is_multiple) {
166
+ if (!this.active_field) {
167
+ return setTimeout((function() {
168
+ return _this.container_mousedown();
169
+ }), 50);
170
+ }
171
+ } else {
172
+ if (!this.active_field) {
173
+ return this.activate_field();
174
+ }
175
+ }
176
+ };
177
+
178
+ AbstractChosen.prototype.input_blur = function(evt) {
179
+ var _this = this;
180
+ if (!this.mouse_on_container) {
181
+ this.active_field = false;
182
+ return setTimeout((function() {
183
+ return _this.blur_test();
184
+ }), 100);
185
+ }
186
+ };
187
+
188
+ AbstractChosen.prototype.result_add_option = function(option) {
189
+ var classes, style;
190
+ if (!option.disabled) {
191
+ option.dom_id = this.container_id + "_o_" + option.array_index;
192
+ classes = option.selected && this.is_multiple ? [] : ["active-result"];
193
+ if (option.selected) {
194
+ classes.push("result-selected");
195
+ }
196
+ if (option.group_array_index != null) {
197
+ classes.push("group-option");
198
+ }
199
+ if (option.classes !== "") {
200
+ classes.push(option.classes);
201
+ }
202
+ style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : "";
203
+ return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '"' + style + '>' + option.html + '</li>';
204
+ } else {
205
+ return "";
206
+ }
207
+ };
208
+
209
+ AbstractChosen.prototype.results_update_field = function() {
210
+ this.set_default_text();
211
+ if (!this.is_multiple) {
212
+ this.results_reset_cleanup();
213
+ }
214
+ this.result_clear_highlight();
215
+ this.result_single_selected = null;
216
+ return this.results_build();
217
+ };
218
+
219
+ AbstractChosen.prototype.results_toggle = function() {
220
+ if (this.results_showing) {
221
+ return this.results_hide();
222
+ } else {
223
+ return this.results_show();
224
+ }
225
+ };
226
+
227
+ AbstractChosen.prototype.results_search = function(evt) {
228
+ if (this.results_showing) {
229
+ return this.winnow_results();
230
+ } else {
231
+ return this.results_show();
232
+ }
233
+ };
234
+
235
+ AbstractChosen.prototype.keyup_checker = function(evt) {
236
+ var stroke, _ref;
237
+ stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
238
+ this.search_field_scale();
239
+ switch (stroke) {
240
+ case 8:
241
+ if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) {
242
+ return this.keydown_backstroke();
243
+ } else if (!this.pending_backstroke) {
244
+ this.result_clear_highlight();
245
+ return this.results_search();
246
+ }
247
+ break;
248
+ case 13:
249
+ evt.preventDefault();
250
+ if (this.results_showing) {
251
+ return this.result_select(evt);
252
+ }
253
+ break;
254
+ case 27:
255
+ if (this.results_showing) {
256
+ this.results_hide();
257
+ }
258
+ return true;
259
+ case 9:
260
+ case 38:
261
+ case 40:
262
+ case 16:
263
+ case 91:
264
+ case 17:
265
+ break;
266
+ default:
267
+ return this.results_search();
268
+ }
269
+ };
270
+
271
+ AbstractChosen.prototype.generate_field_id = function() {
272
+ var new_id;
273
+ new_id = this.generate_random_id();
274
+ this.form_field.id = new_id;
275
+ return new_id;
276
+ };
277
+
278
+ AbstractChosen.prototype.generate_random_char = function() {
279
+ var chars, newchar, rand;
280
+ chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
281
+ rand = Math.floor(Math.random() * chars.length);
282
+ return newchar = chars.substring(rand, rand + 1);
283
+ };
284
+
285
+ return AbstractChosen;
286
+
287
+ })();
288
+
289
+ root.AbstractChosen = AbstractChosen;
290
+
291
+ }).call(this);
292
+
293
+ /*
294
+ Chosen source: generate output using 'cake build'
295
+ Copyright (c) 2011 by Harvest
296
+ */
297
+
298
+
299
+ (function() {
300
+ var $, Chosen, get_side_border_padding, root,
301
+ __hasProp = {}.hasOwnProperty,
302
+ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
303
+
304
+ root = this;
305
+
306
+ $ = jQuery;
307
+
308
+ $.fn.extend({
309
+ chosen: function(options) {
310
+ var browser, match, ua;
311
+ ua = navigator.userAgent.toLowerCase();
312
+ match = /(msie) ([\w.]+)/.exec(ua) || [];
313
+ browser = {
314
+ name: match[1] || "",
315
+ version: match[2] || "0"
316
+ };
317
+ if (browser.name === "msie" && (browser.version === "6.0" || (browser.version === "7.0" && document.documentMode === 7))) {
318
+ return this;
319
+ }
320
+ return this.each(function(input_field) {
321
+ var $this;
322
+ $this = $(this);
323
+ if (!$this.hasClass("chzn-done")) {
324
+ return $this.data('chosen', new Chosen(this, options));
325
+ }
326
+ });
327
+ }
328
+ });
329
+
330
+ Chosen = (function(_super) {
331
+
332
+ __extends(Chosen, _super);
333
+
334
+ function Chosen() {
335
+ return Chosen.__super__.constructor.apply(this, arguments);
336
+ }
337
+
338
+ Chosen.prototype.setup = function() {
339
+ this.form_field_jq = $(this.form_field);
340
+ this.current_value = this.form_field_jq.val();
341
+ return this.is_rtl = this.form_field_jq.hasClass("chzn-rtl");
342
+ };
343
+
344
+ Chosen.prototype.finish_setup = function() {
345
+ return this.form_field_jq.addClass("chzn-done");
346
+ };
347
+
348
+ Chosen.prototype.set_up_html = function() {
349
+ var container_classes, container_div, container_props, dd_top, dd_width, sf_width;
350
+ this.container_id = this.form_field.id.length ? this.form_field.id.replace(/[^\w]/g, '_') : this.generate_field_id();
351
+ this.container_id += "_chzn";
352
+ container_classes = ["chzn-container"];
353
+ container_classes.push("chzn-container-" + (this.is_multiple ? "multi" : "single"));
354
+ if (this.inherit_select_classes && this.form_field.className) {
355
+ container_classes.push(this.form_field.className);
356
+ }
357
+ if (this.is_rtl) {
358
+ container_classes.push("chzn-rtl");
359
+ }
360
+ this.f_width = this.form_field_jq.outerWidth();
361
+ container_props = {
362
+ id: this.container_id,
363
+ "class": container_classes.join(' '),
364
+ style: 'width: ' + this.f_width + 'px;',
365
+ title: this.form_field.title
366
+ };
367
+ container_div = $("<div />", container_props);
368
+ if (this.is_multiple) {
369
+ container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
370
+ } else {
371
+ container_div.html('<a href="javascript:void(0)" class="chzn-single chzn-default" tabindex="-1"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');
372
+ }
373
+ this.form_field_jq.hide().after(container_div);
374
+ this.container = $('#' + this.container_id);
375
+ this.dropdown = this.container.find('div.chzn-drop').first();
376
+ dd_top = this.container.height();
377
+ dd_width = this.f_width - get_side_border_padding(this.dropdown);
378
+ this.dropdown.css({
379
+ "width": dd_width + "px",
380
+ "top": dd_top + "px"
381
+ });
382
+ this.search_field = this.container.find('input').first();
383
+ this.search_results = this.container.find('ul.chzn-results').first();
384
+ this.search_field_scale();
385
+ this.search_no_results = this.container.find('li.no-results').first();
386
+ if (this.is_multiple) {
387
+ this.search_choices = this.container.find('ul.chzn-choices').first();
388
+ this.search_container = this.container.find('li.search-field').first();
389
+ } else {
390
+ this.search_container = this.container.find('div.chzn-search').first();
391
+ this.selected_item = this.container.find('.chzn-single').first();
392
+ sf_width = dd_width - get_side_border_padding(this.search_container) - get_side_border_padding(this.search_field);
393
+ this.search_field.css({
394
+ "width": sf_width + "px"
395
+ });
396
+ }
397
+ this.results_build();
398
+ this.set_tab_index();
399
+ return this.form_field_jq.trigger("liszt:ready", {
400
+ chosen: this
401
+ });
402
+ };
403
+
404
+ Chosen.prototype.register_observers = function() {
405
+ var _this = this;
406
+ this.container.mousedown(function(evt) {
407
+ _this.container_mousedown(evt);
408
+ });
409
+ this.container.mouseup(function(evt) {
410
+ _this.container_mouseup(evt);
411
+ });
412
+ this.container.mouseenter(function(evt) {
413
+ _this.mouse_enter(evt);
414
+ });
415
+ this.container.mouseleave(function(evt) {
416
+ _this.mouse_leave(evt);
417
+ });
418
+ this.search_results.mouseup(function(evt) {
419
+ _this.search_results_mouseup(evt);
420
+ });
421
+ this.search_results.mouseover(function(evt) {
422
+ _this.search_results_mouseover(evt);
423
+ });
424
+ this.search_results.mouseout(function(evt) {
425
+ _this.search_results_mouseout(evt);
426
+ });
427
+ this.form_field_jq.bind("liszt:updated", function(evt) {
428
+ _this.results_update_field(evt);
429
+ });
430
+ this.form_field_jq.bind("liszt:activate", function(evt) {
431
+ _this.activate_field(evt);
432
+ });
433
+ this.form_field_jq.bind("liszt:open", function(evt) {
434
+ _this.container_mousedown(evt);
435
+ });
436
+ this.search_field.blur(function(evt) {
437
+ _this.input_blur(evt);
438
+ });
439
+ this.search_field.keyup(function(evt) {
440
+ _this.keyup_checker(evt);
441
+ });
442
+ this.search_field.keydown(function(evt) {
443
+ _this.keydown_checker(evt);
444
+ });
445
+ this.search_field.focus(function(evt) {
446
+ _this.input_focus(evt);
447
+ });
448
+ if (this.is_multiple) {
449
+ return this.search_choices.click(function(evt) {
450
+ _this.choices_click(evt);
451
+ });
452
+ } else {
453
+ return this.container.click(function(evt) {
454
+ evt.preventDefault();
455
+ });
456
+ }
457
+ };
458
+
459
+ Chosen.prototype.search_field_disabled = function() {
460
+ this.is_disabled = this.form_field_jq[0].disabled;
461
+ if (this.is_disabled) {
462
+ this.container.addClass('chzn-disabled');
463
+ this.search_field[0].disabled = true;
464
+ if (!this.is_multiple) {
465
+ this.selected_item.unbind("focus", this.activate_action);
466
+ }
467
+ return this.close_field();
468
+ } else {
469
+ this.container.removeClass('chzn-disabled');
470
+ this.search_field[0].disabled = false;
471
+ if (!this.is_multiple) {
472
+ return this.selected_item.bind("focus", this.activate_action);
473
+ }
474
+ }
475
+ };
476
+
477
+ Chosen.prototype.container_mousedown = function(evt) {
478
+ var target_closelink;
479
+ if (!this.is_disabled) {
480
+ target_closelink = evt != null ? ($(evt.target)).hasClass("search-choice-close") : false;
481
+ if (evt && evt.type === "mousedown" && !this.results_showing) {
482
+ evt.preventDefault();
483
+ }
484
+ if (!this.pending_destroy_click && !target_closelink) {
485
+ if (!this.active_field) {
486
+ if (this.is_multiple) {
487
+ this.search_field.val("");
488
+ }
489
+ $(document).click(this.click_test_action);
490
+ this.results_show();
491
+ } else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chzn-single").length)) {
492
+ evt.preventDefault();
493
+ this.results_toggle();
494
+ }
495
+ return this.activate_field();
496
+ } else {
497
+ return this.pending_destroy_click = false;
498
+ }
499
+ }
500
+ };
501
+
502
+ Chosen.prototype.container_mouseup = function(evt) {
503
+ if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
504
+ return this.results_reset(evt);
505
+ }
506
+ };
507
+
508
+ Chosen.prototype.blur_test = function(evt) {
509
+ if (!this.active_field && this.container.hasClass("chzn-container-active")) {
510
+ return this.close_field();
511
+ }
512
+ };
513
+
514
+ Chosen.prototype.close_field = function() {
515
+ $(document).unbind("click", this.click_test_action);
516
+ this.active_field = false;
517
+ this.results_hide();
518
+ this.container.removeClass("chzn-container-active");
519
+ this.winnow_results_clear();
520
+ this.clear_backstroke();
521
+ this.show_search_field_default();
522
+ return this.search_field_scale();
523
+ };
524
+
525
+ Chosen.prototype.activate_field = function() {
526
+ this.container.addClass("chzn-container-active");
527
+ this.active_field = true;
528
+ this.search_field.val(this.search_field.val());
529
+ return this.search_field.focus();
530
+ };
531
+
532
+ Chosen.prototype.test_active_click = function(evt) {
533
+ if ($(evt.target).parents('#' + this.container_id).length) {
534
+ return this.active_field = true;
535
+ } else {
536
+ return this.close_field();
537
+ }
538
+ };
539
+
540
+ Chosen.prototype.results_build = function() {
541
+ var content, data, _i, _len, _ref;
542
+ this.parsing = true;
543
+ this.results_data = root.SelectParser.select_to_array(this.form_field);
544
+ if (this.is_multiple && this.choices > 0) {
545
+ this.search_choices.find("li.search-choice").remove();
546
+ this.choices = 0;
547
+ } else if (!this.is_multiple) {
548
+ this.selected_item.addClass("chzn-default").find("span").text(this.default_text);
549
+ if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
550
+ this.container.addClass("chzn-container-single-nosearch");
551
+ } else {
552
+ this.container.removeClass("chzn-container-single-nosearch");
553
+ }
554
+ }
555
+ content = '';
556
+ _ref = this.results_data;
557
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
558
+ data = _ref[_i];
559
+ if (data.group) {
560
+ content += this.result_add_group(data);
561
+ } else if (!data.empty) {
562
+ content += this.result_add_option(data);
563
+ if (data.selected && this.is_multiple) {
564
+ this.choice_build(data);
565
+ } else if (data.selected && !this.is_multiple) {
566
+ this.selected_item.removeClass("chzn-default").find("span").text(data.text);
567
+ if (this.allow_single_deselect) {
568
+ this.single_deselect_control_build();
569
+ }
570
+ }
571
+ }
572
+ }
573
+ this.search_field_disabled();
574
+ this.show_search_field_default();
575
+ this.search_field_scale();
576
+ this.search_results.html(content);
577
+ return this.parsing = false;
578
+ };
579
+
580
+ Chosen.prototype.result_add_group = function(group) {
581
+ if (!group.disabled) {
582
+ group.dom_id = this.container_id + "_g_" + group.array_index;
583
+ return '<li id="' + group.dom_id + '" class="group-result">' + $("<div />").text(group.label).html() + '</li>';
584
+ } else {
585
+ return "";
586
+ }
587
+ };
588
+
589
+ Chosen.prototype.result_do_highlight = function(el) {
590
+ var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
591
+ if (el.length) {
592
+ this.result_clear_highlight();
593
+ this.result_highlight = el;
594
+ this.result_highlight.addClass("highlighted");
595
+ maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
596
+ visible_top = this.search_results.scrollTop();
597
+ visible_bottom = maxHeight + visible_top;
598
+ high_top = this.result_highlight.position().top + this.search_results.scrollTop();
599
+ high_bottom = high_top + this.result_highlight.outerHeight();
600
+ if (high_bottom >= visible_bottom) {
601
+ return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
602
+ } else if (high_top < visible_top) {
603
+ return this.search_results.scrollTop(high_top);
604
+ }
605
+ }
606
+ };
607
+
608
+ Chosen.prototype.result_clear_highlight = function() {
609
+ if (this.result_highlight) {
610
+ this.result_highlight.removeClass("highlighted");
611
+ }
612
+ return this.result_highlight = null;
613
+ };
614
+
615
+ Chosen.prototype.results_show = function() {
616
+ var dd_top;
617
+ if (!this.is_multiple) {
618
+ this.selected_item.addClass("chzn-single-with-drop");
619
+ if (this.result_single_selected) {
620
+ this.result_do_highlight(this.result_single_selected);
621
+ }
622
+ } else if (this.max_selected_options <= this.choices) {
623
+ this.form_field_jq.trigger("liszt:maxselected", {
624
+ chosen: this
625
+ });
626
+ return false;
627
+ }
628
+ dd_top = this.is_multiple ? this.container.height() : this.container.height() - 1;
629
+ this.form_field_jq.trigger("liszt:showing_dropdown", {
630
+ chosen: this
631
+ });
632
+ this.dropdown.css({
633
+ "top": dd_top + "px",
634
+ "left": 0
635
+ });
636
+ this.results_showing = true;
637
+ this.search_field.focus();
638
+ this.search_field.val(this.search_field.val());
639
+ return this.winnow_results();
640
+ };
641
+
642
+ Chosen.prototype.results_hide = function() {
643
+ if (!this.is_multiple) {
644
+ this.selected_item.removeClass("chzn-single-with-drop");
645
+ }
646
+ this.result_clear_highlight();
647
+ this.form_field_jq.trigger("liszt:hiding_dropdown", {
648
+ chosen: this
649
+ });
650
+ this.dropdown.css({
651
+ "left": "-9000px"
652
+ });
653
+ return this.results_showing = false;
654
+ };
655
+
656
+ Chosen.prototype.set_tab_index = function(el) {
657
+ var ti;
658
+ if (this.form_field_jq.attr("tabindex")) {
659
+ ti = this.form_field_jq.attr("tabindex");
660
+ this.form_field_jq.attr("tabindex", -1);
661
+ return this.search_field.attr("tabindex", ti);
662
+ }
663
+ };
664
+
665
+ Chosen.prototype.show_search_field_default = function() {
666
+ if (this.is_multiple && this.choices < 1 && !this.active_field) {
667
+ this.search_field.val(this.default_text);
668
+ return this.search_field.addClass("default");
669
+ } else {
670
+ this.search_field.val("");
671
+ return this.search_field.removeClass("default");
672
+ }
673
+ };
674
+
675
+ Chosen.prototype.search_results_mouseup = function(evt) {
676
+ var target;
677
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
678
+ if (target.length) {
679
+ this.result_highlight = target;
680
+ this.result_select(evt);
681
+ return this.search_field.focus();
682
+ }
683
+ };
684
+
685
+ Chosen.prototype.search_results_mouseover = function(evt) {
686
+ var target;
687
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
688
+ if (target) {
689
+ return this.result_do_highlight(target);
690
+ }
691
+ };
692
+
693
+ Chosen.prototype.search_results_mouseout = function(evt) {
694
+ if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
695
+ return this.result_clear_highlight();
696
+ }
697
+ };
698
+
699
+ Chosen.prototype.choices_click = function(evt) {
700
+ evt.preventDefault();
701
+ if (this.active_field && !($(evt.target).hasClass("search-choice" || $(evt.target).parents('.search-choice').first)) && !this.results_showing) {
702
+ return this.results_show();
703
+ }
704
+ };
705
+
706
+ Chosen.prototype.choice_build = function(item) {
707
+ var choice_id, html, link,
708
+ _this = this;
709
+ if (this.is_multiple && this.max_selected_options <= this.choices) {
710
+ this.form_field_jq.trigger("liszt:maxselected", {
711
+ chosen: this
712
+ });
713
+ return false;
714
+ }
715
+ choice_id = this.container_id + "_c_" + item.array_index;
716
+ this.choices += 1;
717
+ if (item.disabled) {
718
+ html = '<li class="search-choice search-choice-disabled" id="' + choice_id + '"><span>' + item.html + '</span></li>';
719
+ } else {
720
+ html = '<li class="search-choice" id="' + choice_id + '"><span>' + item.html + '</span><a href="javascript:void(0)" class="search-choice-close" rel="' + item.array_index + '"></a></li>';
721
+ }
722
+ this.search_container.before(html);
723
+ link = $('#' + choice_id).find("a").first();
724
+ return link.click(function(evt) {
725
+ return _this.choice_destroy_link_click(evt);
726
+ });
727
+ };
728
+
729
+ Chosen.prototype.choice_destroy_link_click = function(evt) {
730
+ evt.preventDefault();
731
+ if (!this.is_disabled) {
732
+ this.pending_destroy_click = true;
733
+ return this.choice_destroy($(evt.target));
734
+ } else {
735
+ return evt.stopPropagation;
736
+ }
737
+ };
738
+
739
+ Chosen.prototype.choice_destroy = function(link) {
740
+ if (this.result_deselect(link.attr("rel"))) {
741
+ this.choices -= 1;
742
+ this.show_search_field_default();
743
+ if (this.is_multiple && this.choices > 0 && this.search_field.val().length < 1) {
744
+ this.results_hide();
745
+ }
746
+ link.parents('li').first().remove();
747
+ return this.search_field_scale();
748
+ }
749
+ };
750
+
751
+ Chosen.prototype.results_reset = function() {
752
+ this.form_field.options[0].selected = true;
753
+ this.selected_item.find("span").text(this.default_text);
754
+ if (!this.is_multiple) {
755
+ this.selected_item.addClass("chzn-default");
756
+ }
757
+ this.show_search_field_default();
758
+ this.results_reset_cleanup();
759
+ this.form_field_jq.trigger("change");
760
+ if (this.active_field) {
761
+ return this.results_hide();
762
+ }
763
+ };
764
+
765
+ Chosen.prototype.results_reset_cleanup = function() {
766
+ this.current_value = this.form_field_jq.val();
767
+ return this.selected_item.find("abbr").remove();
768
+ };
769
+
770
+ Chosen.prototype.result_select = function(evt) {
771
+ var high, high_id, item, position;
772
+ if (this.result_highlight) {
773
+ high = this.result_highlight;
774
+ high_id = high.attr("id");
775
+ this.result_clear_highlight();
776
+ if (this.is_multiple) {
777
+ this.result_deactivate(high);
778
+ } else {
779
+ this.search_results.find(".result-selected").removeClass("result-selected");
780
+ this.result_single_selected = high;
781
+ this.selected_item.removeClass("chzn-default");
782
+ }
783
+ high.addClass("result-selected");
784
+ position = high_id.substr(high_id.lastIndexOf("_") + 1);
785
+ item = this.results_data[position];
786
+ item.selected = true;
787
+ this.form_field.options[item.options_index].selected = true;
788
+ if (this.is_multiple) {
789
+ this.choice_build(item);
790
+ } else {
791
+ this.selected_item.find("span").first().text(item.text);
792
+ if (this.allow_single_deselect) {
793
+ this.single_deselect_control_build();
794
+ }
795
+ }
796
+ if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
797
+ this.results_hide();
798
+ }
799
+ this.search_field.val("");
800
+ if (this.is_multiple || this.form_field_jq.val() !== this.current_value) {
801
+ this.form_field_jq.trigger("change", {
802
+ 'selected': this.form_field.options[item.options_index].value
803
+ });
804
+ }
805
+ this.current_value = this.form_field_jq.val();
806
+ return this.search_field_scale();
807
+ }
808
+ };
809
+
810
+ Chosen.prototype.result_activate = function(el) {
811
+ return el.addClass("active-result");
812
+ };
813
+
814
+ Chosen.prototype.result_deactivate = function(el) {
815
+ return el.removeClass("active-result");
816
+ };
817
+
818
+ Chosen.prototype.result_deselect = function(pos) {
819
+ var result, result_data;
820
+ result_data = this.results_data[pos];
821
+ if (!this.form_field.options[result_data.options_index].disabled) {
822
+ result_data.selected = false;
823
+ this.form_field.options[result_data.options_index].selected = false;
824
+ result = $("#" + this.container_id + "_o_" + pos);
825
+ result.removeClass("result-selected").addClass("active-result").show();
826
+ this.result_clear_highlight();
827
+ this.winnow_results();
828
+ this.form_field_jq.trigger("change", {
829
+ deselected: this.form_field.options[result_data.options_index].value
830
+ });
831
+ this.search_field_scale();
832
+ return true;
833
+ } else {
834
+ return false;
835
+ }
836
+ };
837
+
838
+ Chosen.prototype.single_deselect_control_build = function() {
839
+ if (this.allow_single_deselect && this.selected_item.find("abbr").length < 1) {
840
+ return this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
841
+ }
842
+ };
843
+
844
+ Chosen.prototype.winnow_results = function() {
845
+ var found, option, part, parts, regex, regexAnchor, result, result_id, results, searchText, startpos, text, zregex, _i, _j, _len, _len1, _ref;
846
+ this.no_results_clear();
847
+ results = 0;
848
+ searchText = this.search_field.val() === this.default_text ? "" : $('<div/>').text($.trim(this.search_field.val())).html();
849
+ regexAnchor = this.search_contains ? "" : "^";
850
+ regex = new RegExp(regexAnchor + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
851
+ zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
852
+ _ref = this.results_data;
853
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
854
+ option = _ref[_i];
855
+ if (!option.disabled && !option.empty) {
856
+ if (option.group) {
857
+ $('#' + option.dom_id).css('display', 'none');
858
+ } else if (!(this.is_multiple && option.selected)) {
859
+ found = false;
860
+ result_id = option.dom_id;
861
+ result = $("#" + result_id);
862
+ if (regex.test(option.html)) {
863
+ found = true;
864
+ results += 1;
865
+ } else if (this.enable_split_word_search && (option.html.indexOf(" ") >= 0 || option.html.indexOf("[") === 0)) {
866
+ parts = option.html.replace(/\[|\]/g, "").split(" ");
867
+ if (parts.length) {
868
+ for (_j = 0, _len1 = parts.length; _j < _len1; _j++) {
869
+ part = parts[_j];
870
+ if (regex.test(part)) {
871
+ found = true;
872
+ results += 1;
873
+ }
874
+ }
875
+ }
876
+ }
877
+ if (found) {
878
+ if (searchText.length) {
879
+ startpos = option.html.search(zregex);
880
+ text = option.html.substr(0, startpos + searchText.length) + '</em>' + option.html.substr(startpos + searchText.length);
881
+ text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
882
+ } else {
883
+ text = option.html;
884
+ }
885
+ result.html(text);
886
+ this.result_activate(result);
887
+ if (option.group_array_index != null) {
888
+ $("#" + this.results_data[option.group_array_index].dom_id).css('display', 'list-item');
889
+ }
890
+ } else {
891
+ if (this.result_highlight && result_id === this.result_highlight.attr('id')) {
892
+ this.result_clear_highlight();
893
+ }
894
+ this.result_deactivate(result);
895
+ }
896
+ }
897
+ }
898
+ }
899
+ if (results < 1 && searchText.length) {
900
+ return this.no_results(searchText);
901
+ } else {
902
+ return this.winnow_results_set_highlight();
903
+ }
904
+ };
905
+
906
+ Chosen.prototype.winnow_results_clear = function() {
907
+ var li, lis, _i, _len, _results;
908
+ this.search_field.val("");
909
+ lis = this.search_results.find("li");
910
+ _results = [];
911
+ for (_i = 0, _len = lis.length; _i < _len; _i++) {
912
+ li = lis[_i];
913
+ li = $(li);
914
+ if (li.hasClass("group-result")) {
915
+ _results.push(li.css('display', 'auto'));
916
+ } else if (!this.is_multiple || !li.hasClass("result-selected")) {
917
+ _results.push(this.result_activate(li));
918
+ } else {
919
+ _results.push(void 0);
920
+ }
921
+ }
922
+ return _results;
923
+ };
924
+
925
+ Chosen.prototype.winnow_results_set_highlight = function() {
926
+ var do_high, selected_results;
927
+ if (!this.result_highlight) {
928
+ selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
929
+ do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
930
+ if (do_high != null) {
931
+ return this.result_do_highlight(do_high);
932
+ }
933
+ }
934
+ };
935
+
936
+ Chosen.prototype.no_results = function(terms) {
937
+ var no_results_html;
938
+ no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
939
+ no_results_html.find("span").first().html(terms);
940
+ return this.search_results.append(no_results_html);
941
+ };
942
+
943
+ Chosen.prototype.no_results_clear = function() {
944
+ return this.search_results.find(".no-results").remove();
945
+ };
946
+
947
+ Chosen.prototype.keydown_arrow = function() {
948
+ var first_active, next_sib;
949
+ if (!this.result_highlight) {
950
+ first_active = this.search_results.find("li.active-result").first();
951
+ if (first_active) {
952
+ this.result_do_highlight($(first_active));
953
+ }
954
+ } else if (this.results_showing) {
955
+ next_sib = this.result_highlight.nextAll("li.active-result").first();
956
+ if (next_sib) {
957
+ this.result_do_highlight(next_sib);
958
+ }
959
+ }
960
+ if (!this.results_showing) {
961
+ return this.results_show();
962
+ }
963
+ };
964
+
965
+ Chosen.prototype.keyup_arrow = function() {
966
+ var prev_sibs;
967
+ if (!this.results_showing && !this.is_multiple) {
968
+ return this.results_show();
969
+ } else if (this.result_highlight) {
970
+ prev_sibs = this.result_highlight.prevAll("li.active-result");
971
+ if (prev_sibs.length) {
972
+ return this.result_do_highlight(prev_sibs.first());
973
+ } else {
974
+ if (this.choices > 0) {
975
+ this.results_hide();
976
+ }
977
+ return this.result_clear_highlight();
978
+ }
979
+ }
980
+ };
981
+
982
+ Chosen.prototype.keydown_backstroke = function() {
983
+ var next_available_destroy;
984
+ if (this.pending_backstroke) {
985
+ this.choice_destroy(this.pending_backstroke.find("a").first());
986
+ return this.clear_backstroke();
987
+ } else {
988
+ next_available_destroy = this.search_container.siblings("li.search-choice").last();
989
+ if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) {
990
+ this.pending_backstroke = next_available_destroy;
991
+ if (this.single_backstroke_delete) {
992
+ return this.keydown_backstroke();
993
+ } else {
994
+ return this.pending_backstroke.addClass("search-choice-focus");
995
+ }
996
+ }
997
+ }
998
+ };
999
+
1000
+ Chosen.prototype.clear_backstroke = function() {
1001
+ if (this.pending_backstroke) {
1002
+ this.pending_backstroke.removeClass("search-choice-focus");
1003
+ }
1004
+ return this.pending_backstroke = null;
1005
+ };
1006
+
1007
+ Chosen.prototype.keydown_checker = function(evt) {
1008
+ var stroke, _ref;
1009
+ stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
1010
+ this.search_field_scale();
1011
+ if (stroke !== 8 && this.pending_backstroke) {
1012
+ this.clear_backstroke();
1013
+ }
1014
+ switch (stroke) {
1015
+ case 8:
1016
+ this.backstroke_length = this.search_field.val().length;
1017
+ break;
1018
+ case 9:
1019
+ if (this.results_showing && !this.is_multiple) {
1020
+ this.result_select(evt);
1021
+ }
1022
+ this.mouse_on_container = false;
1023
+ break;
1024
+ case 13:
1025
+ evt.preventDefault();
1026
+ break;
1027
+ case 38:
1028
+ evt.preventDefault();
1029
+ this.keyup_arrow();
1030
+ break;
1031
+ case 40:
1032
+ this.keydown_arrow();
1033
+ break;
1034
+ }
1035
+ };
1036
+
1037
+ Chosen.prototype.search_field_scale = function() {
1038
+ var dd_top, div, h, style, style_block, styles, w, _i, _len;
1039
+ if (this.is_multiple) {
1040
+ h = 0;
1041
+ w = 0;
1042
+ style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
1043
+ styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
1044
+ for (_i = 0, _len = styles.length; _i < _len; _i++) {
1045
+ style = styles[_i];
1046
+ style_block += style + ":" + this.search_field.css(style) + ";";
1047
+ }
1048
+ div = $('<div />', {
1049
+ 'style': style_block
1050
+ });
1051
+ div.text(this.search_field.val());
1052
+ $('body').append(div);
1053
+ w = div.width() + 25;
1054
+ div.remove();
1055
+ if (w > this.f_width - 10) {
1056
+ w = this.f_width - 10;
1057
+ }
1058
+ this.search_field.css({
1059
+ 'width': w + 'px'
1060
+ });
1061
+ dd_top = this.container.height();
1062
+ return this.dropdown.css({
1063
+ "top": dd_top + "px"
1064
+ });
1065
+ }
1066
+ };
1067
+
1068
+ Chosen.prototype.generate_random_id = function() {
1069
+ var string;
1070
+ string = "sel" + this.generate_random_char() + this.generate_random_char() + this.generate_random_char();
1071
+ while ($("#" + string).length > 0) {
1072
+ string += this.generate_random_char();
1073
+ }
1074
+ return string;
1075
+ };
1076
+
1077
+ return Chosen;
1078
+
1079
+ })(AbstractChosen);
1080
+
1081
+ root.Chosen = Chosen;
1082
+
1083
+ get_side_border_padding = function(elmt) {
1084
+ var side_border_padding;
1085
+ return side_border_padding = elmt.outerWidth() - elmt.width();
1086
+ };
1087
+
1088
+ root.get_side_border_padding = get_side_border_padding;
1089
+
1090
+ }).call(this);
assets/js/chosen/chosen.jquery.min.js CHANGED
@@ -1,10 +1,10 @@
1
- // Chosen, a Select Box Enhancer for jQuery and Protoype
2
- // by Patrick Filler for Harvest, http://getharvest.com
3
- //
4
- // Version 0.9.12
5
- // Full source at https://github.com/harvesthq/chosen
6
- // Copyright (c) 2011 Harvest http://getharvest.com
7
-
8
- // MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
9
- // This file is generated by `cake build`, do not edit it by hand.
10
  (function(){var e;e=function(){function e(){this.options_index=0,this.parsed=[]}return e.prototype.add_node=function(e){return e.nodeName.toUpperCase()==="OPTGROUP"?this.add_group(e):this.add_option(e)},e.prototype.add_group=function(e){var t,n,r,i,s,o;t=this.parsed.length,this.parsed.push({array_index:t,group:!0,label:e.label,children:0,disabled:e.disabled}),s=e.childNodes,o=[];for(r=0,i=s.length;r<i;r++)n=s[r],o.push(this.add_option(n,t,e.disabled));return o},e.prototype.add_option=function(e,t,n){if(e.nodeName.toUpperCase()==="OPTION")return e.text!==""?(t!=null&&(this.parsed[t].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:e.value,text:e.text,html:e.innerHTML,selected:e.selected,disabled:n===!0?n:e.disabled,group_array_index:t,classes:e.className,style:e.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},e}(),e.select_to_array=function(t){var n,r,i,s,o;r=new e,o=t.childNodes;for(i=0,s=o.length;i<s;i++)n=o[i],r.add_node(n);return r.parsed},this.SelectParser=e}).call(this),function(){var e,t;t=this,e=function(){function e(e,t){this.form_field=e,this.options=t!=null?t:{},this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return e.prototype.set_default_values=function(){var e=this;return this.click_test_action=function(t){return e.test_active_click(t)},this.activate_action=function(t){return e.activate_field(t)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=this.options.enable_split_word_search!=null?this.options.enable_split_word_search:!0,this.search_contains=this.options.search_contains||!1,this.choices=0,this.single_backstroke_delete=this.options.single_backstroke_delete||!1,this.max_selected_options=this.options.max_selected_options||Infinity,this.inherit_select_classes=this.options.inherit_select_classes||!1},e.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||"Select Some Options":this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||"Select an Option",this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||"No results match"},e.prototype.mouse_enter=function(){return this.mouse_on_container=!0},e.prototype.mouse_leave=function(){return this.mouse_on_container=!1},e.prototype.input_focus=function(e){var t=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return t.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},e.prototype.input_blur=function(e){var t=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(){return t.blur_test()},100)},e.prototype.result_add_option=function(e){var t,n;return e.disabled?"":(e.dom_id=this.container_id+"_o_"+e.array_index,t=e.selected&&this.is_multiple?[]:["active-result"],e.selected&&t.push("result-selected"),e.group_array_index!=null&&t.push("group-option"),e.classes!==""&&t.push(e.classes),n=e.style.cssText!==""?' style="'+e.style+'"':"",'<li id="'+e.dom_id+'" class="'+t.join(" ")+'"'+n+">"+e.html+"</li>")},e.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},e.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},e.prototype.results_search=function(e){return this.results_showing?this.winnow_results():this.results_show()},e.prototype.keyup_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode,this.search_field_scale();switch(t){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:e.preventDefault();if(this.results_showing)return this.result_select(e);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},e.prototype.generate_field_id=function(){var e;return e=this.generate_random_id(),this.form_field.id=e,e},e.prototype.generate_random_char=function(){var e,t,n;return e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",n=Math.floor(Math.random()*e.length),t=e.substring(n,n+1)},e}(),t.AbstractChosen=e}.call(this),function(){var e,t,n,r,i={}.hasOwnProperty,s=function(e,t){function r(){this.constructor=e}for(var n in t)i.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};r=this,e=jQuery,e.fn.extend({chosen:function(n){var r,i,s;return s=navigator.userAgent.toLowerCase(),i=/(msie) ([\w.]+)/.exec(s)||[],r={name:i[1]||"",version:i[2]||"0"},r.name==="msie"&&(r.version==="6.0"||r.version==="7.0"&&document.documentMode===7)?this:this.each(function(r){var i;i=e(this);if(!i.hasClass("chzn-done"))return i.data("chosen",new t(this,n))})}}),t=function(t){function i(){return i.__super__.constructor.apply(this,arguments)}return s(i,t),i.prototype.setup=function(){return this.form_field_jq=e(this.form_field),this.current_value=this.form_field_jq.val(),this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")},i.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")},i.prototype.set_up_html=function(){var t,r,i,s,o,u;return this.container_id=this.form_field.id.length?this.form_field.id.replace(/[^\w]/g,"_"):this.generate_field_id(),this.container_id+="_chzn",t=["chzn-container"],t.push("chzn-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&t.push(this.form_field.className),this.is_rtl&&t.push("chzn-rtl"),this.f_width=this.form_field_jq.outerWidth(),i={id:this.container_id,"class":t.join(" "),style:"width: "+this.f_width+"px;",title:this.form_field.title},r=e("<div />",i),this.is_multiple?r.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'):r.html('<a href="javascript:void(0)" class="chzn-single chzn-default" tabindex="-1"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.form_field_jq.hide().after(r),this.container=e("#"+this.container_id),this.dropdown=this.container.find("div.chzn-drop").first(),s=this.container.height(),o=this.f_width-n(this.dropdown),this.dropdown.css({width:o+"px",top:s+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),u=o-n(this.search_container)-n(this.search_field),this.search_field.css({width:u+"px"})),this.results_build(),this.set_tab_index(),this.form_field_jq.trigger("liszt:ready",{chosen:this})},i.prototype.register_observers=function(){var e=this;return this.container.mousedown(function(t){e.container_mousedown(t)}),this.container.mouseup(function(t){e.container_mouseup(t)}),this.container.mouseenter(function(t){e.mouse_enter(t)}),this.container.mouseleave(function(t){e.mouse_leave(t)}),this.search_results.mouseup(function(t){e.search_results_mouseup(t)}),this.search_results.mouseover(function(t){e.search_results_mouseover(t)}),this.search_results.mouseout(function(t){e.search_results_mouseout(t)}),this.form_field_jq.bind("liszt:updated",function(t){e.results_update_field(t)}),this.form_field_jq.bind("liszt:activate",function(t){e.activate_field(t)}),this.form_field_jq.bind("liszt:open",function(t){e.container_mousedown(t)}),this.search_field.blur(function(t){e.input_blur(t)}),this.search_field.keyup(function(t){e.keyup_checker(t)}),this.search_field.keydown(function(t){e.keydown_checker(t)}),this.search_field.focus(function(t){e.input_focus(t)}),this.is_multiple?this.search_choices.click(function(t){e.choices_click(t)}):this.container.click(function(e){e.preventDefault()})},i.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled)return this.container.addClass("chzn-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus",this.activate_action),this.close_field();this.container.removeClass("chzn-disabled"),this.search_field[0].disabled=!1;if(!this.is_multiple)return this.selected_item.bind("focus",this.activate_action)},i.prototype.container_mousedown=function(t){var n;if(!this.is_disabled)return n=t!=null?e(t.target).hasClass("search-choice-close"):!1,t&&t.type==="mousedown"&&!this.results_showing&&t.preventDefault(),!this.pending_destroy_click&&!n?(this.active_field?!this.is_multiple&&t&&(e(t.target)[0]===this.selected_item[0]||e(t.target).parents("a.chzn-single").length)&&(t.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),e(document).click(this.click_test_action),this.results_show()),this.activate_field()):this.pending_destroy_click=!1},i.prototype.container_mouseup=function(e){if(e.target.nodeName==="ABBR"&&!this.is_disabled)return this.results_reset(e)},i.prototype.blur_test=function(e){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},i.prototype.close_field=function(){return e(document).unbind("click",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},i.prototype.activate_field=function(){return this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},i.prototype.test_active_click=function(t){return e(t.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},i.prototype.results_build=function(){var e,t,n,i,s;this.parsing=!0,this.results_data=r.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||(this.selected_item.addClass("chzn-default").find("span").text(this.default_text),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?this.container.addClass("chzn-container-single-nosearch"):this.container.removeClass("chzn-container-single-nosearch")),e="",s=this.results_data;for(n=0,i=s.length;n<i;n++)t=s[n],t.group?e+=this.result_add_group(t):t.empty||(e+=this.result_add_option(t),t.selected&&this.is_multiple?this.choice_build(t):t.selected&&!this.is_multiple&&(this.selected_item.removeClass("chzn-default").find("span").text(t.text),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.html(e),this.parsing=!1},i.prototype.result_add_group=function(t){return t.disabled?"":(t.dom_id=this.container_id+"_g_"+t.array_index,'<li id="'+t.dom_id+'" class="group-result">'+e("<div />").text(t.label).html()+"</li>")},i.prototype.result_do_highlight=function(e){var t,n,r,i,s;if(e.length){this.result_clear_highlight(),this.result_highlight=e,this.result_highlight.addClass("highlighted"),r=parseInt(this.search_results.css("maxHeight"),10),s=this.search_results.scrollTop(),i=r+s,n=this.result_highlight.position().top+this.search_results.scrollTop(),t=n+this.result_highlight.outerHeight();if(t>=i)return this.search_results.scrollTop(t-r>0?t-r:0);if(n<s)return this.search_results.scrollTop(n)}},i.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},i.prototype.results_show=function(){var e;if(!this.is_multiple)this.selected_item.addClass("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected);else if(this.max_selected_options<=this.choices)return this.form_field_jq.trigger("liszt:maxselected",{chosen:this}),!1;return e=this.is_multiple?this.container.height():this.container.height()-1,this.form_field_jq.trigger("liszt:showing_dropdown",{chosen:this}),this.dropdown.css({top:e+"px",left:0}),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results()},i.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClass("chzn-single-with-drop"),this.result_clear_highlight(),this.form_field_jq.trigger("liszt:hiding_dropdown",{chosen:this}),this.dropdown.css({left:"-9000px"}),this.results_showing=!1},i.prototype.set_tab_index=function(e){var t;if(this.form_field_jq.attr("tabindex"))return t=this.form_field_jq.attr("tabindex"),this.form_field_jq.attr("tabindex",-1),this.search_field.attr("tabindex",t)},i.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},i.prototype.search_results_mouseup=function(t){var n;n=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first();if(n.length)return this.result_highlight=n,this.result_select(t),this.search_field.focus()},i.prototype.search_results_mouseover=function(t){var n;n=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first();if(n)return this.result_do_highlight(n)},i.prototype.search_results_mouseout=function(t){if(e(t.target).hasClass("active-result"))return this.result_clear_highlight()},i.prototype.choices_click=function(t){t.preventDefault();if(this.active_field&&!e(t.target).hasClass("search-choice")&&!this.results_showing)return this.results_show()},i.prototype.choice_build=function(t){var n,r,i,s=this;return this.is_multiple&&this.max_selected_options<=this.choices?(this.form_field_jq.trigger("liszt:maxselected",{chosen:this}),!1):(n=this.container_id+"_c_"+t.array_index,this.choices+=1,t.disabled?r='<li class="search-choice search-choice-disabled" id="'+n+'"><span>'+t.html+"</span></li>":r='<li class="search-choice" id="'+n+'"><span>'+t.html+'</span><a href="javascript:void(0)" class="search-choice-close" rel="'+t.array_index+'"></a></li>',this.search_container.before(r),i=e("#"+n).find("a").first(),i.click(function(e){return s.choice_destroy_link_click(e)}))},i.prototype.choice_destroy_link_click=function(t){return t.preventDefault(),this.is_disabled?t.stopPropagation:(this.pending_destroy_click=!0,this.choice_destroy(e(t.target)))},i.prototype.choice_destroy=function(e){if(this.result_deselect(e.attr("rel")))return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),e.parents("li").first().remove(),this.search_field_scale()},i.prototype.results_reset=function(){this.form_field.options[0].selected=!0,this.selected_item.find("span").text(this.default_text),this.is_multiple||this.selected_item.addClass("chzn-default"),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()},i.prototype.results_reset_cleanup=function(){return this.current_value=this.form_field_jq.val(),this.selected_item.find("abbr").remove()},i.prototype.result_select=function(e){var t,n,r,i;if(this.result_highlight)return t=this.result_highlight,n=t.attr("id"),this.result_clear_highlight(),this.is_multiple?this.result_deactivate(t):(this.search_results.find(".result-selected").removeClass("result-selected"),this.result_single_selected=t,this.selected_item.removeClass("chzn-default")),t.addClass("result-selected"),i=n.substr(n.lastIndexOf("_")+1),r=this.results_data[i],r.selected=!0,this.form_field.options[r.options_index].selected=!0,this.is_multiple?this.choice_build(r):(this.selected_item.find("span").first().text(r.text),this.allow_single_deselect&&this.single_deselect_control_build()),(!e.metaKey&&!e.ctrlKey||!this.is_multiple)&&this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field_jq.val()!==this.current_value)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[r.options_index].value}),this.current_value=this.form_field_jq.val(),this.search_field_scale()},i.prototype.result_activate=function(e){return e.addClass("active-result")},i.prototype.result_deactivate=function(e){return e.removeClass("active-result")},i.prototype.result_deselect=function(t){var n,r;return r=this.results_data[t],this.form_field.options[r.options_index].disabled?!1:(r.selected=!1,this.form_field.options[r.options_index].selected=!1,n=e("#"+this.container_id+"_o_"+t),n.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[r.options_index].value}),this.search_field_scale(),!0)},i.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&this.selected_item.find("abbr").length<1)return this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>')},i.prototype.winnow_results=function(){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y;this.no_results_clear(),f=0,l=this.search_field.val()===this.default_text?"":e("<div/>").text(e.trim(this.search_field.val())).html(),o=this.search_contains?"":"^",s=new RegExp(o+l.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),p=new RegExp(l.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),y=this.results_data;for(d=0,m=y.length;d<m;d++){n=y[d];if(!n.disabled&&!n.empty)if(n.group)e("#"+n.dom_id).css("display","none");else if(!this.is_multiple||!n.selected){t=!1,a=n.dom_id,u=e("#"+a);if(s.test(n.html))t=!0,f+=1;else if(this.enable_split_word_search&&(n.html.indexOf(" ")>=0||n.html.indexOf("[")===0)){i=n.html.replace(/\[|\]/g,"").split(" ");if(i.length)for(v=0,g=i.length;v<g;v++)r=i[v],s.test(r)&&(t=!0,f+=1)}t?(l.length?(c=n.html.search(p),h=n.html.substr(0,c+l.length)+"</em>"+n.html.substr(c+l.length),h=h.substr(0,c)+"<em>"+h.substr(c)):h=n.html,u.html(h),this.result_activate(u),n.group_array_index!=null&&e("#"+this.results_data[n.group_array_index].dom_id).css("display","list-item")):(this.result_highlight&&a===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(u))}}return f<1&&l.length?this.no_results(l):this.winnow_results_set_highlight()},i.prototype.winnow_results_clear=function(){var t,n,r,i,s;this.search_field.val(""),n=this.search_results.find("li"),s=[];for(r=0,i=n.length;r<i;r++)t=n[r],t=e(t),t.hasClass("group-result")?s.push(t.css("display","auto")):!this.is_multiple||!t.hasClass("result-selected")?s.push(this.result_activate(t)):s.push(void 0);return s},i.prototype.winnow_results_set_highlight=function(){var e,t;if(!this.result_highlight){t=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),e=t.length?t.first():this.search_results.find(".active-result").first();if(e!=null)return this.result_do_highlight(e)}},i.prototype.no_results=function(t){var n;return n=e('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),n.find("span").first().html(t),this.search_results.append(n)},i.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},i.prototype.keydown_arrow=function(){var t,n;this.result_highlight?this.results_showing&&(n=this.result_highlight.nextAll("li.active-result").first(),n&&this.result_do_highlight(n)):(t=this.search_results.find("li.active-result").first(),t&&this.result_do_highlight(e(t)));if(!this.results_showing)return this.results_show()},i.prototype.keyup_arrow=function(){var e;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return e=this.result_highlight.prevAll("li.active-result"),e.length?this.result_do_highlight(e.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())},i.prototype.keydown_backstroke=function(){var e;if(this.pending_backstroke)return this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke();e=this.search_container.siblings("li.search-choice").last();if(e.length&&!e.hasClass("search-choice-disabled"))return this.pending_backstroke=e,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")},i.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},i.prototype.keydown_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode,this.search_field_scale(),t!==8&&this.pending_backstroke&&this.clear_backstroke();switch(t){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(e),this.mouse_on_container=!1;break;case 13:e.preventDefault();break;case 38:e.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},i.prototype.search_field_scale=function(){var t,n,r,i,s,o,u,a,f;if(this.is_multiple){r=0,u=0,s="position:absolute; left: -1000px; top: -1000px; display:none;",o=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(a=0,f=o.length;a<f;a++)i=o[a],s+=i+":"+this.search_field.css(i)+";";return n=e("<div />",{style:s}),n.text(this.search_field.val()),e("body").append(n),u=n.width()+25,n.remove(),u>this.f_width-10&&(u=this.f_width-10),this.search_field.css({width:u+"px"}),t=this.container.height(),this.dropdown.css({top:t+"px"})}},i.prototype.generate_random_id=function(){var t;t="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(e("#"+t).length>0)t+=this.generate_random_char();return t},i}(AbstractChosen),r.Chosen=t,n=function(e){var t;return t=e.outerWidth()-e.width()},r.get_side_border_padding=n}.call(this);
1
+ // Chosen, a Select Box Enhancer for jQuery and Protoype
2
+ // by Patrick Filler for Harvest, http://getharvest.com
3
+ //
4
+ // Version 0.9.12
5
+ // Full source at https://github.com/harvesthq/chosen
6
+ // Copyright (c) 2011 Harvest http://getharvest.com
7
+
8
+ // MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
9
+ // This file is generated by `cake build`, do not edit it by hand.
10
  (function(){var e;e=function(){function e(){this.options_index=0,this.parsed=[]}return e.prototype.add_node=function(e){return e.nodeName.toUpperCase()==="OPTGROUP"?this.add_group(e):this.add_option(e)},e.prototype.add_group=function(e){var t,n,r,i,s,o;t=this.parsed.length,this.parsed.push({array_index:t,group:!0,label:e.label,children:0,disabled:e.disabled}),s=e.childNodes,o=[];for(r=0,i=s.length;r<i;r++)n=s[r],o.push(this.add_option(n,t,e.disabled));return o},e.prototype.add_option=function(e,t,n){if(e.nodeName.toUpperCase()==="OPTION")return e.text!==""?(t!=null&&(this.parsed[t].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:e.value,text:e.text,html:e.innerHTML,selected:e.selected,disabled:n===!0?n:e.disabled,group_array_index:t,classes:e.className,style:e.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},e}(),e.select_to_array=function(t){var n,r,i,s,o;r=new e,o=t.childNodes;for(i=0,s=o.length;i<s;i++)n=o[i],r.add_node(n);return r.parsed},this.SelectParser=e}).call(this),function(){var e,t;t=this,e=function(){function e(e,t){this.form_field=e,this.options=t!=null?t:{},this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.finish_setup()}return e.prototype.set_default_values=function(){var e=this;return this.click_test_action=function(t){return e.test_active_click(t)},this.activate_action=function(t){return e.activate_field(t)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.result_single_selected=null,this.allow_single_deselect=this.options.allow_single_deselect!=null&&this.form_field.options[0]!=null&&this.form_field.options[0].text===""?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=this.options.enable_split_word_search!=null?this.options.enable_split_word_search:!0,this.search_contains=this.options.search_contains||!1,this.choices=0,this.single_backstroke_delete=this.options.single_backstroke_delete||!1,this.max_selected_options=this.options.max_selected_options||Infinity,this.inherit_select_classes=this.options.inherit_select_classes||!1},e.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||"Select Some Options":this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||"Select an Option",this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||"No results match"},e.prototype.mouse_enter=function(){return this.mouse_on_container=!0},e.prototype.mouse_leave=function(){return this.mouse_on_container=!1},e.prototype.input_focus=function(e){var t=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return t.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},e.prototype.input_blur=function(e){var t=this;if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(){return t.blur_test()},100)},e.prototype.result_add_option=function(e){var t,n;return e.disabled?"":(e.dom_id=this.container_id+"_o_"+e.array_index,t=e.selected&&this.is_multiple?[]:["active-result"],e.selected&&t.push("result-selected"),e.group_array_index!=null&&t.push("group-option"),e.classes!==""&&t.push(e.classes),n=e.style.cssText!==""?' style="'+e.style+'"':"",'<li id="'+e.dom_id+'" class="'+t.join(" ")+'"'+n+">"+e.html+"</li>")},e.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.result_single_selected=null,this.results_build()},e.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},e.prototype.results_search=function(e){return this.results_showing?this.winnow_results():this.results_show()},e.prototype.keyup_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode,this.search_field_scale();switch(t){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:e.preventDefault();if(this.results_showing)return this.result_select(e);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},e.prototype.generate_field_id=function(){var e;return e=this.generate_random_id(),this.form_field.id=e,e},e.prototype.generate_random_char=function(){var e,t,n;return e="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",n=Math.floor(Math.random()*e.length),t=e.substring(n,n+1)},e}(),t.AbstractChosen=e}.call(this),function(){var e,t,n,r,i={}.hasOwnProperty,s=function(e,t){function r(){this.constructor=e}for(var n in t)i.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};r=this,e=jQuery,e.fn.extend({chosen:function(n){var r,i,s;return s=navigator.userAgent.toLowerCase(),i=/(msie) ([\w.]+)/.exec(s)||[],r={name:i[1]||"",version:i[2]||"0"},r.name==="msie"&&(r.version==="6.0"||r.version==="7.0"&&document.documentMode===7)?this:this.each(function(r){var i;i=e(this);if(!i.hasClass("chzn-done"))return i.data("chosen",new t(this,n))})}}),t=function(t){function i(){return i.__super__.constructor.apply(this,arguments)}return s(i,t),i.prototype.setup=function(){return this.form_field_jq=e(this.form_field),this.current_value=this.form_field_jq.val(),this.is_rtl=this.form_field_jq.hasClass("chzn-rtl")},i.prototype.finish_setup=function(){return this.form_field_jq.addClass("chzn-done")},i.prototype.set_up_html=function(){var t,r,i,s,o,u;return this.container_id=this.form_field.id.length?this.form_field.id.replace(/[^\w]/g,"_"):this.generate_field_id(),this.container_id+="_chzn",t=["chzn-container"],t.push("chzn-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&t.push(this.form_field.className),this.is_rtl&&t.push("chzn-rtl"),this.f_width=this.form_field_jq.outerWidth(),i={id:this.container_id,"class":t.join(" "),style:"width: "+this.f_width+"px;",title:this.form_field.title},r=e("<div />",i),this.is_multiple?r.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'):r.html('<a href="javascript:void(0)" class="chzn-single chzn-default" tabindex="-1"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'),this.form_field_jq.hide().after(r),this.container=e("#"+this.container_id),this.dropdown=this.container.find("div.chzn-drop").first(),s=this.container.height(),o=this.f_width-n(this.dropdown),this.dropdown.css({width:o+"px",top:s+"px"}),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chzn-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chzn-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chzn-search").first(),this.selected_item=this.container.find(".chzn-single").first(),u=o-n(this.search_container)-n(this.search_field),this.search_field.css({width:u+"px"})),this.results_build(),this.set_tab_index(),this.form_field_jq.trigger("liszt:ready",{chosen:this})},i.prototype.register_observers=function(){var e=this;return this.container.mousedown(function(t){e.container_mousedown(t)}),this.container.mouseup(function(t){e.container_mouseup(t)}),this.container.mouseenter(function(t){e.mouse_enter(t)}),this.container.mouseleave(function(t){e.mouse_leave(t)}),this.search_results.mouseup(function(t){e.search_results_mouseup(t)}),this.search_results.mouseover(function(t){e.search_results_mouseover(t)}),this.search_results.mouseout(function(t){e.search_results_mouseout(t)}),this.form_field_jq.bind("liszt:updated",function(t){e.results_update_field(t)}),this.form_field_jq.bind("liszt:activate",function(t){e.activate_field(t)}),this.form_field_jq.bind("liszt:open",function(t){e.container_mousedown(t)}),this.search_field.blur(function(t){e.input_blur(t)}),this.search_field.keyup(function(t){e.keyup_checker(t)}),this.search_field.keydown(function(t){e.keydown_checker(t)}),this.search_field.focus(function(t){e.input_focus(t)}),this.is_multiple?this.search_choices.click(function(t){e.choices_click(t)}):this.container.click(function(e){e.preventDefault()})},i.prototype.search_field_disabled=function(){this.is_disabled=this.form_field_jq[0].disabled;if(this.is_disabled)return this.container.addClass("chzn-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus",this.activate_action),this.close_field();this.container.removeClass("chzn-disabled"),this.search_field[0].disabled=!1;if(!this.is_multiple)return this.selected_item.bind("focus",this.activate_action)},i.prototype.container_mousedown=function(t){var n;if(!this.is_disabled)return n=t!=null?e(t.target).hasClass("search-choice-close"):!1,t&&t.type==="mousedown"&&!this.results_showing&&t.preventDefault(),!this.pending_destroy_click&&!n?(this.active_field?!this.is_multiple&&t&&(e(t.target)[0]===this.selected_item[0]||e(t.target).parents("a.chzn-single").length)&&(t.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),e(document).click(this.click_test_action),this.results_show()),this.activate_field()):this.pending_destroy_click=!1},i.prototype.container_mouseup=function(e){if(e.target.nodeName==="ABBR"&&!this.is_disabled)return this.results_reset(e)},i.prototype.blur_test=function(e){if(!this.active_field&&this.container.hasClass("chzn-container-active"))return this.close_field()},i.prototype.close_field=function(){return e(document).unbind("click",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chzn-container-active"),this.winnow_results_clear(),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},i.prototype.activate_field=function(){return this.container.addClass("chzn-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},i.prototype.test_active_click=function(t){return e(t.target).parents("#"+this.container_id).length?this.active_field=!0:this.close_field()},i.prototype.results_build=function(){var e,t,n,i,s;this.parsing=!0,this.results_data=r.SelectParser.select_to_array(this.form_field),this.is_multiple&&this.choices>0?(this.search_choices.find("li.search-choice").remove(),this.choices=0):this.is_multiple||(this.selected_item.addClass("chzn-default").find("span").text(this.default_text),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?this.container.addClass("chzn-container-single-nosearch"):this.container.removeClass("chzn-container-single-nosearch")),e="",s=this.results_data;for(n=0,i=s.length;n<i;n++)t=s[n],t.group?e+=this.result_add_group(t):t.empty||(e+=this.result_add_option(t),t.selected&&this.is_multiple?this.choice_build(t):t.selected&&!this.is_multiple&&(this.selected_item.removeClass("chzn-default").find("span").text(t.text),this.allow_single_deselect&&this.single_deselect_control_build()));return this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.search_results.html(e),this.parsing=!1},i.prototype.result_add_group=function(t){return t.disabled?"":(t.dom_id=this.container_id+"_g_"+t.array_index,'<li id="'+t.dom_id+'" class="group-result">'+e("<div />").text(t.label).html()+"</li>")},i.prototype.result_do_highlight=function(e){var t,n,r,i,s;if(e.length){this.result_clear_highlight(),this.result_highlight=e,this.result_highlight.addClass("highlighted"),r=parseInt(this.search_results.css("maxHeight"),10),s=this.search_results.scrollTop(),i=r+s,n=this.result_highlight.position().top+this.search_results.scrollTop(),t=n+this.result_highlight.outerHeight();if(t>=i)return this.search_results.scrollTop(t-r>0?t-r:0);if(n<s)return this.search_results.scrollTop(n)}},i.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},i.prototype.results_show=function(){var e;if(!this.is_multiple)this.selected_item.addClass("chzn-single-with-drop"),this.result_single_selected&&this.result_do_highlight(this.result_single_selected);else if(this.max_selected_options<=this.choices)return this.form_field_jq.trigger("liszt:maxselected",{chosen:this}),!1;return e=this.is_multiple?this.container.height():this.container.height()-1,this.form_field_jq.trigger("liszt:showing_dropdown",{chosen:this}),this.dropdown.css({top:e+"px",left:0}),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results()},i.prototype.results_hide=function(){return this.is_multiple||this.selected_item.removeClass("chzn-single-with-drop"),this.result_clear_highlight(),this.form_field_jq.trigger("liszt:hiding_dropdown",{chosen:this}),this.dropdown.css({left:"-9000px"}),this.results_showing=!1},i.prototype.set_tab_index=function(e){var t;if(this.form_field_jq.attr("tabindex"))return t=this.form_field_jq.attr("tabindex"),this.form_field_jq.attr("tabindex",-1),this.search_field.attr("tabindex",t)},i.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},i.prototype.search_results_mouseup=function(t){var n;n=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first();if(n.length)return this.result_highlight=n,this.result_select(t),this.search_field.focus()},i.prototype.search_results_mouseover=function(t){var n;n=e(t.target).hasClass("active-result")?e(t.target):e(t.target).parents(".active-result").first();if(n)return this.result_do_highlight(n)},i.prototype.search_results_mouseout=function(t){if(e(t.target).hasClass("active-result"))return this.result_clear_highlight()},i.prototype.choices_click=function(t){t.preventDefault();if(this.active_field&&!e(t.target).hasClass("search-choice")&&!this.results_showing)return this.results_show()},i.prototype.choice_build=function(t){var n,r,i,s=this;return this.is_multiple&&this.max_selected_options<=this.choices?(this.form_field_jq.trigger("liszt:maxselected",{chosen:this}),!1):(n=this.container_id+"_c_"+t.array_index,this.choices+=1,t.disabled?r='<li class="search-choice search-choice-disabled" id="'+n+'"><span>'+t.html+"</span></li>":r='<li class="search-choice" id="'+n+'"><span>'+t.html+'</span><a href="javascript:void(0)" class="search-choice-close" rel="'+t.array_index+'"></a></li>',this.search_container.before(r),i=e("#"+n).find("a").first(),i.click(function(e){return s.choice_destroy_link_click(e)}))},i.prototype.choice_destroy_link_click=function(t){return t.preventDefault(),this.is_disabled?t.stopPropagation:(this.pending_destroy_click=!0,this.choice_destroy(e(t.target)))},i.prototype.choice_destroy=function(e){if(this.result_deselect(e.attr("rel")))return this.choices-=1,this.show_search_field_default(),this.is_multiple&&this.choices>0&&this.search_field.val().length<1&&this.results_hide(),e.parents("li").first().remove(),this.search_field_scale()},i.prototype.results_reset=function(){this.form_field.options[0].selected=!0,this.selected_item.find("span").text(this.default_text),this.is_multiple||this.selected_item.addClass("chzn-default"),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change");if(this.active_field)return this.results_hide()},i.prototype.results_reset_cleanup=function(){return this.current_value=this.form_field_jq.val(),this.selected_item.find("abbr").remove()},i.prototype.result_select=function(e){var t,n,r,i;if(this.result_highlight)return t=this.result_highlight,n=t.attr("id"),this.result_clear_highlight(),this.is_multiple?this.result_deactivate(t):(this.search_results.find(".result-selected").removeClass("result-selected"),this.result_single_selected=t,this.selected_item.removeClass("chzn-default")),t.addClass("result-selected"),i=n.substr(n.lastIndexOf("_")+1),r=this.results_data[i],r.selected=!0,this.form_field.options[r.options_index].selected=!0,this.is_multiple?this.choice_build(r):(this.selected_item.find("span").first().text(r.text),this.allow_single_deselect&&this.single_deselect_control_build()),(!e.metaKey&&!e.ctrlKey||!this.is_multiple)&&this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field_jq.val()!==this.current_value)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[r.options_index].value}),this.current_value=this.form_field_jq.val(),this.search_field_scale()},i.prototype.result_activate=function(e){return e.addClass("active-result")},i.prototype.result_deactivate=function(e){return e.removeClass("active-result")},i.prototype.result_deselect=function(t){var n,r;return r=this.results_data[t],this.form_field.options[r.options_index].disabled?!1:(r.selected=!1,this.form_field.options[r.options_index].selected=!1,n=e("#"+this.container_id+"_o_"+t),n.removeClass("result-selected").addClass("active-result").show(),this.result_clear_highlight(),this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[r.options_index].value}),this.search_field_scale(),!0)},i.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect&&this.selected_item.find("abbr").length<1)return this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>')},i.prototype.winnow_results=function(){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y;this.no_results_clear(),f=0,l=this.search_field.val()===this.default_text?"":e("<div/>").text(e.trim(this.search_field.val())).html(),o=this.search_contains?"":"^",s=new RegExp(o+l.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),p=new RegExp(l.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i"),y=this.results_data;for(d=0,m=y.length;d<m;d++){n=y[d];if(!n.disabled&&!n.empty)if(n.group)e("#"+n.dom_id).css("display","none");else if(!this.is_multiple||!n.selected){t=!1,a=n.dom_id,u=e("#"+a);if(s.test(n.html))t=!0,f+=1;else if(this.enable_split_word_search&&(n.html.indexOf(" ")>=0||n.html.indexOf("[")===0)){i=n.html.replace(/\[|\]/g,"").split(" ");if(i.length)for(v=0,g=i.length;v<g;v++)r=i[v],s.test(r)&&(t=!0,f+=1)}t?(l.length?(c=n.html.search(p),h=n.html.substr(0,c+l.length)+"</em>"+n.html.substr(c+l.length),h=h.substr(0,c)+"<em>"+h.substr(c)):h=n.html,u.html(h),this.result_activate(u),n.group_array_index!=null&&e("#"+this.results_data[n.group_array_index].dom_id).css("display","list-item")):(this.result_highlight&&a===this.result_highlight.attr("id")&&this.result_clear_highlight(),this.result_deactivate(u))}}return f<1&&l.length?this.no_results(l):this.winnow_results_set_highlight()},i.prototype.winnow_results_clear=function(){var t,n,r,i,s;this.search_field.val(""),n=this.search_results.find("li"),s=[];for(r=0,i=n.length;r<i;r++)t=n[r],t=e(t),t.hasClass("group-result")?s.push(t.css("display","auto")):!this.is_multiple||!t.hasClass("result-selected")?s.push(this.result_activate(t)):s.push(void 0);return s},i.prototype.winnow_results_set_highlight=function(){var e,t;if(!this.result_highlight){t=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),e=t.length?t.first():this.search_results.find(".active-result").first();if(e!=null)return this.result_do_highlight(e)}},i.prototype.no_results=function(t){var n;return n=e('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),n.find("span").first().html(t),this.search_results.append(n)},i.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},i.prototype.keydown_arrow=function(){var t,n;this.result_highlight?this.results_showing&&(n=this.result_highlight.nextAll("li.active-result").first(),n&&this.result_do_highlight(n)):(t=this.search_results.find("li.active-result").first(),t&&this.result_do_highlight(e(t)));if(!this.results_showing)return this.results_show()},i.prototype.keyup_arrow=function(){var e;if(!this.results_showing&&!this.is_multiple)return this.results_show();if(this.result_highlight)return e=this.result_highlight.prevAll("li.active-result"),e.length?this.result_do_highlight(e.first()):(this.choices>0&&this.results_hide(),this.result_clear_highlight())},i.prototype.keydown_backstroke=function(){var e;if(this.pending_backstroke)return this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke();e=this.search_container.siblings("li.search-choice").last();if(e.length&&!e.hasClass("search-choice-disabled"))return this.pending_backstroke=e,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")},i.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},i.prototype.keydown_checker=function(e){var t,n;t=(n=e.which)!=null?n:e.keyCode,this.search_field_scale(),t!==8&&this.pending_backstroke&&this.clear_backstroke();switch(t){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(e),this.mouse_on_container=!1;break;case 13:e.preventDefault();break;case 38:e.preventDefault(),this.keyup_arrow();break;case 40:this.keydown_arrow()}},i.prototype.search_field_scale=function(){var t,n,r,i,s,o,u,a,f;if(this.is_multiple){r=0,u=0,s="position:absolute; left: -1000px; top: -1000px; display:none;",o=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(a=0,f=o.length;a<f;a++)i=o[a],s+=i+":"+this.search_field.css(i)+";";return n=e("<div />",{style:s}),n.text(this.search_field.val()),e("body").append(n),u=n.width()+25,n.remove(),u>this.f_width-10&&(u=this.f_width-10),this.search_field.css({width:u+"px"}),t=this.container.height(),this.dropdown.css({top:t+"px"})}},i.prototype.generate_random_id=function(){var t;t="sel"+this.generate_random_char()+this.generate_random_char()+this.generate_random_char();while(e("#"+t).length>0)t+=this.generate_random_char();return t},i}(AbstractChosen),r.Chosen=t,n=function(e){var t;return t=e.outerWidth()-e.width()},r.get_side_border_padding=n}.call(this);
assets/js/dlm-uninstall.js CHANGED
@@ -1,70 +1,70 @@
1
- jQuery(document).ready(function ($) {
2
-
3
- var uninstall = $("a.uninstall-dlm"),
4
- formContainer = $('#dlm-uninstall-form');
5
-
6
- formContainer.on('click', '#delete_all', function () {
7
- if ( $('#delete_all').is(':checked') ) {
8
- $('#delete_options').prop('checked', true);
9
- $('#delete_transients').prop('checked', true);
10
- $('#delete_cpt').prop('checked', true);
11
- $('#delete_set_tables').prop('checked', true);
12
- } else {
13
- $('#delete_options').prop('checked', false);
14
- $('#delete_transients').prop('checked', false);
15
- $('#delete_cpt').prop('checked', false);
16
- $('#delete_set_tables').prop('checked', false);
17
- }
18
- });
19
-
20
- $(uninstall).on("click", function () {
21
-
22
- $('body').toggleClass('dlm-uninstall-form-active');
23
- formContainer.fadeIn();
24
-
25
- formContainer.on('click', '#dlm-uninstall-submit-form', function (e) {
26
- formContainer.addClass('toggle-spinner');
27
- var selectedOptions = {
28
- delete_options: ($('#delete_options').is(':checked')) ? 1 : 0,
29
- delete_transients: ($('#delete_transients').is(':checked')) ? 1 : 0,
30
- delete_cpt: ($('#delete_cpt').is(':checked')) ? 1 : 0,
31
- delete_set_tables: ($('#delete_set_tables').is(':checked')) ? 1 : 0,
32
- };
33
-
34
- var data = {
35
- 'action': 'dlm_uninstall_plugin',
36
- 'security': wpDLMUninstall.nonce,
37
- 'dataType': "json",
38
- 'options': selectedOptions
39
- };
40
-
41
- $.post(
42
- ajaxurl,
43
- data,
44
- function (response) {
45
- // Redirect to plugins page
46
- window.location.href = wpDLMUninstall.redirect_url;
47
- }
48
- );
49
- });
50
-
51
- // If we click outside the form, the form will close
52
- // Stop propagation from form
53
- formContainer.on('click', function (e) {
54
- e.stopPropagation();
55
- });
56
-
57
- $('.dlm-uninstall-form-wrapper, .close-uninstall-form').on('click', function (e) {
58
- e.stopPropagation();
59
- formContainer.fadeOut();
60
- $('body').removeClass('dlm-uninstall-form-active');
61
- });
62
-
63
- $(document).on("keyup", function (e) {
64
- if ( e.key === "Escape" ) {
65
- formContainer.fadeOut();
66
- $('body').removeClass('dlm-uninstall-form-active');
67
- }
68
- });
69
- });
70
  });
1
+ jQuery(document).ready(function ($) {
2
+
3
+ var uninstall = $("a.uninstall-dlm"),
4
+ formContainer = $('#dlm-uninstall-form');
5
+
6
+ formContainer.on('click', '#delete_all', function () {
7
+ if ( $('#delete_all').is(':checked') ) {
8
+ $('#delete_options').prop('checked', true);
9
+ $('#delete_transients').prop('checked', true);
10
+ $('#delete_cpt').prop('checked', true);
11
+ $('#delete_set_tables').prop('checked', true);
12
+ } else {
13
+ $('#delete_options').prop('checked', false);
14
+ $('#delete_transients').prop('checked', false);
15
+ $('#delete_cpt').prop('checked', false);
16
+ $('#delete_set_tables').prop('checked', false);
17
+ }
18
+ });
19
+
20
+ $(uninstall).on("click", function () {
21
+
22
+ $('body').toggleClass('dlm-uninstall-form-active');
23
+ formContainer.fadeIn();
24
+
25
+ formContainer.on('click', '#dlm-uninstall-submit-form', function (e) {
26
+ formContainer.addClass('toggle-spinner');
27
+ var selectedOptions = {
28
+ delete_options: ($('#delete_options').is(':checked')) ? 1 : 0,
29
+ delete_transients: ($('#delete_transients').is(':checked')) ? 1 : 0,
30
+ delete_cpt: ($('#delete_cpt').is(':checked')) ? 1 : 0,
31
+ delete_set_tables: ($('#delete_set_tables').is(':checked')) ? 1 : 0,
32
+ };
33
+
34
+ var data = {
35
+ 'action': 'dlm_uninstall_plugin',
36
+ 'security': wpDLMUninstall.nonce,
37
+ 'dataType': "json",
38
+ 'options': selectedOptions
39
+ };
40
+
41
+ $.post(
42
+ ajaxurl,
43
+ data,
44
+ function (response) {
45
+ // Redirect to plugins page
46
+ window.location.href = wpDLMUninstall.redirect_url;
47
+ }
48
+ );
49
+ });
50
+
51
+ // If we click outside the form, the form will close
52
+ // Stop propagation from form
53
+ formContainer.on('click', function (e) {
54
+ e.stopPropagation();
55
+ });
56
+
57
+ $('.dlm-uninstall-form-wrapper, .close-uninstall-form').on('click', function (e) {
58
+ e.stopPropagation();
59
+ formContainer.fadeOut();
60
+ $('body').removeClass('dlm-uninstall-form-active');
61
+ });
62
+
63
+ $(document).on("keyup", function (e) {
64
+ if ( e.key === "Escape" ) {
65
+ formContainer.fadeOut();
66
+ $('body').removeClass('dlm-uninstall-form-active');
67
+ }
68
+ });
69
+ });
70
  });
assets/js/extensions.js CHANGED
@@ -1,42 +1,42 @@
1
- jQuery( function ( $ ) {
2
-
3
- $.each( $( '.extension_license a' ), function ( k, v ) {
4
- $( v ).click( function () {
5
- var wrap = $( v ).closest( '.extension_license' );
6
-
7
- var ex_ac = (
8
- 'inactive' == $( wrap ).find( '#status' ).val()
9
- ) ? 'activate' : 'deactivate';
10
-
11
- $(wrap).find('.dlm_license_error').remove();
12
-
13
- $.post( ajaxurl, {
14
- action: 'dlm_extension',
15
- nonce: $( '#dlm-ajax-nonce' ).val(),
16
- product_id: $( wrap ).find( '#product_id' ).val(),
17
- key: $( wrap ).find( '#key' ).val(),
18
- email: $( wrap ).find( '#email' ).val(),
19
- extension_action: ex_ac
20
- }, function ( response ) {
21
- if ( response.result == 'failed' ) {
22
- $( wrap ).prepend( $( "<div>" ).addClass( "dlm_license_error" ).html( response.message ) );
23
- } else {
24
- if ( 'activate' == ex_ac ) {
25
- $( wrap ).find( '.license-status' ).addClass( 'active' ).html( 'ACTIVE' );
26
- $( wrap ).find( '.button' ).html( 'Deactivate' );
27
- $( wrap ).find( '#status' ).val( 'active' );
28
- $( wrap ).find( '#key' ).attr( 'disabled', true );
29
- $( wrap ).find( '#email' ).attr( 'disabled', true );
30
- } else {
31
- $( wrap ).find( '.license-status' ).removeClass( 'active' ).html( 'INACTIVE' );
32
- $( wrap ).find( '.button' ).html( 'Activate' );
33
- $( wrap ).find( '#status' ).val( 'inactive' );
34
- $( wrap ).find( '#key' ).attr( 'disabled', false );
35
- $( wrap ).find( '#email' ).attr( 'disabled', false );
36
- }
37
- }
38
- } );
39
-
40
- } );
41
- } );
42
  } );
1
+ jQuery( function ( $ ) {
2
+
3
+ $.each( $( '.extension_license a' ), function ( k, v ) {
4
+ $( v ).click( function () {
5
+ var wrap = $( v ).closest( '.extension_license' );
6
+
7
+ var ex_ac = (
8
+ 'inactive' == $( wrap ).find( '#status' ).val()
9
+ ) ? 'activate' : 'deactivate';
10
+
11
+ $(wrap).find('.dlm_license_error').remove();
12
+
13
+ $.post( ajaxurl, {
14
+ action: 'dlm_extension',
15
+ nonce: $( '#dlm-ajax-nonce' ).val(),
16
+ product_id: $( wrap ).find( '#product_id' ).val(),
17
+ key: $( wrap ).find( '#key' ).val(),
18
+ email: $( wrap ).find( '#email' ).val(),
19
+ extension_action: ex_ac
20
+ }, function ( response ) {
21
+ if ( response.result == 'failed' ) {
22
+ $( wrap ).prepend( $( "<div>" ).addClass( "dlm_license_error" ).html( response.message ) );
23
+ } else {
24
+ if ( 'activate' == ex_ac ) {
25
+ $( wrap ).find( '.license-status' ).addClass( 'active' ).html( 'ACTIVE' );
26
+ $( wrap ).find( '.button' ).html( 'Deactivate' );
27
+ $( wrap ).find( '#status' ).val( 'active' );
28
+ $( wrap ).find( '#key' ).attr( 'disabled', true );
29
+ $( wrap ).find( '#email' ).attr( 'disabled', true );
30
+ } else {
31
+ $( wrap ).find( '.license-status' ).removeClass( 'active' ).html( 'INACTIVE' );
32
+ $( wrap ).find( '.button' ).html( 'Activate' );
33
+ $( wrap ).find( '#status' ).val( 'inactive' );
34
+ $( wrap ).find( '#key' ).attr( 'disabled', false );
35
+ $( wrap ).find( '#email' ).attr( 'disabled', false );
36
+ }
37
+ }
38
+ } );
39
+
40
+ } );
41
+ } );
42
  } );
assets/js/insert-download.js CHANGED
@@ -1,9 +1,9 @@
1
- jQuery( function ($) {
2
- // Browse for file
3
- jQuery( 'body' ).on( 'click', 'a.dlm_insert_download', function () {
4
-
5
- tb_show( dlm_id_strings.insert_download, 'media-upload.php?type=add_download&amp;from=wpdlm01&amp;TB_iframe=true&amp;height=200' );
6
-
7
- return false;
8
- } );
9
  } );
1
+ jQuery( function ($) {
2
+ // Browse for file
3
+ jQuery( 'body' ).on( 'click', 'a.dlm_insert_download', function () {
4
+
5
+ tb_show( dlm_id_strings.insert_download, 'media-upload.php?type=add_download&amp;from=wpdlm01&amp;TB_iframe=true&amp;height=200' );
6
+
7
+ return false;
8
+ } );
9
  } );
assets/js/legacy-upgrader/build/style.css CHANGED
@@ -1,2 +1,2 @@
1
- #dlm_legacy_upgrader_app{height:100%;box-sizing:border-box}._1kijZ35OiZkKapzULElh6m ._2CxVTmzHXSW60xGZZcsG4W{position:relative;background:#419ccb;color:#fff;font-weight:700;padding:10px 10px 10px 35px}._1kijZ35OiZkKapzULElh6m ._2CxVTmzHXSW60xGZZcsG4W img{display:block;position:absolute;left:12px;top:12px;width:15px;height:15px;z-index:10}._1kijZ35OiZkKapzULElh6m ul{width:100%;padding:10px 0}._1kijZ35OiZkKapzULElh6m ul li{display:inline-block;width:50%}._1kijZ35OiZkKapzULElh6m ul li:before{font-family:dashicons!important;speak:none;font-weight:400;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;margin:0 4px 0 0;content:"\F147";top:1px;left:-1px;font-size:1em;line-height:inherit;position:relative;vertical-align:top;font-size:1.5em}._1kijZ35OiZkKapzULElh6m ul li.zV9Nyt3hQBQicmm04gduY:before{color:#000}._1kijZ35OiZkKapzULElh6m ul li._1AzdgG9aB69nDxpkTig5B9:before{color:green}._5MraKW-sdXoMAncl8aoJ0 ._34ZBh3TYpaRFeMMsfEgz75{position:relative;background:#419ccb;color:#fff;font-weight:700;padding:10px 10px 10px 35px}._5MraKW-sdXoMAncl8aoJ0 ._34ZBh3TYpaRFeMMsfEgz75 img{display:block;position:absolute;left:12px;top:12px;width:15px;height:15px;z-index:10}._5MraKW-sdXoMAncl8aoJ0 ul{width:100%;padding:10px 0}._5MraKW-sdXoMAncl8aoJ0 ul li{display:inline-block;width:50%}._5MraKW-sdXoMAncl8aoJ0 ul li:before{font-family:dashicons!important;speak:none;font-weight:400;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;margin:0 4px 0 0;content:"\F147";top:1px;left:-1px;font-size:1em;line-height:inherit;position:relative;vertical-align:top;font-size:1.5em}._5MraKW-sdXoMAncl8aoJ0 ul li._34VuGJn3eCzOVIhWxpf3EI:before{color:#000}._5MraKW-sdXoMAncl8aoJ0 ul li._3o3myVBr0p_jZTcVVSWdNC:before{color:green}
2
  /*# sourceMappingURL=style.css.map*/
1
+ #dlm_legacy_upgrader_app{height:100%;box-sizing:border-box}._1kijZ35OiZkKapzULElh6m ._2CxVTmzHXSW60xGZZcsG4W{position:relative;background:#419ccb;color:#fff;font-weight:700;padding:10px 10px 10px 35px}._1kijZ35OiZkKapzULElh6m ._2CxVTmzHXSW60xGZZcsG4W img{display:block;position:absolute;left:12px;top:12px;width:15px;height:15px;z-index:10}._1kijZ35OiZkKapzULElh6m ul{width:100%;padding:10px 0}._1kijZ35OiZkKapzULElh6m ul li{display:inline-block;width:50%}._1kijZ35OiZkKapzULElh6m ul li:before{font-family:dashicons!important;speak:none;font-weight:400;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;margin:0 4px 0 0;content:"\F147";top:1px;left:-1px;font-size:1em;line-height:inherit;position:relative;vertical-align:top;font-size:1.5em}._1kijZ35OiZkKapzULElh6m ul li.zV9Nyt3hQBQicmm04gduY:before{color:#000}._1kijZ35OiZkKapzULElh6m ul li._1AzdgG9aB69nDxpkTig5B9:before{color:green}._5MraKW-sdXoMAncl8aoJ0 ._34ZBh3TYpaRFeMMsfEgz75{position:relative;background:#419ccb;color:#fff;font-weight:700;padding:10px 10px 10px 35px}._5MraKW-sdXoMAncl8aoJ0 ._34ZBh3TYpaRFeMMsfEgz75 img{display:block;position:absolute;left:12px;top:12px;width:15px;height:15px;z-index:10}._5MraKW-sdXoMAncl8aoJ0 ul{width:100%;padding:10px 0}._5MraKW-sdXoMAncl8aoJ0 ul li{display:inline-block;width:50%}._5MraKW-sdXoMAncl8aoJ0 ul li:before{font-family:dashicons!important;speak:none;font-weight:400;font-variant:normal;text-transform:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;margin:0 4px 0 0;content:"\F147";top:1px;left:-1px;font-size:1em;line-height:inherit;position:relative;vertical-align:top;font-size:1.5em}._5MraKW-sdXoMAncl8aoJ0 ul li._34VuGJn3eCzOVIhWxpf3EI:before{color:#000}._5MraKW-sdXoMAncl8aoJ0 ul li._3o3myVBr0p_jZTcVVSWdNC:before{color:green}
2
  /*# sourceMappingURL=style.css.map*/
assets/js/legacy-upgrader/package.json CHANGED
@@ -1,101 +1,101 @@
1
- {
2
- "name": "preact-boilerplate",
3
- "version": "6.0.0",
4
- "description": "Ready-to-go Preact starter project powered by webpack.",
5
- "scripts": {
6
- "dev": "cross-env NODE_ENV=development webpack-dev-server --inline --hot --progress",
7
- "start": "serve build -s -c 1",
8
- "prestart": "npm run build",
9
- "build": "cross-env NODE_ENV=production webpack --progress",
10
- "prebuild": "mkdirp build && ncp src/assets build/assets",
11
- "test": "npm run -s lint && jest --coverage",
12
- "test:watch": "npm run -s test -- --watch",
13
- "lint": "eslint src test"
14
- },
15
- "keywords": [
16
- "preact",
17
- "boilerplate",
18
- "webpack"
19
- ],
20
- "license": "MIT",
21
- "author": "Jason Miller <jason@developit.ca>",
22
- "jest": {
23
- "setupFiles": [
24
- "./test/setup.js"
25
- ],
26
- "testURL": "http://localhost:8080",
27
- "moduleFileExtensions": [
28
- "js",
29
- "jsx"
30
- ],
31
- "moduleDirectories": [
32
- "node_modules"
33
- ],
34
- "moduleNameMapper": {
35
- "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
36
- "\\.(css|less)$": "identity-obj-proxy",
37
- "^react$": "preact-compat",
38
- "^react-dom$": "preact-compat"
39
- },
40
- "collectCoverageFrom": [
41
- "src/**/*.{js,jsx}"
42
- ]
43
- },
44
- "devDependencies": {
45
- "autoprefixer": "^7.0.1",
46
- "babel": "^6.5.2",
47
- "babel-core": "^6.24.0",
48
- "babel-eslint": "^7.2.2",
49
- "babel-jest": "^20.0.0",
50
- "babel-loader": "^7.0.0",
51
- "babel-plugin-transform-decorators-legacy": "^1.3.4",
52
- "babel-plugin-transform-react-jsx": "^6.8.0",
53
- "babel-preset-es2015": "^6.24.0",
54
- "babel-preset-stage-0": "^6.5.0",
55
- "babel-register": "^6.24.0",
56
- "babel-runtime": "^6.11.6",
57
- "chai": "^4.0.2",
58
- "copy-webpack-plugin": "^4.0.1",
59
- "core-js": "^2.4.1",
60
- "cross-env": "^5.0.1",
61
- "css-loader": "^0.28.0",
62
- "eslint": "^4.1.0",
63
- "eslint-plugin-jest": "^20.0.0",
64
- "eslint-plugin-react": "^7.0.0",
65
- "extract-text-webpack-plugin": "^2.1.0",
66
- "file-loader": "^0.11.1",
67
- "html-webpack-plugin": "^2.28.0",
68
- "identity-obj-proxy": "^3.0.0",
69
- "jest": "^20.0.0",
70
- "json-loader": "^0.5.4",
71
- "less": "^2.7.1",
72
- "less-loader": "^4.0.3",
73
- "mkdirp": "^0.5.1",
74
- "ncp": "^2.0.0",
75
- "offline-plugin": "^4.7.0",
76
- "postcss-loader": "^2.0.3",
77
- "preact-jsx-chai": "^2.2.1",
78
- "raw-loader": "^0.5.1",
79
- "regenerator-runtime": "^0.10.3",
80
- "replace-bundle-webpack-plugin": "^1.0.0",
81
- "script-ext-html-webpack-plugin": "^1.3.4",
82
- "sinon": "^2.1.0",
83
- "sinon-chai": "^2.9.0",
84
- "source-map-loader": "^0.2.1",
85
- "style-loader": "^0.18.1",
86
- "url-loader": "^0.6.1",
87
- "webpack": "^3.0.0",
88
- "webpack-dev-server": "^2.4.4"
89
- },
90
- "dependencies": {
91
- "preact": "^8.1.0",
92
- "preact-compat": "^3.15.0",
93
- "preact-render-to-string": "^3.6.0",
94
- "preact-router": "^2.5.1",
95
- "promise-polyfill": "^6.0.2",
96
- "proptypes": "^1.0.0",
97
- "serve": "^6.0.0",
98
- "react-router-dom": "^4.1.1",
99
- "whatwg-fetch": "^2.0.3"
100
- }
101
- }
1
+ {
2
+ "name": "preact-boilerplate",
3
+ "version": "6.0.0",
4
+ "description": "Ready-to-go Preact starter project powered by webpack.",
5
+ "scripts": {
6
+ "dev": "cross-env NODE_ENV=development webpack-dev-server --inline --hot --progress",
7
+ "start": "serve build -s -c 1",
8
+ "prestart": "npm run build",
9
+ "build": "cross-env NODE_ENV=production webpack --progress",
10
+ "prebuild": "mkdirp build && ncp src/assets build/assets",
11
+ "test": "npm run -s lint && jest --coverage",
12
+ "test:watch": "npm run -s test -- --watch",
13
+ "lint": "eslint src test"
14
+ },
15
+ "keywords": [
16
+ "preact",
17
+ "boilerplate",
18
+ "webpack"
19
+ ],
20
+ "license": "MIT",
21
+ "author": "Jason Miller <jason@developit.ca>",
22
+ "jest": {
23
+ "setupFiles": [
24
+ "./test/setup.js"
25
+ ],
26
+ "testURL": "http://localhost:8080",
27
+ "moduleFileExtensions": [
28
+ "js",
29
+ "jsx"
30
+ ],
31
+ "moduleDirectories": [
32
+ "node_modules"
33
+ ],
34
+ "moduleNameMapper": {
35
+ "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
36
+ "\\.(css|less)$": "identity-obj-proxy",
37
+ "^react$": "preact-compat",
38
+ "^react-dom$": "preact-compat"
39
+ },
40
+ "collectCoverageFrom": [
41
+ "src/**/*.{js,jsx}"
42
+ ]
43
+ },
44
+ "devDependencies": {
45
+ "autoprefixer": "^7.0.1",
46
+ "babel": "^6.5.2",
47
+ "babel-core": "^6.24.0",
48
+ "babel-eslint": "^7.2.2",
49
+ "babel-jest": "^20.0.0",
50
+ "babel-loader": "^7.0.0",
51
+ "babel-plugin-transform-decorators-legacy": "^1.3.4",
52
+ "babel-plugin-transform-react-jsx": "^6.8.0",
53
+ "babel-preset-es2015": "^6.24.0",
54
+ "babel-preset-stage-0": "^6.5.0",
55
+ "babel-register": "^6.24.0",
56
+ "babel-runtime": "^6.11.6",
57
+ "chai": "^4.0.2",
58
+ "copy-webpack-plugin": "^4.0.1",
59
+ "core-js": "^2.4.1",
60
+ "cross-env": "^5.0.1",
61
+ "css-loader": "^0.28.0",
62
+ "eslint": "^4.1.0",
63
+ "eslint-plugin-jest": "^20.0.0",
64
+ "eslint-plugin-react": "^7.0.0",
65
+ "extract-text-webpack-plugin": "^2.1.0",
66
+ "file-loader": "^0.11.1",
67
+ "html-webpack-plugin": "^2.28.0",
68
+ "identity-obj-proxy": "^3.0.0",
69
+ "jest": "^20.0.0",
70
+ "json-loader": "^0.5.4",
71
+ "less": "^2.7.1",
72
+ "less-loader": "^4.0.3",
73
+ "mkdirp": "^0.5.1",
74
+ "ncp": "^2.0.0",
75
+ "offline-plugin": "^4.7.0",
76
+ "postcss-loader": "^2.0.3",
77
+ "preact-jsx-chai": "^2.2.1",
78
+ "raw-loader": "^0.5.1",
79
+ "regenerator-runtime": "^0.10.3",
80
+ "replace-bundle-webpack-plugin": "^1.0.0",
81
+ "script-ext-html-webpack-plugin": "^1.3.4",
82
+ "sinon": "^2.1.0",
83
+ "sinon-chai": "^2.9.0",
84
+ "source-map-loader": "^0.2.1",
85
+ "style-loader": "^0.18.1",
86
+ "url-loader": "^0.6.1",
87
+ "webpack": "^3.0.0",
88
+ "webpack-dev-server": "^2.4.4"
89
+ },
90
+ "dependencies": {
91
+ "preact": "^8.1.0",
92
+ "preact-compat": "^3.15.0",
93
+ "preact-render-to-string": "^3.6.0",
94
+ "preact-router": "^2.5.1",
95
+ "promise-polyfill": "^6.0.2",
96
+ "proptypes": "^1.0.0",
97
+ "serve": "^6.0.0",
98
+ "react-router-dom": "^4.1.1",
99
+ "whatwg-fetch": "^2.0.3"
100
+ }
101
+ }
assets/js/legacy-upgrader/src/components/app.js CHANGED
@@ -1,69 +1,69 @@
1
- import { h, Component } from 'preact';
2
- import { HashRouter, Route, Redirect } from 'react-router-dom';
3
-
4
- // polyfill fetch and promise
5
- import 'whatwg-fetch';
6
- import Promise from 'promise-polyfill';
7
- if (!window.Promise) {
8
- window.Promise = Promise;
9
- }
10
-
11
- import Welcome from './welcome';
12
- import Downloads from './downloads';
13
- import Content from './content';
14
- import Done from './done';
15
-
16
- // mock dlm_vars for dev
17
- if(window.dlm_lu_vars == undefined) {
18
- window.dlm_lu_vars = {
19
- nonce: 'noncemock',
20
- assets_path: 'http://lnmp.dev:1337/assets/'
21
- };
22
- }
23
-
24
- export default class App extends Component {
25
-
26
- ROUTES = {
27
- welcome: () => <Welcome />,
28
- downloads: () => <Downloads />,
29
- content: ({match}) => <Content download_amount={match.params.download_amount} />,
30
- done: ({match}) => <Done download_amount={match.params.download_amount} content_amount={match.params.content_amount} />
31
- };
32
-
33
- constructor(props) {
34
- super(props);
35
-
36
- this.state = {
37
- queue: []
38
- };
39
- }
40
-
41
- /**
42
- <Router onChange={this.handleRoute}>
43
-
44
- <Welcome path="" />
45
- <Downloads path="/downloads" />
46
- <Content path="/content/:download_amount" />
47
- <Done path="/done/:download_amount/:content_amount" />
48
- </Router>*/
49
-
50
- render() {
51
-
52
- const ROUTES = this.ROUTES;
53
-
54
- return (
55
- <div id="dlm_legacy_upgrader_app">
56
- <HashRouter>
57
- <div>
58
- <Route path="/welcome" component={ROUTES.welcome} />
59
- <Route path="/downloads" component={ROUTES.downloads} />
60
- <Route path="/content/:download_amount" component={ROUTES.content} />
61
- <Route path="/done/:download_amount/:content_amount" component={ROUTES.done} />
62
- <Redirect from="/" to="/welcome" />
63
- </div>
64
- </HashRouter>
65
-
66
- </div>
67
- );
68
- }
69
- }
1
+ import { h, Component } from 'preact';
2
+ import { HashRouter, Route, Redirect } from 'react-router-dom';
3
+
4
+ // polyfill fetch and promise
5
+ import 'whatwg-fetch';
6
+ import Promise from 'promise-polyfill';
7
+ if (!window.Promise) {
8
+ window.Promise = Promise;
9
+ }
10
+
11
+ import Welcome from './welcome';
12
+ import Downloads from './downloads';
13
+ import Content from './content';
14
+ import Done from './done';
15
+
16
+ // mock dlm_vars for dev
17
+ if(window.dlm_lu_vars == undefined) {
18
+ window.dlm_lu_vars = {
19
+ nonce: 'noncemock',
20
+ assets_path: 'http://lnmp.dev:1337/assets/'
21
+ };
22
+ }
23
+
24
+ export default class App extends Component {
25
+
26
+ ROUTES = {
27
+ welcome: () => <Welcome />,
28
+ downloads: () => <Downloads />,
29
+ content: ({match}) => <Content download_amount={match.params.download_amount} />,
30
+ done: ({match}) => <Done download_amount={match.params.download_amount} content_amount={match.params.content_amount} />
31
+ };
32
+
33
+ constructor(props) {
34
+ super(props);
35
+
36
+ this.state = {
37
+ queue: []
38
+ };
39
+ }
40
+
41
+ /**
42
+ <Router onChange={this.handleRoute}>
43
+
44
+ <Welcome path="" />
45
+ <Downloads path="/downloads" />
46
+ <Content path="/content/:download_amount" />
47
+ <Done path="/done/:download_amount/:content_amount" />
48
+ </Router>*/
49
+
50
+ render() {
51
+
52
+ const ROUTES = this.ROUTES;
53
+
54
+ return (
55
+ <div id="dlm_legacy_upgrader_app">
56
+ <HashRouter>
57
+ <div>
58
+ <Route path="/welcome" component={ROUTES.welcome} />
59
+ <Route path="/downloads" component={ROUTES.downloads} />
60
+ <Route path="/content/:download_amount" component={ROUTES.content} />
61
+ <Route path="/done/:download_amount/:content_amount" component={ROUTES.done} />
62
+ <Redirect from="/" to="/welcome" />
63
+ </div>
64
+ </HashRouter>
65
+
66
+ </div>
67
+ );
68
+ }
69
+ }
assets/js/legacy-upgrader/src/components/content/QueueItem.js CHANGED
@@ -1,13 +1,13 @@
1
- import { h, Component } from 'preact';
2
- import style from './style';
3
-
4
- export default class QueueItem extends Component {
5
-
6
- render() {
7
- var listClass = (this.props.item.done?style.done:style.todo);
8
-
9
- return (
10
- <li class={listClass}>Content ID: {this.props.item.id}</li>
11
- );
12
- }
13
- }
1
+ import { h, Component } from 'preact';
2
+ import style from './style';
3
+
4
+ export default class QueueItem extends Component {
5
+
6
+ render() {
7
+ var listClass = (this.props.item.done?style.done:style.todo);
8
+
9
+ return (
10
+ <li class={listClass}>Content ID: {this.props.item.id}</li>
11
+ );
12
+ }
13
+ }
assets/js/legacy-upgrader/src/components/content/index.js CHANGED
@@ -1,149 +1,149 @@
1
- import {h, Component} from 'preact';
2
- import style from './style.less';
3
- import QueueItem from './QueueItem';
4
- import { Link } from 'react-router-dom';
5
-
6
- export default class Content extends Component {
7
-
8
- state = {
9
- checked: false,
10
- items: [],
11
- upgrading: false
12
- };
13
-
14
- constructor(props) {
15
- super(props);
16
-
17
- this.startUpgrade = this.startUpgrade.bind(this);
18
- this.upgradeNext = this.upgradeNext.bind(this);
19
- this.upgradeItem = this.upgradeItem.bind(this);
20
- }
21
-
22
- // gets called when this route is navigated to
23
- componentDidMount() {
24
- fetch( ajaxurl + "?action=dlm_lu_get_content_queue&nonce="+window.dlm_lu_vars.nonce, {
25
- method: 'GET',
26
- credentials: 'include'
27
- } ).then( ( r ) => {
28
- if ( r.status == 200 ) {
29
- return r.json();
30
- }
31
-
32
- throw "AJAX API OFFLINE";
33
- } ).then( ( j ) => {
34
- var items = [];
35
- for ( var i = 0; i < j.length; i ++ ) {
36
- items.push( {id: j[i], done: false} );
37
- }
38
- this.setState( {checked: true, items: items} );
39
- return;
40
- } ).catch( ( e ) => {
41
- console.log( e );
42
- return;
43
- } );
44
- }
45
-
46
- // gets called just before navigating away from the route
47
- componentWillUnmount() {
48
- // todo clear queue
49
- }
50
-
51
- upgradeNext() {
52
- var upgradeDone = true;
53
- for( var i = 0; i < this.state.items.length; i++ ) {
54
- if( this.state.items[i].done === false ) {
55
- upgradeDone = false;
56
- this.upgradeItem( this.state.items[i] );
57
- break;
58
- }
59
- }
60
-
61
- if( upgradeDone ) {
62
- window.location.hash = "/done/"+this.props.download_amount+"/"+this.state.items.length;
63
- }
64
- }
65
-
66
- upgradeItem( item ) {
67
- fetch( ajaxurl + "?action=dlm_lu_upgrade_content&content_id="+item.id+"&nonce="+window.dlm_lu_vars.nonce, {
68
- method: 'GET',
69
- credentials: 'include'
70
- } ).then( ( r ) => {
71
- if ( r.status == 200 ) {
72
- return r.json();
73
- }
74
-
75
- throw "AJAX API OFFLINE";
76
- } ).then( ( j ) => {
77
- console.log( j );
78
- item.done = true;
79
- this.forceUpdate();
80
- this.upgradeNext();
81
- return;
82
- } ).catch( ( e ) => {
83
- console.log( e );
84
- return;
85
- } );
86
- }
87
-
88
- startUpgrade() {
89
- // check if we're upgrading
90
- if( this.state.upgrading ) {
91
- return;
92
- }
93
-
94
- // set we're upgrading
95
- this.setState( {upgrading: true} );
96
-
97
- // upgrade next download
98
- this.upgradeNext();
99
- }
100
-
101
- render() {
102
-
103
- var loadingImg = window.dlm_lu_vars.assets_path + "loading.gif";
104
-
105
- if ( this.state.checked == false ) {
106
- return (
107
- <div class={style.queue}>
108
- <h2>Posts/Pages Queue</h2>
109
- <p><strong>{this.props.download_amount}</strong> downloads have been upgraded.</p>
110
- <p>We're currently building the posts/pages queue, please wait.</p>
111
- </div>
112
- );
113
- }
114
-
115
- if ( this.state.items.length == 0 ) {
116
- var linkURL = "/done/"+this.props.download_amount+"/0";
117
- return (
118
- <div class={style.queue}>
119
- <p><strong>{this.props.download_amount}</strong> downloads have been upgraded.</p>
120
- <p>No posts/pages found that require upgrading.</p>
121
- <Link to={linkURL} class="button button-primary button-large">Continue to Post/Page upgrade</Link>
122
- </div>
123
- );
124
- }
125
-
126
- return (
127
- <div class={style.queue}>
128
- <h2>Posts/Pages Queue</h2>
129
-
130
- {this.state.upgrading &&
131
- <p class={style.upgrading_notice}><img src={loadingImg} />Currently upgrading your downloads, please wait...</p>
132
- }
133
-
134
- <p><strong>{this.props.download_amount}</strong> downloads have been upgraded.</p>
135
-
136
- <p>The following posts/pages items have been found that need upgrading:</p>
137
-
138
- {this.state.items.length > 0 &&
139
- <ul>
140
- {this.state.items.map( ( o, i ) => <QueueItem item={o}/> )}
141
- </ul>
142
- }
143
-
144
- <a href="javascript:;" class="button button-primary button-large" onClick={() => this.startUpgrade()}>Upgrade Content Items</a>
145
-
146
- </div>
147
- );
148
- }
149
- }
1
+ import {h, Component} from 'preact';
2
+ import style from './style.less';
3
+ import QueueItem from './QueueItem';
4
+ import { Link } from 'react-router-dom';
5
+
6
+ export default class Content extends Component {
7
+
8
+ state = {
9
+ checked: false,
10
+ items: [],
11
+ upgrading: false
12
+ };
13
+
14
+ constructor(props) {
15
+ super(props);
16
+
17
+ this.startUpgrade = this.startUpgrade.bind(this);
18
+ this.upgradeNext = this.upgradeNext.bind(this);
19
+ this.upgradeItem = this.upgradeItem.bind(this);
20
+ }
21
+
22
+ // gets called when this route is navigated to
23
+ componentDidMount() {
24
+ fetch( ajaxurl + "?action=dlm_lu_get_content_queue&nonce="+window.dlm_lu_vars.nonce, {
25
+ method: 'GET',
26
+ credentials: 'include'
27
+ } ).then( ( r ) => {
28
+ if ( r.status == 200 ) {
29
+ return r.json();
30
+ }
31
+
32
+ throw "AJAX API OFFLINE";
33
+ } ).then( ( j ) => {
34
+ var items = [];
35
+ for ( var i = 0; i < j.length; i ++ ) {
36
+ items.push( {id: j[i], done: false} );
37
+ }
38
+ this.setState( {checked: true, items: items} );
39
+ return;
40
+ } ).catch( ( e ) => {
41
+ console.log( e );
42
+ return;
43
+ } );
44
+ }
45
+
46
+ // gets called just before navigating away from the route
47
+ componentWillUnmount() {
48
+ // todo clear queue
49
+ }
50
+
51
+ upgradeNext() {
52
+ var upgradeDone = true;
53
+ for( var i = 0; i < this.state.items.length; i++ ) {
54
+ if( this.state.items[i].done === false ) {
55
+ upgradeDone = false;
56
+ this.upgradeItem( this.state.items[i] );
57
+ break;
58
+ }
59
+ }
60
+
61
+ if( upgradeDone ) {
62
+ window.location.hash = "/done/"+this.props.download_amount+"/"+this.state.items.length;
63
+ }
64
+ }
65
+
66
+ upgradeItem( item ) {
67
+ fetch( ajaxurl + "?action=dlm_lu_upgrade_content&content_id="+item.id+"&nonce="+window.dlm_lu_vars.nonce, {
68
+ method: 'GET',
69
+ credentials: 'include'
70
+ } ).then( ( r ) => {
71
+ if ( r.status == 200 ) {
72
+ return r.json();
73
+ }
74
+
75
+ throw "AJAX API OFFLINE";
76
+ } ).then( ( j ) => {
77
+ console.log( j );
78
+ item.done = true;
79
+ this.forceUpdate();
80
+ this.upgradeNext();
81
+ return;
82
+ } ).catch( ( e ) => {
83
+ console.log( e );
84
+ return;
85
+ } );
86
+ }
87
+
88
+ startUpgrade() {
89
+ // check if we're upgrading
90
+ if( this.state.upgrading ) {
91
+ return;
92
+ }
93
+
94
+ // set we're upgrading
95
+ this.setState( {upgrading: true} );
96
+
97
+ // upgrade next download
98
+ this.upgradeNext();
99
+ }
100
+
101
+ render() {
102
+
103
+ var loadingImg = window.dlm_lu_vars.assets_path + "loading.gif";
104
+
105
+ if ( this.state.checked == false ) {
106
+ return (
107
+ <div class={style.queue}>
108
+ <h2>Posts/Pages Queue</h2>
109
+ <p><strong>{this.props.download_amount}</strong> downloads have been upgraded.</p>
110
+ <p>We're currently building the posts/pages queue, please wait.</p>
111
+ </div>
112
+ );
113
+ }
114
+
115
+ if ( this.state.items.length == 0 ) {
116
+ var linkURL = "/done/"+this.props.download_amount+"/0";
117
+ return (
118
+ <div class={style.queue}>
119
+ <p><strong>{this.props.download_amount}</strong> downloads have been upgraded.</p>
120
+ <p>No posts/pages found that require upgrading.</p>
121
+ <Link to={linkURL} class="button button-primary button-large">Continue to Post/Page upgrade</Link>
122
+ </div>
123
+ );
124
+ }
125
+
126
+ return (
127
+ <div class={style.queue}>
128
+ <h2>Posts/Pages Queue</h2>
129
+
130
+ {this.state.upgrading &&
131
+ <p class={style.upgrading_notice}><img src={loadingImg} />Currently upgrading your downloads, please wait...</p>
132
+ }
133
+
134
+ <p><strong>{this.props.download_amount}</strong> downloads have been upgraded.</p>
135
+
136
+ <p>The following posts/pages items have been found that need upgrading:</p>
137
+
138
+ {this.state.items.length > 0 &&
139
+ <ul>
140
+ {this.state.items.map( ( o, i ) => <QueueItem item={o}/> )}
141
+ </ul>
142
+ }
143
+
144
+ <a href="javascript:;" class="button button-primary button-large" onClick={() => this.startUpgrade()}>Upgrade Content Items</a>
145
+
146
+ </div>
147
+ );
148
+ }
149
+ }
assets/js/legacy-upgrader/src/components/content/style.less CHANGED
@@ -1,49 +1,49 @@
1
- @import '~style/helpers';
2
-
3
- .queue {
4
-
5
- .upgrading_notice {
6
- position: relative;
7
- background: #419ccb;
8
- color: #fff;
9
- font-weight: bold;
10
- padding: 10px 10px 10px 35px;
11
-
12
- img {
13
- display: block;
14
- position: absolute;
15
- left: 12px;
16
- top: 12px;
17
- width: 15px;
18
- height: 15px;
19
- z-index: 10;
20
- }
21
- }
22
-
23
- ul {
24
- width: 100%;
25
- padding: 10px 0;
26
-
27
- li {
28
- display: inline-block;
29
- width: 50%;
30
- &:before {
31
- .iconbefore("\f147");
32
- font-size: 1.5em;
33
- }
34
-
35
- &.todo {
36
- &:before {
37
- color: black;
38
- }
39
- }
40
-
41
- &.done {
42
- &:before {
43
- color: green;
44
- }
45
- }
46
- }
47
-
48
- }
49
- }
1
+ @import '~style/helpers';
2
+
3
+ .queue {
4
+
5
+ .upgrading_notice {
6
+ position: relative;
7
+ background: #419ccb;
8
+ color: #fff;
9
+ font-weight: bold;
10
+ padding: 10px 10px 10px 35px;
11
+
12
+ img {
13
+ display: block;
14
+ position: absolute;
15
+ left: 12px;
16
+ top: 12px;
17
+ width: 15px;
18
+ height: 15px;
19
+ z-index: 10;
20
+ }
21
+ }
22
+
23
+ ul {
24
+ width: 100%;
25
+ padding: 10px 0;
26
+
27
+ li {
28
+ display: inline-block;
29
+ width: 50%;
30
+ &:before {
31
+ .iconbefore("\f147");
32
+ font-size: 1.5em;
33
+ }
34
+
35
+ &.todo {
36
+ &:before {
37
+ color: black;
38
+ }
39
+ }
40
+
41
+ &.done {
42
+ &:before {
43
+ color: green;
44
+ }
45
+ }
46
+ }
47
+
48
+ }
49
+ }
assets/js/legacy-upgrader/src/components/done/index.js CHANGED
@@ -1,36 +1,36 @@
1
- import { h, Component } from 'preact';
2
- import { Link } from 'preact-router';
3
- import style from './style.less';
4
-
5
- export default class Done extends Component {
6
-
7
- // gets called when this route is navigated to
8
- componentDidMount() {
9
- // mark upgrade as completed
10
- fetch( ajaxurl + "?action=dlm_lu_mark_upgrade_done&nonce="+window.dlm_lu_vars.nonce, {
11
- method: 'GET',
12
- credentials: 'include'
13
- } ).then( ( r ) => {
14
- if ( r.status == 200 ) {
15
- return r.json();
16
- }
17
-
18
- throw "AJAX API OFFLINE";
19
- } ).then( ( j ) => {
20
- return;
21
- } ).catch( ( e ) => {
22
- console.log( e );
23
- return;
24
- } );
25
- }
26
-
27
- render() {
28
- return (
29
- <div class={style.welcome}>
30
- <h2>Upgrade Done</h2>
31
- <p><strong>{this.props.download_amount}</strong> downloads have been upgraded.</p>
32
- <p><strong>{this.props.content_amount}</strong> posts/pages have been upgraded.</p>
33
- </div>
34
- );
35
- }
36
- }
1
+ import { h, Component } from 'preact';
2
+ import { Link } from 'preact-router';
3
+ import style from './style.less';
4
+
5
+ export default class Done extends Component {
6
+
7
+ // gets called when this route is navigated to
8
+ componentDidMount() {
9
+ // mark upgrade as completed
10
+ fetch( ajaxurl + "?action=dlm_lu_mark_upgrade_done&nonce="+window.dlm_lu_vars.nonce, {
11
+ method: 'GET',
12
+ credentials: 'include'
13
+ } ).then( ( r ) => {
14
+ if ( r.status == 200 ) {
15
+ return r.json();
16
+ }
17
+
18
+ throw "AJAX API OFFLINE";
19
+ } ).then( ( j ) => {
20
+ return;
21
+ } ).catch( ( e ) => {
22
+ console.log( e );
23
+ return;
24
+ } );
25
+ }
26
+
27
+ render() {
28
+ return (
29
+ <div class={style.welcome}>
30
+ <h2>Upgrade Done</h2>
31
+ <p><strong>{this.props.download_amount}</strong> downloads have been upgraded.</p>
32
+ <p><strong>{this.props.content_amount}</strong> posts/pages have been upgraded.</p>
33
+ </div>
34
+ );
35
+ }
36
+ }
assets/js/legacy-upgrader/src/components/done/style.less CHANGED
@@ -1,5 +1,5 @@
1
- @import '~style/helpers';
2
-
3
- .done {
4
-
5
- }
1
+ @import '~style/helpers';
2
+
3
+ .done {
4
+
5
+ }
assets/js/legacy-upgrader/src/components/downloads/QueueItem.js CHANGED
@@ -1,13 +1,13 @@
1
- import { h, Component } from 'preact';
2
- import style from './style';
3
-
4
- export default class QueueItem extends Component {
5
-
6
- render() {
7
- var listClass = (this.props.item.done?style.done:style.todo);
8
-
9
- return (
10
- <li class={listClass}>Legacy Download ID: {this.props.item.id}</li>
11
- );
12
- }
13
  }
1
+ import { h, Component } from 'preact';
2
+ import style from './style';
3
+
4
+ export default class QueueItem extends Component {
5
+
6
+ render() {
7
+ var listClass = (this.props.item.done?style.done:style.todo);
8
+
9
+ return (
10
+ <li class={listClass}>Legacy Download ID: {this.props.item.id}</li>
11
+ );
12
+ }
13
  }
assets/js/legacy-upgrader/src/components/downloads/index.js CHANGED
@@ -1,145 +1,145 @@
1
- import {h, Component} from 'preact';
2
- import style from './style.less';
3
- import QueueItem from './QueueItem';
4
- import { Link } from 'react-router-dom';
5
-
6
- export default class Downloads extends Component {
7
-
8
- state = {
9
- checked: false,
10
- items: [],
11
- upgrading: false
12
- };
13
-
14
- constructor(props) {
15
- super(props);
16
-
17
- this.startUpgrade = this.startUpgrade.bind(this);
18
- this.upgradeNext = this.upgradeNext.bind(this);
19
- this.upgradeItem = this.upgradeItem.bind(this);
20
- }
21
-
22
- // gets called when this route is navigated to
23
- componentDidMount() {
24
- fetch( ajaxurl + "?action=dlm_lu_get_download_queue&nonce="+window.dlm_lu_vars.nonce, {
25
- method: 'GET',
26
- credentials: 'include'
27
- } ).then( ( r ) => {
28
- if ( r.status == 200 ) {
29
- return r.json();
30
- }
31
-
32
- throw "AJAX API OFFLINE";
33
- } ).then( ( j ) => {
34
- var items = [];
35
- for ( var i = 0; i < j.length; i ++ ) {
36
- items.push( {id: j[i], done: false} );
37
- }
38
- this.setState( {checked: true, items: items} );
39
- return;
40
- } ).catch( ( e ) => {
41
- console.log( e );
42
- return;
43
- } );
44
- }
45
-
46
- // gets called just before navigating away from the route
47
- componentWillUnmount() {
48
- // todo clear queue
49
- }
50
-
51
- upgradeNext() {
52
- var upgradeDone = true;
53
- for( var i = 0; i < this.state.items.length; i++ ) {
54
- if( this.state.items[i].done === false ) {
55
- upgradeDone = false;
56
- this.upgradeItem( this.state.items[i] );
57
- break;
58
- }
59
- }
60
-
61
- if( upgradeDone ) {
62
- window.location.hash = "/content/"+this.state.items.length;
63
- }
64
- }
65
-
66
- upgradeItem( item ) {
67
- fetch( ajaxurl + "?action=dlm_lu_upgrade_download&download_id="+item.id+"&nonce="+window.dlm_lu_vars.nonce, {
68
- method: 'GET',
69
- credentials: 'include'
70
- } ).then( ( r ) => {
71
- if ( r.status == 200 ) {
72
- return r.json();
73
- }
74
-
75
- throw "AJAX API OFFLINE";
76
- } ).then( ( j ) => {
77
- console.log( j );
78
- item.done = true;
79
- this.forceUpdate();
80
- this.upgradeNext();
81
- return;
82
- } ).catch( ( e ) => {
83
- console.log( e );
84
- return;
85
- } );
86
- }
87
-
88
- startUpgrade() {
89
- // check if we're upgrading
90
- if( this.state.upgrading ) {
91
- return;
92
- }
93
-
94
- // set we're upgrading
95
- this.setState( {upgrading: true} );
96
-
97
- // upgrade next download
98
- this.upgradeNext();
99
- }
100
-
101
- render() {
102
-
103
- var loadingImg = window.dlm_lu_vars.assets_path + "loading.gif";
104
-
105
- if ( this.state.checked == false ) {
106
- return (
107
- <div class={style.queue}>
108
- <h2>Downloads Queue</h2>
109
- <p>We're currently building the queue, please wait.</p>
110
- </div>
111
- );
112
- }
113
-
114
- if ( this.state.items.length == 0 ) {
115
- return (
116
- <div class={style.queue}>
117
- <h2>Downloads Queue</h2>
118
- <p>No Downloads found that require upgrading</p>
119
- <Link to="/content/0" class="button button-primary button-large">Continue to Post/Page upgrade</Link>
120
- </div>
121
- );
122
- }
123
-
124
- return (
125
- <div class={style.queue}>
126
- <h2>Downloads Queue</h2>
127
-
128
- {this.state.upgrading &&
129
- <p class={style.upgrading_notice}><img src={loadingImg} />Currently upgrading your downloads, please wait...</p>
130
- }
131
-
132
- <p>The following legacy download ID's have been found that need upgrading:</p>
133
-
134
- {this.state.items.length > 0 &&
135
- <ul>
136
- {this.state.items.map( ( o, i ) => <QueueItem item={o}/> )}
137
- </ul>
138
- }
139
-
140
- <a href="javascript:;" class="button button-primary button-large" onClick={() => this.startUpgrade()}>Upgrade Downloads</a>
141
-
142
- </div>
143
- );
144
- }
145
- }
1
+ import {h, Component} from 'preact';
2
+ import style from './style.less';
3
+ import QueueItem from './QueueItem';
4
+ import { Link } from 'react-router-dom';
5
+
6
+ export default class Downloads extends Component {
7
+
8
+ state = {
9
+ checked: false,
10
+ items: [],
11
+ upgrading: false
12
+ };
13
+
14
+ constructor(props) {
15
+ super(props);
16
+
17
+ this.startUpgrade = this.startUpgrade.bind(this);
18
+ this.upgradeNext = this.upgradeNext.bind(this);
19
+ this.upgradeItem = this.upgradeItem.bind(this);
20
+ }
21
+
22
+ // gets called when this route is navigated to
23
+ componentDidMount() {
24
+ fetch( ajaxurl + "?action=dlm_lu_get_download_queue&nonce="+window.dlm_lu_vars.nonce, {
25
+ method: 'GET',
26
+ credentials: 'include'
27
+ } ).then( ( r ) => {
28
+ if ( r.status == 200 ) {
29
+ return r.json();
30
+ }
31
+
32
+ throw "AJAX API OFFLINE";
33
+ } ).then( ( j ) => {
34
+ var items = [];
35
+ for ( var i = 0; i < j.length; i ++ ) {
36
+ items.push( {id: j[i], done: false} );
37
+ }
38
+ this.setState( {checked: true, items: items} );
39
+ return;
40
+ } ).catch( ( e ) => {
41
+ console.log( e );
42
+ return;
43
+ } );
44
+ }
45
+
46
+ // gets called just before navigating away from the route
47
+ componentWillUnmount() {
48
+ // todo clear queue
49
+ }
50
+
51
+ upgradeNext() {
52
+ var upgradeDone = true;
53
+ for( var i = 0; i < this.state.items.length; i++ ) {
54
+ if( this.state.items[i].done === false ) {
55
+ upgradeDone = false;
56
+ this.upgradeItem( this.state.items[i] );
57
+ break;
58
+ }
59
+ }
60
+
61
+ if( upgradeDone ) {
62
+ window.location.hash = "/content/"+this.state.items.length;
63
+ }
64
+ }
65
+
66
+ upgradeItem( item ) {
67
+ fetch( ajaxurl + "?action=dlm_lu_upgrade_download&download_id="+item.id+"&nonce="+window.dlm_lu_vars.nonce, {
68
+ method: 'GET',
69
+ credentials: 'include'
70
+ } ).then( ( r ) => {
71
+ if ( r.status == 200 ) {
72
+ return r.json();
73
+ }
74
+
75
+ throw "AJAX API OFFLINE";
76
+ } ).then( ( j ) => {
77
+ console.log( j );
78
+ item.done = true;
79
+ this.forceUpdate();
80
+ this.upgradeNext();
81
+ return;
82
+ } ).catch( ( e ) => {
83
+ console.log( e );
84
+ return;
85
+ } );
86
+ }
87
+
88
+ startUpgrade() {
89
+ // check if we're upgrading
90
+ if( this.state.upgrading ) {
91
+ return;
92
+ }
93
+
94
+ // set we're upgrading
95
+ this.setState( {upgrading: true} );
96
+
97
+ // upgrade next download
98
+ this.upgradeNext();
99
+ }
100
+
101
+ render() {
102
+
103
+ var loadingImg = window.dlm_lu_vars.assets_path + "loading.gif";
104
+
105
+ if ( this.state.checked == false ) {
106
+ return (
107
+ <div class={style.queue}>
108
+ <h2>Downloads Queue</h2>
109
+ <p>We're currently building the queue, please wait.</p>
110
+ </div>
111
+ );
112
+ }
113
+
114
+ if ( this.state.items.length == 0 ) {
115
+ return (
116
+ <div class={style.queue}>
117
+ <h2>Downloads Queue</h2>
118
+ <p>No Downloads found that require upgrading</p>
119
+ <Link to="/content/0" class="button button-primary button-large">Continue to Post/Page upgrade</Link>
120
+ </div>
121
+ );
122
+ }
123
+
124
+ return (
125
+ <div class={style.queue}>
126
+ <h2>Downloads Queue</h2>
127
+
128
+ {this.state.upgrading &&
129
+ <p class={style.upgrading_notice}><img src={loadingImg} />Currently upgrading your downloads, please wait...</p>
130
+ }
131
+
132
+ <p>The following legacy download ID's have been found that need upgrading:</p>
133
+
134
+ {this.state.items.length > 0 &&
135
+ <ul>
136
+ {this.state.items.map( ( o, i ) => <QueueItem item={o}/> )}
137
+ </ul>
138
+ }
139
+
140
+ <a href="javascript:;" class="button button-primary button-large" onClick={() => this.startUpgrade()}>Upgrade Downloads</a>
141
+
142
+ </div>
143
+ );
144
+ }
145
+ }
assets/js/legacy-upgrader/src/components/downloads/style.less CHANGED
@@ -1,49 +1,49 @@
1
- @import '~style/helpers';
2
-
3
- .queue {
4
-
5
- .upgrading_notice {
6
- position: relative;
7
- background: #419ccb;
8
- color: #fff;
9
- font-weight: bold;
10
- padding: 10px 10px 10px 35px;
11
-
12
- img {
13
- display: block;
14
- position: absolute;
15
- left: 12px;
16
- top: 12px;
17
- width: 15px;
18
- height: 15px;
19
- z-index: 10;
20
- }
21
- }
22
-
23
- ul {
24
- width: 100%;
25
- padding: 10px 0;
26
-
27
- li {
28
- display: inline-block;
29
- width: 50%;
30
- &:before {
31
- .iconbefore("\f147");
32
- font-size: 1.5em;
33
- }
34
-
35
- &.todo {
36
- &:before {
37
- color: black;
38
- }
39
- }
40
-
41
- &.done {
42
- &:before {
43
- color: green;
44
- }
45
- }
46
- }
47
-
48
- }
49
- }
1
+ @import '~style/helpers';
2
+
3
+ .queue {
4
+
5
+ .upgrading_notice {
6
+ position: relative;
7
+ background: #419ccb;
8
+ color: #fff;
9
+ font-weight: bold;
10
+ padding: 10px 10px 10px 35px;
11
+
12
+ img {
13
+ display: block;
14
+ position: absolute;
15
+ left: 12px;
16
+ top: 12px;
17
+ width: 15px;
18
+ height: 15px;
19
+ z-index: 10;
20
+ }
21
+ }
22
+
23
+ ul {
24
+ width: 100%;
25
+ padding: 10px 0;
26
+
27
+ li {
28
+ display: inline-block;
29
+ width: 50%;
30
+ &:before {
31
+ .iconbefore("\f147");
32
+ font-size: 1.5em;
33
+ }
34
+
35
+ &.todo {
36
+ &:before {
37
+ color: black;
38
+ }
39
+ }
40
+
41
+ &.done {
42
+ &:before {
43
+ color: green;
44
+ }
45
+ }
46
+ }
47
+
48
+ }
49
+ }
assets/js/legacy-upgrader/src/components/welcome/index.js CHANGED
@@ -1,16 +1,16 @@
1
- import { h, Component } from 'preact';
2
- import { Link } from 'react-router-dom';
3
- import style from './style.less';
4
-
5
- export default class Welcome extends Component {
6
- render() {
7
- return (
8
- <div class={style.welcome}>
9
- <h2>Welcome</h2>
10
- <p>Before upgrading your downloads, we'll first scan your database to find your legacy downloads. We will put all found legacy downloads in a queue which you can review before the actual upgrading begins.</p>
11
- <p><strong>PLEASE NOTE: Although thoroughly tested, this process will modify and move your download data. Backup your database before you continue.</strong></p>
12
- <p><Link to="/downloads" class="button button-primary button-large">I have backed up my database, let's go</Link></p>
13
- </div>
14
- );
15
- }
16
- }
1
+ import { h, Component } from 'preact';
2
+ import { Link } from 'react-router-dom';
3
+ import style from './style.less';
4
+
5
+ export default class Welcome extends Component {
6
+ render() {
7
+ return (
8
+ <div class={style.welcome}>
9
+ <h2>Welcome</h2>
10
+ <p>Before upgrading your downloads, we'll first scan your database to find your legacy downloads. We will put all found legacy downloads in a queue which you can review before the actual upgrading begins.</p>
11
+ <p><strong>PLEASE NOTE: Although thoroughly tested, this process will modify and move your download data. Backup your database before you continue.</strong></p>
12
+ <p><Link to="/downloads" class="button button-primary button-large">I have backed up my database, let's go</Link></p>
13
+ </div>
14
+ );
15
+ }
16
+ }
assets/js/legacy-upgrader/src/components/welcome/style.less CHANGED
@@ -1,5 +1,5 @@
1
- @import '~style/helpers';
2
-
3
- .welcome {
4
-
5
- }
1
+ @import '~style/helpers';
2
+
3
+ .welcome {
4
+
5
+ }
assets/js/legacy-upgrader/src/config.json CHANGED
@@ -1,3 +1,3 @@
1
- {
2
- "key": "value"
3
- }
1
+ {
2
+ "key": "value"
3
+ }
assets/js/legacy-upgrader/src/index.ejs CHANGED
@@ -1,408 +1,408 @@
1
- <!DOCTYPE html>
2
- <!--[if IE 8]>
3
- <html xmlns="http://www.w3.org/1999/xhtml" class="ie8 wp-toolbar" lang="en-US">
4
- <![endif]-->
5
- <!--[if !(IE 8) ]><!-->
6
- <html xmlns="http://www.w3.org/1999/xhtml" class="wp-toolbar" lang="en-US">
7
- <!--<![endif]-->
8
- <head>
9
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10
- <title> &lsaquo; Download Monitor &#8212; WordPress</title>
11
-
12
- <script type="text/javascript">
13
- addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
14
- var ajaxurl = 'http://lnmp.dev/download-monitor/wp-admin/admin-ajax.php',
15
- pagenow = 'admin_page_dlm_legacy_upgrade',
16
- typenow = '',
17
- adminpage = 'admin_page_dlm_legacy_upgrade',
18
- thousandsSeparator = ',',
19
- decimalPoint = '.',
20
- isRtl = 0;
21
- </script>
22
-
23
- <meta name="viewport" content="width=device-width,initial-scale=1.0">
24
- <link rel='dns-prefetch' href='//s.w.org' />
25
- <style type="text/css">
26
- img.wp-smiley,
27
- img.emoji {
28
- display: inline !important;
29
- border: none !important;
30
- box-shadow: none !important;
31
- height: 1em !important;
32
- width: 1em !important;
33
- margin: 0 .07em !important;
34
- vertical-align: -0.1em !important;
35
- background: none !important;
36
- padding: 0 !important;
37
- }
38
- </style>
39
- <link rel='stylesheet' id='dashicons-css' href='http://lnmp.dev/download-monitor/wp-includes/css/dashicons.css?ver=4.9' type='text/css' media='all' />
40
- <link rel='stylesheet' id='admin-bar-css' href='http://lnmp.dev/download-monitor/wp-includes/css/admin-bar.css?ver=4.9' type='text/css' media='all' />
41
- <link rel='stylesheet' id='common-css' href='http://lnmp.dev/download-monitor/wp-admin/css/common.css?ver=4.9' type='text/css' media='all' />
42
- <link rel='stylesheet' id='forms-css' href='http://lnmp.dev/download-monitor/wp-admin/css/forms.css?ver=4.9' type='text/css' media='all' />
43
- <link rel='stylesheet' id='admin-menu-css' href='http://lnmp.dev/download-monitor/wp-admin/css/admin-menu.css?ver=4.9' type='text/css' media='all' />
44
- <link rel='stylesheet' id='dashboard-css' href='http://lnmp.dev/download-monitor/wp-admin/css/dashboard.css?ver=4.9' type='text/css' media='all' />
45
- <link rel='stylesheet' id='list-tables-css' href='http://lnmp.dev/download-monitor/wp-admin/css/list-tables.css?ver=4.9' type='text/css' media='all' />
46
- <link rel='stylesheet' id='edit-css' href='http://lnmp.dev/download-monitor/wp-admin/css/edit.css?ver=4.9' type='text/css' media='all' />
47
- <link rel='stylesheet' id='revisions-css' href='http://lnmp.dev/download-monitor/wp-admin/css/revisions.css?ver=4.9' type='text/css' media='all' />
48
- <link rel='stylesheet' id='media-css' href='http://lnmp.dev/download-monitor/wp-admin/css/media.css?ver=4.9' type='text/css' media='all' />
49
- <link rel='stylesheet' id='themes-css' href='http://lnmp.dev/download-monitor/wp-admin/css/themes.css?ver=4.9' type='text/css' media='all' />
50
- <link rel='stylesheet' id='about-css' href='http://lnmp.dev/download-monitor/wp-admin/css/about.css?ver=4.9' type='text/css' media='all' />
51
- <link rel='stylesheet' id='nav-menus-css' href='http://lnmp.dev/download-monitor/wp-admin/css/nav-menus.css?ver=4.9' type='text/css' media='all' />
52
- <link rel='stylesheet' id='wp-pointer-css' href='http://lnmp.dev/download-monitor/wp-includes/css/wp-pointer.css?ver=4.9' type='text/css' media='all' />
53
- <link rel='stylesheet' id='widgets-css' href='http://lnmp.dev/download-monitor/wp-admin/css/widgets.css?ver=4.9' type='text/css' media='all' />
54
- <link rel='stylesheet' id='site-icon-css' href='http://lnmp.dev/download-monitor/wp-admin/css/site-icon.css?ver=4.9' type='text/css' media='all' />
55
- <link rel='stylesheet' id='l10n-css' href='http://lnmp.dev/download-monitor/wp-admin/css/l10n.css?ver=4.9' type='text/css' media='all' />
56
- <link rel='stylesheet' id='buttons-css' href='http://lnmp.dev/download-monitor/wp-includes/css/buttons.css?ver=4.9' type='text/css' media='all' />
57
- <!--[if lte IE 7]>
58
- <link rel='stylesheet' id='ie-css' href='http://lnmp.dev/download-monitor/wp-admin/css/ie.css?ver=4.9' type='text/css' media='all' />
59
- <![endif]-->
60
- <link rel='stylesheet' id='wp-auth-check-css' href='http://lnmp.dev/download-monitor/wp-includes/css/wp-auth-check.css?ver=4.9' type='text/css' media='all' />
61
- <link rel='stylesheet' id='download_monitor_menu_css-css' href='http://lnmp.dev/download-monitor/wp-content/plugins/_download-monitor-new/assets/css/menu.css?ver=4.9' type='text/css' media='all' />
62
- <script type="text/javascript">
63
- window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/2.3\/72x72\/","ext":".png","svgUrl":"https:\/\/s.w.org\/images\/core\/emoji\/2.3\/svg\/","svgExt":".svg","source":{"wpemoji":"http:\/\/lnmp.dev\/download-monitor\/wp-includes\/js\/wp-emoji.js?ver=4.9","twemoji":"http:\/\/lnmp.dev\/download-monitor\/wp-includes\/js\/twemoji.js?ver=4.9"}};
64
- ( function( window, document, settings ) {
65
- var src, ready, ii, tests;
66
-
67
- /*
68
- * Create a canvas element for testing native browser support
69
- * of emoji.
70
- */
71
- var canvas = document.createElement( 'canvas' );
72
- var context = canvas.getContext && canvas.getContext( '2d' );
73
-
74
- /**
75
- * Check if two sets of Emoji characters render the same.
76
- *
77
- * @param set1 array Set of Emoji characters.
78
- * @param set2 array Set of Emoji characters.
79
- * @returns {boolean} True if the two sets render the same.
80
- */
81
- function emojiSetsRenderIdentically( set1, set2 ) {
82
- var stringFromCharCode = String.fromCharCode;
83
-
84
- // Cleanup from previous test.
85
- context.clearRect( 0, 0, canvas.width, canvas.height );
86
- context.fillText( stringFromCharCode.apply( this, set1 ), 0, 0 );
87
- var rendered1 = canvas.toDataURL();
88
-
89
- // Cleanup from previous test.
90
- context.clearRect( 0, 0, canvas.width, canvas.height );
91
- context.fillText( stringFromCharCode.apply( this, set2 ), 0, 0 );
92
- var rendered2 = canvas.toDataURL();
93
-
94
- return rendered1 === rendered2;
95
- }
96
-
97
- /**
98
- * Detect if the browser supports rendering emoji or flag emoji. Flag emoji are a single glyph
99
- * made of two characters, so some browsers (notably, Firefox OS X) don't support them.
100
- *
101
- * @since 4.2.0
102
- *
103
- * @param type {String} Whether to test for support of "flag" or "emoji".
104
- * @return {Boolean} True if the browser can render emoji, false if it cannot.
105
- */
106
- function browserSupportsEmoji( type ) {
107
- var isIdentical;
108
-
109
- if ( ! context || ! context.fillText ) {
110
- return false;
111
- }
112
-
113
- /*
114
- * Chrome on OS X added native emoji rendering in M41. Unfortunately,
115
- * it doesn't work when the font is bolder than 500 weight. So, we
116
- * check for bold rendering support to avoid invisible emoji in Chrome.
117
- */
118
- context.textBaseline = 'top';
119
- context.font = '600 32px Arial';
120
-
121
- switch ( type ) {
122
- case 'flag':
123
- /*
124
- * Test for UN flag compatibility. This is the least supported of the letter locale flags,
125
- * so gives us an easy test for full support.
126
- *
127
- * To test for support, we try to render it, and compare the rendering to how it would look if
128
- * the browser doesn't render it correctly ([U] + [N]).
129
- */
130
- isIdentical = emojiSetsRenderIdentically(
131
- [ 55356, 56826, 55356, 56819 ],
132
- [ 55356, 56826, 8203, 55356, 56819 ]
133
- );
134
-
135
- if ( isIdentical ) {
136
- return false;
137
- }
138
-
139
- /*
140
- * Test for English flag compatibility. England is a country in the United Kingdom, it
141
- * does not have a two letter locale code but rather an five letter sub-division code.
142
- *
143
- * To test for support, we try to render it, and compare the rendering to how it would look if
144
- * the browser doesn't render it correctly (black flag emoji + [G] + [B] + [E] + [N] + [G]).
145
- */
146
- isIdentical = emojiSetsRenderIdentically(
147
- [ 55356, 57332, 56128, 56423, 56128, 56418, 56128, 56421, 56128, 56430, 56128, 56423, 56128, 56447 ],
148
- [ 55356, 57332, 8203, 56128, 56423, 8203, 56128, 56418, 8203, 56128, 56421, 8203, 56128, 56430, 8203, 56128, 56423, 8203, 56128, 56447 ]
149
- );
150
-
151
- return ! isIdentical;
152
- case 'emoji':
153
- /*
154
- * Emoji 5 has fairies of all genders.
155
- *
156
- * To test for support, try to render a new emoji (fairy, male), then compares
157
- * it to how it would look if the browser doesn't render it correctly
158
- * (fairy + male sign).
159
- */
160
- isIdentical = emojiSetsRenderIdentically(
161
- [ 55358, 56794, 8205, 9794, 65039 ],
162
- [ 55358, 56794, 8203, 9794, 65039 ]
163
- );
164
- return ! isIdentical;
165
- }
166
-
167
- return false;
168
- }
169
-
170
- function addScript( src ) {
171
- var script = document.createElement( 'script' );
172
-
173
- script.src = src;
174
- script.defer = script.type = 'text/javascript';
175
- document.getElementsByTagName( 'head' )[0].appendChild( script );
176
- }
177
-
178
- tests = Array( 'flag', 'emoji' );
179
-
180
- settings.supports = {
181
- everything: true,
182
- everythingExceptFlag: true
183
- };
184
-
185
- for( ii = 0; ii < tests.length; ii++ ) {
186
- settings.supports[ tests[ ii ] ] = browserSupportsEmoji( tests[ ii ] );
187
-
188
- settings.supports.everything = settings.supports.everything && settings.supports[ tests[ ii ] ];
189
-
190
- if ( 'flag' !== tests[ ii ] ) {
191
- settings.supports.everythingExceptFlag = settings.supports.everythingExceptFlag && settings.supports[ tests[ ii ] ];
192
- }
193
- }
194
-
195
- settings.supports.everythingExceptFlag = settings.supports.everythingExceptFlag && ! settings.supports.flag;
196
-
197
- settings.DOMReady = false;
198
- settings.readyCallback = function() {
199
- settings.DOMReady = true;
200
- };
201
-
202
- if ( ! settings.supports.everything ) {
203
- ready = function() {
204
- settings.readyCallback();
205
- };
206
-
207
- if ( document.addEventListener ) {
208
- document.addEventListener( 'DOMContentLoaded', ready, false );
209
- window.addEventListener( 'load', ready, false );
210
- } else {
211
- window.attachEvent( 'onload', ready );
212
- document.attachEvent( 'onreadystatechange', function() {
213
- if ( 'complete' === document.readyState ) {
214
- settings.readyCallback();
215
- }
216
- } );
217
- }
218
-
219
- src = settings.source || {};
220
-
221
- if ( src.concatemoji ) {
222
- addScript( src.concatemoji );
223
- } else if ( src.wpemoji && src.twemoji ) {
224
- addScript( src.twemoji );
225
- addScript( src.wpemoji );
226
- }
227
- }
228
-
229
- } )( window, document, window._wpemojiSettings );
230
- </script>
231
- <script type='text/javascript' src='http://lnmp.dev/download-monitor/wp-includes/js/jquery/jquery.js?ver=1.12.4'></script>
232
- <script type='text/javascript' src='http://lnmp.dev/download-monitor/wp-includes/js/jquery/jquery-migrate.js?ver=1.4.1'></script>
233
- <script type='text/javascript'>
234
- /* <![CDATA[ */
235
- var userSettings = {"url":"\/download-monitor\/","uid":"1","time":"1511968878","secure":""};
236
- /* ]]> */
237
- </script>
238
- <script type='text/javascript' src='http://lnmp.dev/download-monitor/wp-includes/js/utils.js?ver=4.9'></script>
239
- <script type='text/javascript'>
240
- /* <![CDATA[ */
241
- var dlm_id_strings = {"insert_download":"Insert Download"};
242
- /* ]]> */
243
- </script>
244
- <script type='text/javascript' src='http://lnmp.dev/download-monitor/wp-content/plugins/_download-monitor-new/assets/js/insert-download.js?ver=4.0.0'></script>
245
- <script type='text/javascript' src='http://lnmp.dev/download-monitor/wp-content/plugins/_download-monitor-new/assets/js/notices.js?ver=4.0.0'></script>
246
- <link id="wp-admin-canonical" rel="canonical" href="http://lnmp.dev/download-monitor/wp-admin/options.php?page=dlm_legacy_upgrade" />
247
- <script>
248
- if ( window.history.replaceState ) {
249
- window.history.replaceState( null, null, document.getElementById( 'wp-admin-canonical' ).href + window.location.hash );
250
- }
251
- </script>
252
- <script type="text/javascript">var _wpColorScheme = {"icons":{"base":"#82878c","focus":"#00a0d2","current":"#fff"}};</script>
253
- <style type="text/css" media="print">#wpadminbar { display:none; }</style>
254
- </head>
255
- <body class="wp-admin wp-core-ui no-js admin_page_dlm_legacy_upgrade auto-fold admin-bar branch-4-9 version-4-9 admin-color-fresh locale-en-us no-customize-support no-svg">
256
- <script type="text/javascript">
257
- document.body.className = document.body.className.replace('no-js','js');
258
- </script>
259
-
260
- <!--[if lte IE 8]>
261
- <script type="text/javascript">
262
- document.body.className = document.body.className.replace( /(^|\s)(no-)?customize-support(?=\s|$)/, '' ) + ' no-customize-support';
263
- </script>
264
- <![endif]-->
265
- <!--[if gte IE 9]><!-->
266
- <script type="text/javascript">
267
- (function() {
268
- var request, b = document.body, c = 'className', cs = 'customize-support', rcs = new RegExp('(^|\\s+)(no-)?'+cs+'(\\s+|$)');
269
-
270
- request = true;
271
-
272
- b[c] = b[c].replace( rcs, ' ' );
273
- // The customizer requires postMessage and CORS (if the site is cross domain)
274
- b[c] += ( window.postMessage && request ? ' ' : ' no-' ) + cs;
275
- }());
276
- </script>
277
- <!--<![endif]-->
278
-
279
- <div id="wpwrap">
280
-
281
- <div id="adminmenumain" role="navigation" aria-label="Main menu">
282
- <a href="#wpbody-content" class="screen-reader-shortcut">Skip to main content</a>
283
- <a href="#wp-toolbar" class="screen-reader-shortcut">Skip to toolbar</a>
284
- <div id="adminmenuback"></div>
285
- <div id="adminmenuwrap">
286
- <ul id="adminmenu">
287
-
288
-
289
- <li class="wp-first-item wp-has-submenu wp-not-current-submenu menu-top menu-top-first menu-icon-dashboard menu-top-last" id="menu-dashboard">
290
- <a href='index.php' class="wp-first-item wp-has-submenu wp-not-current-submenu menu-top menu-top-first menu-icon-dashboard menu-top-last" aria-haspopup="true"><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-dashboard'><br /></div><div class='wp-menu-name'>Dashboard</div></a>
291
- <ul class='wp-submenu wp-submenu-wrap'><li class='wp-submenu-head' aria-hidden='true'>Dashboard</li><li class="wp-first-item"><a href='index.php' class="wp-first-item">Home</a></li><li><a href='update-core.php'>Updates <span class='update-plugins count-5'><span class='update-count'>5</span></span></a></li></ul></li>
292
- <li class="wp-not-current-submenu wp-menu-separator" aria-hidden="true"><div class="separator"></div></li>
293
- <li class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-post open-if-no-js menu-top-first" id="menu-posts">
294
- <a href='edit.php' class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-post open-if-no-js menu-top-first" aria-haspopup="true"><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-admin-post'><br /></div><div class='wp-menu-name'>Posts</div></a>
295
- <ul class='wp-submenu wp-submenu-wrap'><li class='wp-submenu-head' aria-hidden='true'>Posts</li><li class="wp-first-item"><a href='edit.php' class="wp-first-item">All Posts</a></li><li><a href='post-new.php'>Add New</a></li><li><a href='edit-tags.php?taxonomy=category'>Categories</a></li><li><a href='edit-tags.php?taxonomy=post_tag'>Tags</a></li></ul></li>
296
- <li class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-media" id="menu-media">
297
- <a href='upload.php' class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-media" aria-haspopup="true"><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-admin-media'><br /></div><div class='wp-menu-name'>Media</div></a>
298
- <ul class='wp-submenu wp-submenu-wrap'><li class='wp-submenu-head' aria-hidden='true'>Media</li><li class="wp-first-item"><a href='upload.php' class="wp-first-item">Library</a></li><li><a href='media-new.php'>Add New</a></li></ul></li>
299
- <li class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-page" id="menu-pages">
300
- <a href='edit.php?post_type=page' class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-page" aria-haspopup="true"><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-admin-page'><br /></div><div class='wp-menu-name'>Pages</div></a>
301
- <ul class='wp-submenu wp-submenu-wrap'><li class='wp-submenu-head' aria-hidden='true'>Pages</li><li class="wp-first-item"><a href='edit.php?post_type=page' class="wp-first-item">All Pages</a></li><li><a href='post-new.php?post_type=page'>Add New</a></li></ul></li>
302
- <li class="wp-not-current-submenu menu-top menu-icon-comments" id="menu-comments">
303
- <a href='edit-comments.php' class="wp-not-current-submenu menu-top menu-icon-comments" ><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-admin-comments'><br /></div><div class='wp-menu-name'>Comments <span class="awaiting-mod count-0"><span class="pending-count">0</span></span></div></a></li>
304
- <li class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-dlm_download menu-top-last" id="menu-posts-dlm_download">
305
- <a href='edit.php?post_type=dlm_download' class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-dlm_download menu-top-last" aria-haspopup="true"><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-admin-post'><br /></div><div class='wp-menu-name'>Downloads</div></a>
306
- <ul class='wp-submenu wp-submenu-wrap'><li class='wp-submenu-head' aria-hidden='true'>Downloads</li><li class="wp-first-item"><a href='edit.php?post_type=dlm_download' class="wp-first-item">All Downloads</a></li><li><a href='post-new.php?post_type=dlm_download'>Add New</a></li><li><a href='edit-tags.php?taxonomy=dlm_download_category&amp;post_type=dlm_download'>Categories</a></li><li><a href='edit-tags.php?taxonomy=dlm_download_tag&amp;post_type=dlm_download'>Tags</a></li><li><a href='edit.php?post_type=dlm_download&#038;page=download-monitor-settings'>Settings</a></li><li><a href='edit.php?post_type=dlm_download&#038;page=download-monitor-logs'>Logs</a></li><li><a href='edit.php?post_type=dlm_download&#038;page=download-monitor-reports'>Reports</a></li><li><a href='edit.php?post_type=dlm_download&#038;page=dlm-extensions'><span style="color:#419CCB;font-weight:bold;">Extensions</span></a></li></ul></li>
307
- <li class="wp-not-current-submenu wp-menu-separator" aria-hidden="true"><div class="separator"></div></li>
308
- <li class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-appearance menu-top-first" id="menu-appearance">
309
- <a href='themes.php' class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-appearance menu-top-first" aria-haspopup="true"><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-admin-appearance'><br /></div><div class='wp-menu-name'>Appearance</div></a>
310
- <ul class='wp-submenu wp-submenu-wrap'><li class='wp-submenu-head' aria-hidden='true'>Appearance</li><li class="wp-first-item"><a href='themes.php' class="wp-first-item">Themes</a></li><li class="hide-if-no-customize"><a href='customize.php?return=%2Fdownload-monitor%2Fwp-admin%2Foptions.php%3Fpage%3Ddlm_legacy_upgrade' class="hide-if-no-customize">Customize</a></li><li><a href='widgets.php'>Widgets</a></li><li><a href='nav-menus.php'>Menus</a></li><li class="hide-if-no-customize"><a href='customize.php?return=%2Fdownload-monitor%2Fwp-admin%2Foptions.php%3Fpage%3Ddlm_legacy_upgrade&#038;autofocus%5Bcontrol%5D=header_image' class="hide-if-no-customize">Header</a></li><li class="hide-if-no-customize"><a href='customize.php?return=%2Fdownload-monitor%2Fwp-admin%2Foptions.php%3Fpage%3Ddlm_legacy_upgrade&#038;autofocus%5Bcontrol%5D=background_image' class="hide-if-no-customize">Background</a></li><li><a href='themes.php?page=custom-header'>Header</a></li><li><a href='themes.php?page=custom-background'>Background</a></li><li><a href='theme-editor.php'>Editor</a></li></ul></li>
311
- <li class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-plugins" id="menu-plugins">
312
- <a href='plugins.php' class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-plugins" aria-haspopup="true"><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-admin-plugins'><br /></div><div class='wp-menu-name'>Plugins <span class='update-plugins count-0'><span class='plugin-count'>0</span></span></div></a>
313
- <ul class='wp-submenu wp-submenu-wrap'><li class='wp-submenu-head' aria-hidden='true'>Plugins <span class='update-plugins count-0'><span class='plugin-count'>0</span></span></li><li class="wp-first-item"><a href='plugins.php' class="wp-first-item">Installed Plugins</a></li><li><a href='plugin-install.php'>Add New</a></li><li><a href='plugin-editor.php'>Editor</a></li></ul></li>
314
- <li class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-users" id="menu-users">
315
- <a href='users.php' class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-users" aria-haspopup="true"><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-admin-users'><br /></div><div class='wp-menu-name'>Users</div></a>
316
- <ul class='wp-submenu wp-submenu-wrap'><li class='wp-submenu-head' aria-hidden='true'>Users</li><li class="wp-first-item"><a href='users.php' class="wp-first-item">All Users</a></li><li><a href='user-new.php'>Add New</a></li><li><a href='profile.php'>Your Profile</a></li></ul></li>
317
- <li class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-tools" id="menu-tools">
318
- <a href='tools.php' class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-tools" aria-haspopup="true"><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-admin-tools'><br /></div><div class='wp-menu-name'>Tools</div></a>
319
- <ul class='wp-submenu wp-submenu-wrap'><li class='wp-submenu-head' aria-hidden='true'>Tools</li><li class="wp-first-item"><a href='tools.php' class="wp-first-item">Available Tools</a></li><li><a href='import.php'>Import</a></li><li><a href='export.php'>Export</a></li></ul></li>
320
- <li class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-settings menu-top-last" id="menu-settings">
321
- <a href='options-general.php' class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-settings menu-top-last" aria-haspopup="true"><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-admin-settings'><br /></div><div class='wp-menu-name'>Settings</div></a>
322
- <ul class='wp-submenu wp-submenu-wrap'><li class='wp-submenu-head' aria-hidden='true'>Settings</li><li class="wp-first-item"><a href='options-general.php' class="wp-first-item">General</a></li><li><a href='options-writing.php'>Writing</a></li><li><a href='options-reading.php'>Reading</a></li><li><a href='options-discussion.php'>Discussion</a></li><li><a href='options-media.php'>Media</a></li><li><a href='options-permalink.php'>Permalinks</a></li></ul></li><li id="collapse-menu" class="hide-if-no-js"><button type="button" id="collapse-button" aria-label="Collapse Main menu" aria-expanded="true"><span class="collapse-button-icon" aria-hidden="true"></span><span class="collapse-button-label">Collapse menu</span></button></li></ul>
323
- </div>
324
- </div>
325
- <div id="wpcontent">
326
-
327
- <div id="wpadminbar" class="nojq nojs">
328
- <div class="quicklinks" id="wp-toolbar" role="navigation" aria-label="Toolbar" tabindex="0">
329
- <ul id="wp-admin-bar-root-default" class="ab-top-menu">
330
- <li id="wp-admin-bar-menu-toggle"><a class="ab-item" href="#"><span class="ab-icon"></span><span class="screen-reader-text">Menu</span></a> </li>
331
- <li id="wp-admin-bar-wp-logo" class="menupop"><a class="ab-item" aria-haspopup="true" href="http://lnmp.dev/download-monitor/wp-admin/about.php"><span class="ab-icon"></span><span class="screen-reader-text">About WordPress</span></a><div class="ab-sub-wrapper"><ul id="wp-admin-bar-wp-logo-default" class="ab-submenu">
332
- <li id="wp-admin-bar-about"><a class="ab-item" href="http://lnmp.dev/download-monitor/wp-admin/about.php">About WordPress</a> </li></ul><ul id="wp-admin-bar-wp-logo-external" class="ab-sub-secondary ab-submenu">
333
- <li id="wp-admin-bar-wporg"><a class="ab-item" href="https://wordpress.org/">WordPress.org</a> </li>
334
- <li id="wp-admin-bar-documentation"><a class="ab-item" href="https://codex.wordpress.org/">Documentation</a> </li>
335
- <li id="wp-admin-bar-support-forums"><a class="ab-item" href="https://wordpress.org/support/">Support Forums</a> </li>
336
- <li id="wp-admin-bar-feedback"><a class="ab-item" href="https://wordpress.org/support/forum/requests-and-feedback">Feedback</a> </li></ul></div> </li>
337
- <li id="wp-admin-bar-site-name" class="menupop"><a class="ab-item" aria-haspopup="true" href="http://lnmp.dev/download-monitor/">Download Monitor</a><div class="ab-sub-wrapper"><ul id="wp-admin-bar-site-name-default" class="ab-submenu">
338
- <li id="wp-admin-bar-view-site"><a class="ab-item" href="http://lnmp.dev/download-monitor/">Visit Site</a> </li></ul></div> </li>
339
- <li id="wp-admin-bar-updates"><a class="ab-item" href="http://lnmp.dev/download-monitor/wp-admin/update-core.php" title="4 Theme Updates, Translation Updates"><span class="ab-icon"></span><span class="ab-label">5</span><span class="screen-reader-text">4 Theme Updates, Translation Updates</span></a> </li>
340
- <li id="wp-admin-bar-comments"><a class="ab-item" href="http://lnmp.dev/download-monitor/wp-admin/edit-comments.php"><span class="ab-icon"></span><span class="ab-label awaiting-mod pending-count count-0" aria-hidden="true">0</span><span class="screen-reader-text">0 comments awaiting moderation</span></a> </li>
341
- <li id="wp-admin-bar-new-content" class="menupop"><a class="ab-item" aria-haspopup="true" href="http://lnmp.dev/download-monitor/wp-admin/post-new.php"><span class="ab-icon"></span><span class="ab-label">New</span></a><div class="ab-sub-wrapper"><ul id="wp-admin-bar-new-content-default" class="ab-submenu">
342
- <li id="wp-admin-bar-new-post"><a class="ab-item" href="http://lnmp.dev/download-monitor/wp-admin/post-new.php">Post</a> </li>
343
- <li id="wp-admin-bar-new-media"><a class="ab-item" href="http://lnmp.dev/download-monitor/wp-admin/media-new.php">Media</a> </li>
344
- <li id="wp-admin-bar-new-page"><a class="ab-item" href="http://lnmp.dev/download-monitor/wp-admin/post-new.php?post_type=page">Page</a> </li>
345
- <li id="wp-admin-bar-new-dlm_download"><a class="ab-item" href="http://lnmp.dev/download-monitor/wp-admin/post-new.php?post_type=dlm_download">Download</a> </li>
346
- <li id="wp-admin-bar-new-user"><a class="ab-item" href="http://lnmp.dev/download-monitor/wp-admin/user-new.php">User</a> </li></ul></div> </li></ul><ul id="wp-admin-bar-top-secondary" class="ab-top-secondary ab-top-menu">
347
- <li id="wp-admin-bar-my-account" class="menupop with-avatar"><a class="ab-item" aria-haspopup="true" href="http://lnmp.dev/download-monitor/wp-admin/profile.php">Howdy, <span class="display-name">admin</span><img alt='' src='http://2.gravatar.com/avatar/e16646b416e72c193d5f23b1790343ef?s=26&#038;d=mm&#038;r=g' srcset='http://2.gravatar.com/avatar/e16646b416e72c193d5f23b1790343ef?s=52&#038;d=mm&#038;r=g 2x' class='avatar avatar-26 photo' height='26' width='26' /></a><div class="ab-sub-wrapper"><ul id="wp-admin-bar-user-actions" class="ab-submenu">
348
- <li id="wp-admin-bar-user-info"><a class="ab-item" tabindex="-1" href="http://lnmp.dev/download-monitor/wp-admin/profile.php"><img alt='' src='http://2.gravatar.com/avatar/e16646b416e72c193d5f23b1790343ef?s=64&#038;d=mm&#038;r=g' srcset='http://2.gravatar.com/avatar/e16646b416e72c193d5f23b1790343ef?s=128&#038;d=mm&#038;r=g 2x' class='avatar avatar-64 photo' height='64' width='64' /><span class='display-name'>admin</span></a> </li>
349
- <li id="wp-admin-bar-edit-profile"><a class="ab-item" href="http://lnmp.dev/download-monitor/wp-admin/profile.php">Edit My Profile</a> </li>
350
- <li id="wp-admin-bar-logout"><a class="ab-item" href="http://lnmp.dev/download-monitor/wp-login.php?action=logout&#038;_wpnonce=73db673a22">Log Out</a> </li></ul></div> </li></ul> </div>
351
- <a class="screen-reader-shortcut" href="http://lnmp.dev/download-monitor/wp-login.php?action=logout&#038;_wpnonce=73db673a22">Log Out</a>
352
- </div>
353
-
354
-
355
- <div id="wpbody" role="main">
356
-
357
- <div id="wpbody-content" aria-label="Main content" tabindex="0">
358
- <div id="screen-meta" class="metabox-prefs">
359
-
360
- <div id="contextual-help-wrap" class="hidden no-sidebar" tabindex="-1" aria-label="Contextual Help Tab">
361
- <div id="contextual-help-back"></div>
362
- <div id="contextual-help-columns">
363
- <div class="contextual-help-tabs">
364
- <ul>
365
- </ul>
366
- </div>
367
-
368
-
369
- <div class="contextual-help-tabs-wrap">
370
- </div>
371
- </div>
372
- </div>
373
- </div>
374
- <div class="wrap">
375
- <h1>Download Monitor - Legacy Upgrade</h1><br/>
376
- <p>Welcome to the Download Monitor Legacy Upgrader. On this page we will upgrade your old Download Monitor (legacy) data so it will work with the latest version. If you're on this page, it should mean that you updated to this version from Download Monitor <strong>3.x</strong>. If you're unsure if this is correct, or you want to read more about the legacy upgrade, we've setup a page that will explain this process in a lot more detail. <a href='https://www.download-monitor.com/kb/legacy-upgrade' target='_blank'>Click here</a> if to view that page.</p>
377
-
378
- <div id="dlm-legacy-upgrade-container" style="position:relative;"></div>
379
- </div>
380
-
381
- <div class="clear"></div></div><!-- wpbody-content -->
382
- <div class="clear"></div></div><!-- wpbody -->
383
- <div class="clear"></div></div><!-- wpcontent -->
384
-
385
- <div id="wpfooter" role="contentinfo">
386
- <p id="footer-left" class="alignleft">
387
- <span id="footer-thankyou">Thank you for creating with <a href="https://wordpress.org/">WordPress</a>.</span> </p>
388
- <p id="footer-upgrade" class="alignright">
389
- Version 4.9 </p>
390
- <div class="clear"></div>
391
- </div>
392
- <div id="wp-auth-check-wrap" class="hidden">
393
- <div id="wp-auth-check-bg"></div>
394
- <div id="wp-auth-check">
395
- <button type="button" class="wp-auth-check-close button-link"><span class="screen-reader-text">Close dialog</span></button>
396
- <div id="wp-auth-check-form" class="loading" data-src="http://lnmp.dev/download-monitor/wp-login.php?interim-login=1&#038;wp_lang=en_US"></div>
397
- <div class="wp-auth-fallback">
398
- <p><b class="wp-auth-fallback-expired" tabindex="0">Session expired</b></p>
399
- <p><a href="http://lnmp.dev/download-monitor/wp-login.php" target="_blank">Please log in again.</a>
400
- The login page will open in a new window. After logging in you can close it and return to this page.</p>
401
- </div>
402
- </div>
403
- </div>
404
-
405
-
406
- <div class="clear"></div></div><!-- wpwrap -->
407
- </body>
408
- </html>
1
+ <!DOCTYPE html>
2
+ <!--[if IE 8]>
3
+ <html xmlns="http://www.w3.org/1999/xhtml" class="ie8 wp-toolbar" lang="en-US">
4
+ <![endif]-->
5
+ <!--[if !(IE 8) ]><!-->
6
+ <html xmlns="http://www.w3.org/1999/xhtml" class="wp-toolbar" lang="en-US">
7
+ <!--<![endif]-->
8
+ <head>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
10
+ <title> &lsaquo; Download Monitor &#8212; WordPress</title>
11
+
12
+ <script type="text/javascript">
13
+ addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
14
+ var ajaxurl = 'http://lnmp.dev/download-monitor/wp-admin/admin-ajax.php',
15
+ pagenow = 'admin_page_dlm_legacy_upgrade',
16
+ typenow = '',
17
+ adminpage = 'admin_page_dlm_legacy_upgrade',
18
+ thousandsSeparator = ',',
19
+ decimalPoint = '.',
20
+ isRtl = 0;
21
+ </script>
22
+
23
+ <meta name="viewport" content="width=device-width,initial-scale=1.0">
24
+ <link rel='dns-prefetch' href='//s.w.org' />
25
+ <style type="text/css">
26
+ img.wp-smiley,
27
+ img.emoji {
28
+ display: inline !important;
29
+ border: none !important;
30
+ box-shadow: none !important;
31
+ height: 1em !important;
32
+ width: 1em !important;
33
+ margin: 0 .07em !important;
34
+ vertical-align: -0.1em !important;
35
+ background: none !important;
36
+ padding: 0 !important;
37
+ }
38
+ </style>
39
+ <link rel='stylesheet' id='dashicons-css' href='http://lnmp.dev/download-monitor/wp-includes/css/dashicons.css?ver=4.9' type='text/css' media='all' />
40
+ <link rel='stylesheet' id='admin-bar-css' href='http://lnmp.dev/download-monitor/wp-includes/css/admin-bar.css?ver=4.9' type='text/css' media='all' />
41
+ <link rel='stylesheet' id='common-css' href='http://lnmp.dev/download-monitor/wp-admin/css/common.css?ver=4.9' type='text/css' media='all' />
42
+ <link rel='stylesheet' id='forms-css' href='http://lnmp.dev/download-monitor/wp-admin/css/forms.css?ver=4.9' type='text/css' media='all' />
43
+ <link rel='stylesheet' id='admin-menu-css' href='http://lnmp.dev/download-monitor/wp-admin/css/admin-menu.css?ver=4.9' type='text/css' media='all' />
44
+ <link rel='stylesheet' id='dashboard-css' href='http://lnmp.dev/download-monitor/wp-admin/css/dashboard.css?ver=4.9' type='text/css' media='all' />
45
+ <link rel='stylesheet' id='list-tables-css' href='http://lnmp.dev/download-monitor/wp-admin/css/list-tables.css?ver=4.9' type='text/css' media='all' />
46
+ <link rel='stylesheet' id='edit-css' href='http://lnmp.dev/download-monitor/wp-admin/css/edit.css?ver=4.9' type='text/css' media='all' />
47
+ <link rel='stylesheet' id='revisions-css' href='http://lnmp.dev/download-monitor/wp-admin/css/revisions.css?ver=4.9' type='text/css' media='all' />
48
+ <link rel='stylesheet' id='media-css' href='http://lnmp.dev/download-monitor/wp-admin/css/media.css?ver=4.9' type='text/css' media='all' />
49
+ <link rel='stylesheet' id='themes-css' href='http://lnmp.dev/download-monitor/wp-admin/css/themes.css?ver=4.9' type='text/css' media='all' />
50
+ <link rel='stylesheet' id='about-css' href='http://lnmp.dev/download-monitor/wp-admin/css/about.css?ver=4.9' type='text/css' media='all' />
51
+ <link rel='stylesheet' id='nav-menus-css' href='http://lnmp.dev/download-monitor/wp-admin/css/nav-menus.css?ver=4.9' type='text/css' media='all' />
52
+ <link rel='stylesheet' id='wp-pointer-css' href='http://lnmp.dev/download-monitor/wp-includes/css/wp-pointer.css?ver=4.9' type='text/css' media='all' />
53
+ <link rel='stylesheet' id='widgets-css' href='http://lnmp.dev/download-monitor/wp-admin/css/widgets.css?ver=4.9' type='text/css' media='all' />
54
+ <link rel='stylesheet' id='site-icon-css' href='http://lnmp.dev/download-monitor/wp-admin/css/site-icon.css?ver=4.9' type='text/css' media='all' />
55
+ <link rel='stylesheet' id='l10n-css' href='http://lnmp.dev/download-monitor/wp-admin/css/l10n.css?ver=4.9' type='text/css' media='all' />
56
+ <link rel='stylesheet' id='buttons-css' href='http://lnmp.dev/download-monitor/wp-includes/css/buttons.css?ver=4.9' type='text/css' media='all' />
57
+ <!--[if lte IE 7]>
58
+ <link rel='stylesheet' id='ie-css' href='http://lnmp.dev/download-monitor/wp-admin/css/ie.css?ver=4.9' type='text/css' media='all' />
59
+ <![endif]-->
60
+ <link rel='stylesheet' id='wp-auth-check-css' href='http://lnmp.dev/download-monitor/wp-includes/css/wp-auth-check.css?ver=4.9' type='text/css' media='all' />
61
+ <link rel='stylesheet' id='download_monitor_menu_css-css' href='http://lnmp.dev/download-monitor/wp-content/plugins/_download-monitor-new/assets/css/menu.css?ver=4.9' type='text/css' media='all' />
62
+ <script type="text/javascript">
63
+ window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/2.3\/72x72\/","ext":".png","svgUrl":"https:\/\/s.w.org\/images\/core\/emoji\/2.3\/svg\/","svgExt":".svg","source":{"wpemoji":"http:\/\/lnmp.dev\/download-monitor\/wp-includes\/js\/wp-emoji.js?ver=4.9","twemoji":"http:\/\/lnmp.dev\/download-monitor\/wp-includes\/js\/twemoji.js?ver=4.9"}};
64
+ ( function( window, document, settings ) {
65
+ var src, ready, ii, tests;
66
+
67
+ /*
68
+ * Create a canvas element for testing native browser support
69
+ * of emoji.
70
+ */
71
+ var canvas = document.createElement( 'canvas' );
72
+ var context = canvas.getContext && canvas.getContext( '2d' );
73
+
74
+ /**
75
+ * Check if two sets of Emoji characters render the same.
76
+ *
77
+ * @param set1 array Set of Emoji characters.
78
+ * @param set2 array Set of Emoji characters.
79
+ * @returns {boolean} True if the two sets render the same.
80
+ */
81
+ function emojiSetsRenderIdentically( set1, set2 ) {
82
+ var stringFromCharCode = String.fromCharCode;
83
+
84
+ // Cleanup from previous test.
85
+ context.clearRect( 0, 0, canvas.width, canvas.height );
86
+ context.fillText( stringFromCharCode.apply( this, set1 ), 0, 0 );
87
+ var rendered1 = canvas.toDataURL();
88
+
89
+ // Cleanup from previous test.
90
+ context.clearRect( 0, 0, canvas.width, canvas.height );
91
+ context.fillText( stringFromCharCode.apply( this, set2 ), 0, 0 );
92
+ var rendered2 = canvas.toDataURL();
93
+
94
+ return rendered1 === rendered2;
95
+ }
96
+
97
+ /**
98
+ * Detect if the browser supports rendering emoji or flag emoji. Flag emoji are a single glyph
99
+ * made of two characters, so some browsers (notably, Firefox OS X) don't support them.
100
+ *
101
+ * @since 4.2.0
102
+ *
103
+ * @param type {String} Whether to test for support of "flag" or "emoji".
104
+ * @return {Boolean} True if the browser can render emoji, false if it cannot.
105
+ */
106
+ function browserSupportsEmoji( type ) {
107
+ var isIdentical;
108
+
109
+ if ( ! context || ! context.fillText ) {
110
+ return false;
111
+ }
112
+
113
+ /*
114
+ * Chrome on OS X added native emoji rendering in M41. Unfortunately,
115
+ * it doesn't work when the font is bolder than 500 weight. So, we
116
+ * check for bold rendering support to avoid invisible emoji in Chrome.
117
+ */
118
+ context.textBaseline = 'top';
119
+ context.font = '600 32px Arial';
120
+
121
+ switch ( type ) {
122
+ case 'flag':
123
+ /*
124
+ * Test for UN flag compatibility. This is the least supported of the letter locale flags,
125
+ * so gives us an easy test for full support.
126
+ *
127
+ * To test for support, we try to render it, and compare the rendering to how it would look if
128
+ * the browser doesn't render it correctly ([U] + [N]).
129
+ */
130
+ isIdentical = emojiSetsRenderIdentically(
131
+ [ 55356, 56826, 55356, 56819 ],
132
+ [ 55356, 56826, 8203, 55356, 56819 ]
133
+ );
134
+
135
+ if ( isIdentical ) {
136
+ return false;
137
+ }
138
+
139
+ /*
140
+ * Test for English flag compatibility. England is a country in the United Kingdom, it
141
+ * does not have a two letter locale code but rather an five letter sub-division code.
142
+ *
143
+ * To test for support, we try to render it, and compare the rendering to how it would look if
144
+ * the browser doesn't render it correctly (black flag emoji + [G] + [B] + [E] + [N] + [G]).
145
+ */
146
+ isIdentical = emojiSetsRenderIdentically(
147
+ [ 55356, 57332, 56128, 56423, 56128, 56418, 56128, 56421, 56128, 56430, 56128, 56423, 56128, 56447 ],
148
+ [ 55356, 57332, 8203, 56128, 56423, 8203, 56128, 56418, 8203, 56128, 56421, 8203, 56128, 56430, 8203, 56128, 56423, 8203, 56128, 56447 ]
149
+ );
150
+
151
+ return ! isIdentical;
152
+ case 'emoji':
153
+ /*
154
+ * Emoji 5 has fairies of all genders.
155
+ *
156
+ * To test for support, try to render a new emoji (fairy, male), then compares
157
+ * it to how it would look if the browser doesn't render it correctly
158
+ * (fairy + male sign).
159
+ */
160
+ isIdentical = emojiSetsRenderIdentically(
161
+ [ 55358, 56794, 8205, 9794, 65039 ],
162
+ [ 55358, 56794, 8203, 9794, 65039 ]
163
+ );
164
+ return ! isIdentical;
165
+ }
166
+
167
+ return false;
168
+ }
169
+
170
+ function addScript( src ) {
171
+ var script = document.createElement( 'script' );
172
+
173
+ script.src = src;
174
+ script.defer = script.type = 'text/javascript';
175
+ document.getElementsByTagName( 'head' )[0].appendChild( script );
176
+ }
177
+
178
+ tests = Array( 'flag', 'emoji' );
179
+
180
+ settings.supports = {
181
+ everything: true,
182
+ everythingExceptFlag: true
183
+ };
184
+
185
+ for( ii = 0; ii < tests.length; ii++ ) {
186
+ settings.supports[ tests[ ii ] ] = browserSupportsEmoji( tests[ ii ] );
187
+
188
+ settings.supports.everything = settings.supports.everything && settings.supports[ tests[ ii ] ];
189
+
190
+ if ( 'flag' !== tests[ ii ] ) {
191
+ settings.supports.everythingExceptFlag = settings.supports.everythingExceptFlag && settings.supports[ tests[ ii ] ];
192
+ }
193
+ }
194
+
195
+ settings.supports.everythingExceptFlag = settings.supports.everythingExceptFlag && ! settings.supports.flag;
196
+
197
+ settings.DOMReady = false;
198
+ settings.readyCallback = function() {
199
+ settings.DOMReady = true;
200
+ };
201
+
202
+ if ( ! settings.supports.everything ) {
203
+ ready = function() {
204
+ settings.readyCallback();
205
+ };
206
+
207
+ if ( document.addEventListener ) {
208
+ document.addEventListener( 'DOMContentLoaded', ready, false );
209
+ window.addEventListener( 'load', ready, false );
210
+ } else {
211
+ window.attachEvent( 'onload', ready );
212
+ document.attachEvent( 'onreadystatechange', function() {
213
+ if ( 'complete' === document.readyState ) {
214
+ settings.readyCallback();
215
+ }
216
+ } );
217
+ }
218
+
219
+ src = settings.source || {};
220
+
221
+ if ( src.concatemoji ) {
222
+ addScript( src.concatemoji );
223
+ } else if ( src.wpemoji && src.twemoji ) {
224
+ addScript( src.twemoji );
225
+ addScript( src.wpemoji );
226
+ }
227
+ }
228
+
229
+ } )( window, document, window._wpemojiSettings );
230
+ </script>
231
+ <script type='text/javascript' src='http://lnmp.dev/download-monitor/wp-includes/js/jquery/jquery.js?ver=1.12.4'></script>
232
+ <script type='text/javascript' src='http://lnmp.dev/download-monitor/wp-includes/js/jquery/jquery-migrate.js?ver=1.4.1'></script>
233
+ <script type='text/javascript'>
234
+ /* <![CDATA[ */
235
+ var userSettings = {"url":"\/download-monitor\/","uid":"1","time":"1511968878","secure":""};
236
+ /* ]]> */
237
+ </script>
238
+ <script type='text/javascript' src='http://lnmp.dev/download-monitor/wp-includes/js/utils.js?ver=4.9'></script>
239
+ <script type='text/javascript'>
240
+ /* <![CDATA[ */
241
+ var dlm_id_strings = {"insert_download":"Insert Download"};
242
+ /* ]]> */
243
+ </script>
244
+ <script type='text/javascript' src='http://lnmp.dev/download-monitor/wp-content/plugins/_download-monitor-new/assets/js/insert-download.js?ver=4.0.0'></script>
245
+ <script type='text/javascript' src='http://lnmp.dev/download-monitor/wp-content/plugins/_download-monitor-new/assets/js/notices.js?ver=4.0.0'></script>
246
+ <link id="wp-admin-canonical" rel="canonical" href="http://lnmp.dev/download-monitor/wp-admin/options.php?page=dlm_legacy_upgrade" />
247
+ <script>
248
+ if ( window.history.replaceState ) {
249
+ window.history.replaceState( null, null, document.getElementById( 'wp-admin-canonical' ).href + window.location.hash );
250
+ }
251
+ </script>
252
+ <script type="text/javascript">var _wpColorScheme = {"icons":{"base":"#82878c","focus":"#00a0d2","current":"#fff"}};</script>
253
+ <style type="text/css" media="print">#wpadminbar { display:none; }</style>
254
+ </head>
255
+ <body class="wp-admin wp-core-ui no-js admin_page_dlm_legacy_upgrade auto-fold admin-bar branch-4-9 version-4-9 admin-color-fresh locale-en-us no-customize-support no-svg">
256
+ <script type="text/javascript">
257
+ document.body.className = document.body.className.replace('no-js','js');
258
+ </script>
259
+
260
+ <!--[if lte IE 8]>
261
+ <script type="text/javascript">
262
+ document.body.className = document.body.className.replace( /(^|\s)(no-)?customize-support(?=\s|$)/, '' ) + ' no-customize-support';
263
+ </script>
264
+ <![endif]-->
265
+ <!--[if gte IE 9]><!-->
266
+ <script type="text/javascript">
267
+ (function() {
268
+ var request, b = document.body, c = 'className', cs = 'customize-support', rcs = new RegExp('(^|\\s+)(no-)?'+cs+'(\\s+|$)');
269
+
270
+ request = true;
271
+
272
+ b[c] = b[c].replace( rcs, ' ' );
273
+ // The customizer requires postMessage and CORS (if the site is cross domain)
274
+ b[c] += ( window.postMessage && request ? ' ' : ' no-' ) + cs;
275
+ }());
276
+ </script>
277
+ <!--<![endif]-->
278
+
279
+ <div id="wpwrap">
280
+
281
+ <div id="adminmenumain" role="navigation" aria-label="Main menu">
282
+ <a href="#wpbody-content" class="screen-reader-shortcut">Skip to main content</a>
283
+ <a href="#wp-toolbar" class="screen-reader-shortcut">Skip to toolbar</a>
284
+ <div id="adminmenuback"></div>
285
+ <div id="adminmenuwrap">
286
+ <ul id="adminmenu">
287
+
288
+
289
+ <li class="wp-first-item wp-has-submenu wp-not-current-submenu menu-top menu-top-first menu-icon-dashboard menu-top-last" id="menu-dashboard">
290
+ <a href='index.php' class="wp-first-item wp-has-submenu wp-not-current-submenu menu-top menu-top-first menu-icon-dashboard menu-top-last" aria-haspopup="true"><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-dashboard'><br /></div><div class='wp-menu-name'>Dashboard</div></a>
291
+ <ul class='wp-submenu wp-submenu-wrap'><li class='wp-submenu-head' aria-hidden='true'>Dashboard</li><li class="wp-first-item"><a href='index.php' class="wp-first-item">Home</a></li><li><a href='update-core.php'>Updates <span class='update-plugins count-5'><span class='update-count'>5</span></span></a></li></ul></li>
292
+ <li class="wp-not-current-submenu wp-menu-separator" aria-hidden="true"><div class="separator"></div></li>
293
+ <li class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-post open-if-no-js menu-top-first" id="menu-posts">
294
+ <a href='edit.php' class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-post open-if-no-js menu-top-first" aria-haspopup="true"><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-admin-post'><br /></div><div class='wp-menu-name'>Posts</div></a>
295
+ <ul class='wp-submenu wp-submenu-wrap'><li class='wp-submenu-head' aria-hidden='true'>Posts</li><li class="wp-first-item"><a href='edit.php' class="wp-first-item">All Posts</a></li><li><a href='post-new.php'>Add New</a></li><li><a href='edit-tags.php?taxonomy=category'>Categories</a></li><li><a href='edit-tags.php?taxonomy=post_tag'>Tags</a></li></ul></li>
296
+ <li class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-media" id="menu-media">
297
+ <a href='upload.php' class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-media" aria-haspopup="true"><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-admin-media'><br /></div><div class='wp-menu-name'>Media</div></a>
298
+ <ul class='wp-submenu wp-submenu-wrap'><li class='wp-submenu-head' aria-hidden='true'>Media</li><li class="wp-first-item"><a href='upload.php' class="wp-first-item">Library</a></li><li><a href='media-new.php'>Add New</a></li></ul></li>
299
+ <li class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-page" id="menu-pages">
300
+ <a href='edit.php?post_type=page' class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-page" aria-haspopup="true"><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-admin-page'><br /></div><div class='wp-menu-name'>Pages</div></a>
301
+ <ul class='wp-submenu wp-submenu-wrap'><li class='wp-submenu-head' aria-hidden='true'>Pages</li><li class="wp-first-item"><a href='edit.php?post_type=page' class="wp-first-item">All Pages</a></li><li><a href='post-new.php?post_type=page'>Add New</a></li></ul></li>
302
+ <li class="wp-not-current-submenu menu-top menu-icon-comments" id="menu-comments">
303
+ <a href='edit-comments.php' class="wp-not-current-submenu menu-top menu-icon-comments" ><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-admin-comments'><br /></div><div class='wp-menu-name'>Comments <span class="awaiting-mod count-0"><span class="pending-count">0</span></span></div></a></li>
304
+ <li class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-dlm_download menu-top-last" id="menu-posts-dlm_download">
305
+ <a href='edit.php?post_type=dlm_download' class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-dlm_download menu-top-last" aria-haspopup="true"><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-admin-post'><br /></div><div class='wp-menu-name'>Downloads</div></a>
306
+ <ul class='wp-submenu wp-submenu-wrap'><li class='wp-submenu-head' aria-hidden='true'>Downloads</li><li class="wp-first-item"><a href='edit.php?post_type=dlm_download' class="wp-first-item">All Downloads</a></li><li><a href='post-new.php?post_type=dlm_download'>Add New</a></li><li><a href='edit-tags.php?taxonomy=dlm_download_category&amp;post_type=dlm_download'>Categories</a></li><li><a href='edit-tags.php?taxonomy=dlm_download_tag&amp;post_type=dlm_download'>Tags</a></li><li><a href='edit.php?post_type=dlm_download&#038;page=download-monitor-settings'>Settings</a></li><li><a href='edit.php?post_type=dlm_download&#038;page=download-monitor-logs'>Logs</a></li><li><a href='edit.php?post_type=dlm_download&#038;page=download-monitor-reports'>Reports</a></li><li><a href='edit.php?post_type=dlm_download&#038;page=dlm-extensions'><span style="color:#419CCB;font-weight:bold;">Extensions</span></a></li></ul></li>
307
+ <li class="wp-not-current-submenu wp-menu-separator" aria-hidden="true"><div class="separator"></div></li>
308
+ <li class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-appearance menu-top-first" id="menu-appearance">
309
+ <a href='themes.php' class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-appearance menu-top-first" aria-haspopup="true"><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-admin-appearance'><br /></div><div class='wp-menu-name'>Appearance</div></a>
310
+ <ul class='wp-submenu wp-submenu-wrap'><li class='wp-submenu-head' aria-hidden='true'>Appearance</li><li class="wp-first-item"><a href='themes.php' class="wp-first-item">Themes</a></li><li class="hide-if-no-customize"><a href='customize.php?return=%2Fdownload-monitor%2Fwp-admin%2Foptions.php%3Fpage%3Ddlm_legacy_upgrade' class="hide-if-no-customize">Customize</a></li><li><a href='widgets.php'>Widgets</a></li><li><a href='nav-menus.php'>Menus</a></li><li class="hide-if-no-customize"><a href='customize.php?return=%2Fdownload-monitor%2Fwp-admin%2Foptions.php%3Fpage%3Ddlm_legacy_upgrade&#038;autofocus%5Bcontrol%5D=header_image' class="hide-if-no-customize">Header</a></li><li class="hide-if-no-customize"><a href='customize.php?return=%2Fdownload-monitor%2Fwp-admin%2Foptions.php%3Fpage%3Ddlm_legacy_upgrade&#038;autofocus%5Bcontrol%5D=background_image' class="hide-if-no-customize">Background</a></li><li><a href='themes.php?page=custom-header'>Header</a></li><li><a href='themes.php?page=custom-background'>Background</a></li><li><a href='theme-editor.php'>Editor</a></li></ul></li>
311
+ <li class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-plugins" id="menu-plugins">
312
+ <a href='plugins.php' class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-plugins" aria-haspopup="true"><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-admin-plugins'><br /></div><div class='wp-menu-name'>Plugins <span class='update-plugins count-0'><span class='plugin-count'>0</span></span></div></a>
313
+ <ul class='wp-submenu wp-submenu-wrap'><li class='wp-submenu-head' aria-hidden='true'>Plugins <span class='update-plugins count-0'><span class='plugin-count'>0</span></span></li><li class="wp-first-item"><a href='plugins.php' class="wp-first-item">Installed Plugins</a></li><li><a href='plugin-install.php'>Add New</a></li><li><a href='plugin-editor.php'>Editor</a></li></ul></li>
314
+ <li class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-users" id="menu-users">
315
+ <a href='users.php' class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-users" aria-haspopup="true"><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-admin-users'><br /></div><div class='wp-menu-name'>Users</div></a>
316
+ <ul class='wp-submenu wp-submenu-wrap'><li class='wp-submenu-head' aria-hidden='true'>Users</li><li class="wp-first-item"><a href='users.php' class="wp-first-item">All Users</a></li><li><a href='user-new.php'>Add New</a></li><li><a href='profile.php'>Your Profile</a></li></ul></li>
317
+ <li class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-tools" id="menu-tools">
318
+ <a href='tools.php' class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-tools" aria-haspopup="true"><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-admin-tools'><br /></div><div class='wp-menu-name'>Tools</div></a>
319
+ <ul class='wp-submenu wp-submenu-wrap'><li class='wp-submenu-head' aria-hidden='true'>Tools</li><li class="wp-first-item"><a href='tools.php' class="wp-first-item">Available Tools</a></li><li><a href='import.php'>Import</a></li><li><a href='export.php'>Export</a></li></ul></li>
320
+ <li class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-settings menu-top-last" id="menu-settings">
321
+ <a href='options-general.php' class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-settings menu-top-last" aria-haspopup="true"><div class="wp-menu-arrow"><div></div></div><div class='wp-menu-image dashicons-before dashicons-admin-settings'><br /></div><div class='wp-menu-name'>Settings</div></a>
322
+ <ul class='wp-submenu wp-submenu-wrap'><li class='wp-submenu-head' aria-hidden='true'>Settings</li><li class="wp-first-item"><a href='options-general.php' class="wp-first-item">General</a></li><li><a href='options-writing.php'>Writing</a></li><li><a href='options-reading.php'>Reading</a></li><li><a href='options-discussion.php'>Discussion</a></li><li><a href='options-media.php'>Media</a></li><li><a href='options-permalink.php'>Permalinks</a></li></ul></li><li id="collapse-menu" class="hide-if-no-js"><button type="button" id="collapse-button" aria-label="Collapse Main menu" aria-expanded="true"><span class="collapse-button-icon" aria-hidden="true"></span><span class="collapse-button-label">Collapse menu</span></button></li></ul>
323
+ </div>
324
+ </div>
325
+ <div id="wpcontent">
326
+
327
+ <div id="wpadminbar" class="nojq nojs">
328
+ <div class="quicklinks" id="wp-toolbar" role="navigation" aria-label="Toolbar" tabindex="0">
329
+ <ul id="wp-admin-bar-root-default" class="ab-top-menu">
330
+ <li id="wp-admin-bar-menu-toggle"><a class="ab-item" href="#"><span class="ab-icon"></span><span class="screen-reader-text">Menu</span></a> </li>
331
+ <li id="wp-admin-bar-wp-logo" class="menupop"><a class="ab-item" aria-haspopup="true" href="http://lnmp.dev/download-monitor/wp-admin/about.php"><span class="ab-icon"></span><span class="screen-reader-text">About WordPress</span></a><div class="ab-sub-wrapper"><ul id="wp-admin-bar-wp-logo-default" class="ab-submenu">
332
+ <li id="wp-admin-bar-about"><a class="ab-item" href="http://lnmp.dev/download-monitor/wp-admin/about.php">About WordPress</a> </li></ul><ul id="wp-admin-bar-wp-logo-external" class="ab-sub-secondary ab-submenu">
333
+ <li id="wp-admin-bar-wporg"><a class="ab-item" href="https://wordpress.org/">WordPress.org</a> </li>
334
+ <li id="wp-admin-bar-documentation"><a class="ab-item" href="https://codex.wordpress.org/">Documentation</a> </li>
335
+ <li id="wp-admin-bar-support-forums"><a class="ab-item" href="https://wordpress.org/support/">Support Forums</a> </li>
336
+ <li id="wp-admin-bar-feedback"><a class="ab-item" href="https://wordpress.org/support/forum/requests-and-feedback">Feedback</a> </li></ul></div> </li>
337
+ <li id="wp-admin-bar-site-name" class="menupop"><a class="ab-item" aria-haspopup="true" href="http://lnmp.dev/download-monitor/">Download Monitor</a><div class="ab-sub-wrapper"><ul id="wp-admin-bar-site-name-default" class="ab-submenu">
338
+ <li id="wp-admin-bar-view-site"><a class="ab-item" href="http://lnmp.dev/download-monitor/">Visit Site</a> </li></ul></div> </li>
339
+ <li id="wp-admin-bar-updates"><a class="ab-item" href="http://lnmp.dev/download-monitor/wp-admin/update-core.php" title="4 Theme Updates, Translation Updates"><span class="ab-icon"></span><span class="ab-label">5</span><span class="screen-reader-text">4 Theme Updates, Translation Updates</span></a> </li>
340
+ <li id="wp-admin-bar-comments"><a class="ab-item" href="http://lnmp.dev/download-monitor/wp-admin/edit-comments.php"><span class="ab-icon"></span><span class="ab-label awaiting-mod pending-count count-0" aria-hidden="true">0</span><span class="screen-reader-text">0 comments awaiting moderation</span></a> </li>
341
+ <li id="wp-admin-bar-new-content" class="menupop"><a class="ab-item" aria-haspopup="true" href="http://lnmp.dev/download-monitor/wp-admin/post-new.php"><span class="ab-icon"></span><span class="ab-label">New</span></a><div class="ab-sub-wrapper"><ul id="wp-admin-bar-new-content-default" class="ab-submenu">
342
+ <li id="wp-admin-bar-new-post"><a class="ab-item" href="http://lnmp.dev/download-monitor/wp-admin/post-new.php">Post</a> </li>
343
+ <li id="wp-admin-bar-new-media"><a class="ab-item" href="http://lnmp.dev/download-monitor/wp-admin/media-new.php">Media</a> </li>
344
+ <li id="wp-admin-bar-new-page"><a class="ab-item" href="http://lnmp.dev/download-monitor/wp-admin/post-new.php?post_type=page">Page</a> </li>
345
+ <li id="wp-admin-bar-new-dlm_download"><a class="ab-item" href="http://lnmp.dev/download-monitor/wp-admin/post-new.php?post_type=dlm_download">Download</a> </li>
346
+ <li id="wp-admin-bar-new-user"><a class="ab-item" href="http://lnmp.dev/download-monitor/wp-admin/user-new.php">User</a> </li></ul></div> </li></ul><ul id="wp-admin-bar-top-secondary" class="ab-top-secondary ab-top-menu">
347
+ <li id="wp-admin-bar-my-account" class="menupop with-avatar"><a class="ab-item" aria-haspopup="true" href="http://lnmp.dev/download-monitor/wp-admin/profile.php">Howdy, <span class="display-name">admin</span><img alt='' src='http://2.gravatar.com/avatar/e16646b416e72c193d5f23b1790343ef?s=26&#038;d=mm&#038;r=g' srcset='http://2.gravatar.com/avatar/e16646b416e72c193d5f23b1790343ef?s=52&#038;d=mm&#038;r=g 2x' class='avatar avatar-26 photo' height='26' width='26' /></a><div class="ab-sub-wrapper"><ul id="wp-admin-bar-user-actions" class="ab-submenu">
348
+ <li id="wp-admin-bar-user-info"><a class="ab-item" tabindex="-1" href="http://lnmp.dev/download-monitor/wp-admin/profile.php"><img alt='' src='http://2.gravatar.com/avatar/e16646b416e72c193d5f23b1790343ef?s=64&#038;d=mm&#038;r=g' srcset='http://2.gravatar.com/avatar/e16646b416e72c193d5f23b1790343ef?s=128&#038;d=mm&#038;r=g 2x' class='avatar avatar-64 photo' height='64' width='64' /><span class='display-name'>admin</span></a> </li>
349
+ <li id="wp-admin-bar-edit-profile"><a class="ab-item" href="http://lnmp.dev/download-monitor/wp-admin/profile.php">Edit My Profile</a> </li>
350
+ <li id="wp-admin-bar-logout"><a class="ab-item" href="http://lnmp.dev/download-monitor/wp-login.php?action=logout&#038;_wpnonce=73db673a22">Log Out</a> </li></ul></div> </li></ul> </div>
351
+ <a class="screen-reader-shortcut" href="http://lnmp.dev/download-monitor/wp-login.php?action=logout&#038;_wpnonce=73db673a22">Log Out</a>
352
+ </div>
353
+
354
+
355
+ <div id="wpbody" role="main">
356
+
357
+ <div id="wpbody-content" aria-label="Main content" tabindex="0">
358
+ <div id="screen-meta" class="metabox-prefs">
359
+
360
+ <div id="contextual-help-wrap" class="hidden no-sidebar" tabindex="-1" aria-label="Contextual Help Tab">
361
+ <div id="contextual-help-back"></div>
362
+ <div id="contextual-help-columns">
363
+ <div class="contextual-help-tabs">
364
+ <ul>
365
+ </ul>
366
+ </div>
367
+
368
+
369
+ <div class="contextual-help-tabs-wrap">
370
+ </div>
371
+ </div>
372
+ </div>
373
+ </div>
374
+ <div class="wrap">
375
+ <h1>Download Monitor - Legacy Upgrade</h1><br/>
376
+ <p>Welcome to the Download Monitor Legacy Upgrader. On this page we will upgrade your old Download Monitor (legacy) data so it will work with the latest version. If you're on this page, it should mean that you updated to this version from Download Monitor <strong>3.x</strong>. If you're unsure if this is correct, or you want to read more about the legacy upgrade, we've setup a page that will explain this process in a lot more detail. <a href='https://www.download-monitor.com/kb/legacy-upgrade' target='_blank'>Click here</a> if to view that page.</p>
377
+
378
+ <div id="dlm-legacy-upgrade-container" style="position:relative;"></div>
379
+ </div>
380
+
381
+ <div class="clear"></div></div><!-- wpbody-content -->
382
+ <div class="clear"></div></div><!-- wpbody -->
383
+ <div class="clear"></div></div><!-- wpcontent -->
384
+
385
+ <div id="wpfooter" role="contentinfo">
386
+ <p id="footer-left" class="alignleft">
387
+ <span id="footer-thankyou">Thank you for creating with <a href="https://wordpress.org/">WordPress</a>.</span> </p>
388
+ <p id="footer-upgrade" class="alignright">
389
+ Version 4.9 </p>
390
+ <div class="clear"></div>
391
+ </div>
392
+ <div id="wp-auth-check-wrap" class="hidden">
393
+ <div id="wp-auth-check-bg"></div>
394
+ <div id="wp-auth-check">
395
+ <button type="button" class="wp-auth-check-close button-link"><span class="screen-reader-text">Close dialog</span></button>
396
+ <div id="wp-auth-check-form" class="loading" data-src="http://lnmp.dev/download-monitor/wp-login.php?interim-login=1&#038;wp_lang=en_US"></div>
397
+ <div class="wp-auth-fallback">
398
+ <p><b class="wp-auth-fallback-expired" tabindex="0">Session expired</b></p>
399
+ <p><a href="http://lnmp.dev/download-monitor/wp-login.php" target="_blank">Please log in again.</a>
400
+ The login page will open in a new window. After logging in you can close it and return to this page.</p>
401
+ </div>
402
+ </div>
403
+ </div>
404
+
405
+
406
+ <div class="clear"></div></div><!-- wpwrap -->
407
+ </body>
408
+ </html>
assets/js/legacy-upgrader/src/index.js CHANGED
@@ -1,20 +1,20 @@
1
- // import 'promise-polyfill';
2
- // import 'isomorphic-fetch';
3
- import { h, render } from 'preact';
4
- import './style';
5
-
6
- let root;
7
- function DLM_LU_init() {
8
- let App = require('./components/app').default;
9
- root = render(<App />, document.getElementById("dlm-legacy-upgrade-container"), root);
10
- }
11
-
12
- // in development, set up HMR:
13
- if (module.hot) {
14
- //require('preact/devtools'); // turn this on if you want to enable React DevTools!
15
- module.hot.accept('./components/app', () => requestAnimationFrame(init) );
16
- }
17
-
18
- document.addEventListener("DOMContentLoaded", function(event) {
19
- DLM_LU_init();
20
- });
1
+ // import 'promise-polyfill';
2
+ // import 'isomorphic-fetch';
3
+ import { h, render } from 'preact';
4
+ import './style';
5
+
6
+ let root;
7
+ function DLM_LU_init() {
8
+ let App = require('./components/app').default;
9
+ root = render(<App />, document.getElementById("dlm-legacy-upgrade-container"), root);
10
+ }
11
+
12
+ // in development, set up HMR:
13
+ if (module.hot) {
14
+ //require('preact/devtools'); // turn this on if you want to enable React DevTools!
15
+ module.hot.accept('./components/app', () => requestAnimationFrame(init) );
16
+ }
17
+
18
+ document.addEventListener("DOMContentLoaded", function(event) {
19
+ DLM_LU_init();
20
+ });
assets/js/legacy-upgrader/src/style/helpers.less CHANGED
@@ -1,20 +1,20 @@
1
- @import 'variables';
2
- @import 'mixins';
3
-
4
- .iconbefore( @glyph: "\f333" ) {
5
- font-family: dashicons !important;
6
- speak: none;
7
- font-weight: normal;
8
- font-variant: normal;
9
- text-transform: none;
10
- -webkit-font-smoothing: antialiased;
11
- -moz-osx-font-smoothing: grayscale;
12
- margin: 0 4px 0 0;
13
- content: @glyph;
14
- top: 1px;
15
- left: -1px;
16
- font-size: 1em;
17
- line-height: inherit;
18
- position: relative;
19
- vertical-align: top;
20
  }
1
+ @import 'variables';
2
+ @import 'mixins';
3
+
4
+ .iconbefore( @glyph: "\f333" ) {
5
+ font-family: dashicons !important;
6
+ speak: none;
7
+ font-weight: normal;
8
+ font-variant: normal;
9
+ text-transform: none;
10
+ -webkit-font-smoothing: antialiased;
11
+ -moz-osx-font-smoothing: grayscale;
12
+ margin: 0 4px 0 0;
13
+ content: @glyph;
14
+ top: 1px;
15
+ left: -1px;
16
+ font-size: 1em;
17
+ line-height: inherit;
18
+ position: relative;
19
+ vertical-align: top;
20
  }
assets/js/legacy-upgrader/src/style/index.less CHANGED
@@ -1,6 +1,6 @@
1
- @import 'helpers';
2
-
3
- #dlm_legacy_upgrader_app {
4
- height: 100%;
5
- box-sizing: border-box;
6
- }
1
+ @import 'helpers';
2
+
3
+ #dlm_legacy_upgrader_app {
4
+ height: 100%;
5
+ box-sizing: border-box;
6
+ }
assets/js/legacy-upgrader/src/style/mixins.less CHANGED
@@ -1,18 +1,18 @@
1
- .fill() {
2
- position: absolute;
3
- left: 0;
4
- top: 0;
5
- width: 100%;
6
- height: 100%;
7
- }
8
-
9
- .scroll() {
10
- overflow: auto;
11
- overflow-scrolling: touch;
12
-
13
- & > .inner {
14
- position: relative;
15
- transform: translateZ(0);
16
- overflow: hidden;
17
- }
18
- }
1
+ .fill() {
2
+ position: absolute;
3
+ left: 0;
4
+ top: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ }
8
+
9
+ .scroll() {
10
+ overflow: auto;
11
+ overflow-scrolling: touch;
12
+
13
+ & > .inner {
14
+ position: relative;
15
+ transform: translateZ(0);
16
+ overflow: hidden;
17
+ }
18
+ }
assets/js/legacy-upgrader/src/style/variables.less CHANGED
@@ -1,5 +1,5 @@
1
- @red: #F00;
2
- @blue: #00F;
3
- @white: #FFF;
4
- @gray: #999;
5
- @black: #000;
1
+ @red: #F00;
2
+ @blue: #00F;
3
+ @white: #FFF;
4
+ @gray: #999;
5
+ @black: #000;
assets/js/legacy-upgrader/webpack.config.babel.js CHANGED
@@ -1,184 +1,184 @@
1
- import webpack from 'webpack';
2
- import ExtractTextPlugin from 'extract-text-webpack-plugin';
3
- import HtmlWebpackPlugin from 'html-webpack-plugin';
4
- import autoprefixer from 'autoprefixer';
5
- import path from 'path';
6
- const ENV = process.env.NODE_ENV || 'development';
7
-
8
- const CSS_MAPS = ENV!=='production';
9
-
10
- module.exports = {
11
- context: path.resolve(__dirname, "src"),
12
- entry: './index.js',
13
-
14
- output: {
15
- path: path.resolve(__dirname, "build"),
16
- publicPath: '/',
17
- filename: 'bundle.js'
18
- },
19
-
20
- resolve: {
21
- extensions: ['.jsx', '.js', '.json', '.less'],
22
- modules: [
23
- path.resolve(__dirname, "src/lib"),
24
- path.resolve(__dirname, "node_modules"),
25
- 'node_modules'
26
- ],
27
- alias: {
28
- components: path.resolve(__dirname, "src/components"), // used for tests
29
- style: path.resolve(__dirname, "src/style"),
30
- 'react': 'preact-compat',
31
- 'react-dom': 'preact-compat'
32
- }
33
- },
34
-
35
- module: {
36
- rules: [
37
- {
38
- test: /\.jsx?$/,
39
- exclude: path.resolve(__dirname, 'src'),
40
- enforce: 'pre',
41
- use: 'source-map-loader'
42
- },
43
- {
44
- test: /\.jsx?$/,
45
- exclude: /node_modules/,
46
- use: 'babel-loader'
47
- },
48
- {
49
- // Transform our own .(less|css) files with PostCSS and CSS-modules
50
- test: /\.(less|css)$/,
51
- include: [path.resolve(__dirname, 'src/components')],
52
- use: ExtractTextPlugin.extract({
53
- fallback: 'style-loader',
54
- use: [
55
- {
56
- loader: 'css-loader',
57
- options: { modules: true, sourceMap: CSS_MAPS, importLoaders: 1, minimize: true }
58
- },
59
- {
60
- loader: `postcss-loader`,
61
- options: {
62
- sourceMap: CSS_MAPS,
63
- plugins: () => {
64
- autoprefixer({ browsers: [ 'last 2 versions' ] });
65
- }
66
- }
67
- },
68
- {
69
- loader: 'less-loader',
70
- options: { sourceMap: CSS_MAPS }
71
- }
72
- ]
73
- })
74
- },
75
- {
76
- test: /\.(less|css)$/,
77
- exclude: [path.resolve(__dirname, 'src/components')],
78
- use: ExtractTextPlugin.extract({
79
- fallback: 'style-loader',
80
- use: [
81
- {
82
- loader: 'css-loader',
83
- options: { sourceMap: CSS_MAPS, importLoaders: 1, minimize: true }
84
- },
85
- {
86
- loader: `postcss-loader`,
87
- options: {
88
- sourceMap: CSS_MAPS,
89
- plugins: () => {
90
- autoprefixer({ browsers: [ 'last 2 versions' ] });
91
- }
92
- }
93
- },
94
- {
95
- loader: 'less-loader',
96
- options: { sourceMap: CSS_MAPS }
97
- }
98
- ]
99
- })
100
- },
101
- {
102
- test: /\.json$/,
103
- use: 'json-loader'
104
- },
105
- {
106
- test: /\.(xml|html|txt|md)$/,
107
- use: 'raw-loader'
108
- },
109
- {
110
- test: /\.(svg|woff2?|ttf|eot|jpe?g|png|gif)(\?.*)?$/i,
111
- use: ENV==='production' ? 'file-loader' : 'url-loader'
112
- }
113
- ]
114
- },
115
- plugins: ([
116
- new webpack.NoEmitOnErrorsPlugin(),
117
- new ExtractTextPlugin({
118
- filename: 'style.css',
119
- allChunks: true,
120
- disable: ENV !== 'production'
121
- }),
122
- new webpack.DefinePlugin({
123
- 'process.env.NODE_ENV': JSON.stringify(ENV)
124
- }),
125
- new HtmlWebpackPlugin({
126
- template: './index.ejs',
127
- minify: { collapseWhitespace: true }
128
- })
129
- ]).concat(ENV==='production' ? [
130
- new webpack.optimize.UglifyJsPlugin({
131
- output: {
132
- comments: false
133
- },
134
- compress: {
135
- unsafe_comps: true,
136
- properties: true,
137
- keep_fargs: false,
138
- pure_getters: true,
139
- collapse_vars: true,
140
- unsafe: true,
141
- warnings: false,
142
- screw_ie8: true,
143
- sequences: true,
144
- dead_code: true,
145
- drop_debugger: true,
146
- comparisons: true,
147
- conditionals: true,
148
- evaluate: true,
149
- booleans: true,
150
- loops: true,
151
- unused: true,
152
- hoist_funs: true,
153
- if_return: true,
154
- join_vars: true,
155
- cascade: true,
156
- drop_console: true
157
- }
158
- })
159
- ] : []),
160
-
161
- stats: { colors: true },
162
-
163
- node: {
164
- global: true,
165
- process: false,
166
- Buffer: false,
167
- __filename: false,
168
- __dirname: false,
169
- setImmediate: false
170
- },
171
-
172
- devtool: ENV==='production' ? 'source-map' : 'cheap-module-eval-source-map',
173
-
174
- devServer: {
175
- inline: true,
176
- port: 1337,
177
- host: 'lnmp.dev',
178
- publicPath: '/',
179
- contentBase: './src',
180
- historyApiFallback: true,
181
- open: true,
182
- openPage: ''
183
- }
184
- };
1
+ import webpack from 'webpack';
2
+ import ExtractTextPlugin from 'extract-text-webpack-plugin';
3
+ import HtmlWebpackPlugin from 'html-webpack-plugin';
4
+ import autoprefixer from 'autoprefixer';
5
+ import path from 'path';
6
+ const ENV = process.env.NODE_ENV || 'development';
7
+
8
+ const CSS_MAPS = ENV!=='production';
9
+
10
+ module.exports = {
11
+ context: path.resolve(__dirname, "src"),
12
+ entry: './index.js',
13
+
14
+ output: {
15
+ path: path.resolve(__dirname, "build"),
16
+ publicPath: '/',
17
+ filename: 'bundle.js'
18
+ },
19
+
20
+ resolve: {
21
+ extensions: ['.jsx', '.js', '.json', '.less'],
22
+ modules: [
23
+ path.resolve(__dirname, "src/lib"),
24
+ path.resolve(__dirname, "node_modules"),
25
+ 'node_modules'
26
+ ],
27
+ alias: {
28
+ components: path.resolve(__dirname, "src/components"), // used for tests
29
+ style: path.resolve(__dirname, "src/style"),
30
+ 'react': 'preact-compat',
31
+ 'react-dom': 'preact-compat'
32
+ }
33
+ },
34
+
35
+ module: {
36
+ rules: [
37
+ {
38
+ test: /\.jsx?$/,
39
+ exclude: path.resolve(__dirname, 'src'),
40
+ enforce: 'pre',
41
+ use: 'source-map-loader'
42
+ },
43
+ {
44
+ test: /\.jsx?$/,
45
+ exclude: /node_modules/,
46
+ use: 'babel-loader'
47
+ },
48
+ {
49
+ // Transform our own .(less|css) files with PostCSS and CSS-modules
50
+ test: /\.(less|css)$/,
51
+ include: [path.resolve(__dirname, 'src/components')],
52
+ use: ExtractTextPlugin.extract({
53
+ fallback: 'style-loader',
54
+ use: [
55
+ {
56
+ loader: 'css-loader',
57
+ options: { modules: true, sourceMap: CSS_MAPS, importLoaders: 1, minimize: true }
58
+ },
59
+ {
60
+ loader: `postcss-loader`,
61
+ options: {
62
+ sourceMap: CSS_MAPS,
63
+ plugins: () => {
64
+ autoprefixer({ browsers: [ 'last 2 versions' ] });
65
+ }
66
+ }
67
+ },
68
+ {
69
+ loader: 'less-loader',
70
+ options: { sourceMap: CSS_MAPS }
71
+ }
72
+ ]
73
+ })
74
+ },
75
+ {
76
+ test: /\.(less|css)$/,
77
+ exclude: [path.resolve(__dirname, 'src/components')],
78
+ use: ExtractTextPlugin.extract({
79
+ fallback: 'style-loader',
80
+ use: [
81
+ {
82
+ loader: 'css-loader',
83
+ options: { sourceMap: CSS_MAPS, importLoaders: 1, minimize: true }
84
+ },
85
+ {
86
+ loader: `postcss-loader`,
87
+ options: {
88
+ sourceMap: CSS_MAPS,
89
+ plugins: () => {
90
+ autoprefixer({ browsers: [ 'last 2 versions' ] });
91
+ }
92
+ }
93
+ },
94
+ {
95
+ loader: 'less-loader',
96
+ options: { sourceMap: CSS_MAPS }
97
+ }
98
+ ]
99
+ })
100
+ },
101
+ {
102
+ test: /\.json$/,
103
+ use: 'json-loader'
104
+ },
105
+ {
106
+ test: /\.(xml|html|txt|md)$/,
107
+ use: 'raw-loader'
108
+ },
109
+ {
110
+ test: /\.(svg|woff2?|ttf|eot|jpe?g|png|gif)(\?.*)?$/i,
111
+ use: ENV==='production' ? 'file-loader' : 'url-loader'
112
+ }
113
+ ]
114
+ },
115
+ plugins: ([
116
+ new webpack.NoEmitOnErrorsPlugin(),
117
+ new ExtractTextPlugin({
118
+ filename: 'style.css',
119
+ allChunks: true,
120
+ disable: ENV !== 'production'
121
+ }),
122
+ new webpack.DefinePlugin({
123
+ 'process.env.NODE_ENV': JSON.stringify(ENV)
124
+ }),
125
+ new HtmlWebpackPlugin({
126
+ template: './index.ejs',
127
+ minify: { collapseWhitespace: true }
128
+ })
129
+ ]).concat(ENV==='production' ? [
130
+ new webpack.optimize.UglifyJsPlugin({
131
+ output: {
132
+ comments: false
133
+ },
134
+ compress: {
135
+ unsafe_comps: true,
136
+ properties: true,
137
+ keep_fargs: false,
138
+ pure_getters: true,
139
+ collapse_vars: true,
140
+ unsafe: true,
141
+ warnings: false,
142
+ screw_ie8: true,
143
+ sequences: true,
144
+ dead_code: true,
145
+ drop_debugger: true,
146
+ comparisons: true,
147
+ conditionals: true,
148
+ evaluate: true,
149
+ booleans: true,
150
+ loops: true,
151
+ unused: true,
152
+ hoist_funs: true,
153
+ if_return: true,
154
+ join_vars: true,
155
+ cascade: true,
156
+ drop_console: true
157
+ }
158
+ })
159
+ ] : []),
160
+
161
+ stats: { colors: true },
162
+
163
+ node: {
164
+ global: true,
165
+ process: false,
166
+ Buffer: false,
167
+ __filename: false,
168
+ __dirname: false,
169
+ setImmediate: false
170
+ },
171
+
172
+ devtool: ENV==='production' ? 'source-map' : 'cheap-module-eval-source-map',
173
+
174
+ devServer: {
175
+ inline: true,
176
+ port: 1337,
177
+ host: 'lnmp.dev',
178
+ publicPath: '/',
179
+ contentBase: './src',
180
+ historyApiFallback: true,
181
+ open: true,
182
+ openPage: ''
183
+ }
184
+ };
assets/js/notices.js CHANGED
@@ -1,21 +1,21 @@
1
- jQuery( function ( $ ) {
2
-
3
- $( '.dlm-notice.is-dismissible' ).on( 'click', '.notice-dismiss', function ( event ) {
4
- //$( '#dlm-ajax-nonce' ).val()
5
- var notice_el = $( this ).closest( '.dlm-notice' );
6
-
7
- var notice = notice_el.attr( 'id' );
8
- var notice_nonce = notice_el.attr( 'data-nonce' );
9
- $.post(
10
- ajaxurl,
11
- {
12
- action: 'dlm_dismiss_notice',
13
- nonce: notice_nonce,
14
- notice: notice
15
- },
16
- function ( response ) {
17
- }
18
- )
19
- } );
20
-
21
  } );
1
+ jQuery( function ( $ ) {
2
+
3
+ $( '.dlm-notice.is-dismissible' ).on( 'click', '.notice-dismiss', function ( event ) {
4
+ //$( '#dlm-ajax-nonce' ).val()
5
+ var notice_el = $( this ).closest( '.dlm-notice' );
6
+
7
+ var notice = notice_el.attr( 'id' );
8
+ var notice_nonce = notice_el.attr( 'data-nonce' );
9
+ $.post(
10
+ ajaxurl,
11
+ {
12
+ action: 'dlm_dismiss_notice',
13
+ nonce: notice_nonce,
14
+ notice: notice
15
+ },
16
+ function ( response ) {
17
+ }
18
+ )
19
+ } );
20
+
21
  } );
assets/js/onboarding.js CHANGED
@@ -1,70 +1,70 @@
1
- jQuery( function ( $ ) {
2
-
3
- $.each( $( '.dlm-create-page' ), function ( k, v ) {
4
- new DLM_Onboarding_CP( v );
5
- } );
6
-
7
- /*
8
- $('.dlm-create-page').click(function() {
9
-
10
- var page = $(this).data('page');
11
-
12
- $(this).html(dlm_onboarding.lbl_creating);
13
-
14
- // set loading
15
-
16
- // do ajax request
17
-
18
- // check response
19
-
20
- // if success, change button to green with checkmark
21
-
22
- });
23
- */
24
- } );
25
-
26
- var DLM_Onboarding_CP = function ( el ) {
27
- this.el = el;
28
- this.page = jQuery( el ).data( 'page' );
29
- this.allowAction = true;
30
- this.setup();
31
- };
32
-
33
- DLM_Onboarding_CP.prototype.setup = function () {
34
- var instance = this;
35
- jQuery( this.el ).click( function () {
36
- instance.process();
37
- } );
38
- };
39
-
40
- DLM_Onboarding_CP.prototype.process = function () {
41
- if ( !this.allowAction ) {
42
- return false;
43
- }
44
-
45
- this.allowAction = false;
46
-
47
- var instance = this;
48
-
49
- jQuery( instance.el ).html( dlm_onboarding.lbl_creating );
50
-
51
- jQuery.get( dlm_onboarding.ajax_url_create_page, {
52
- page: this.page
53
- }, function ( response ) {
54
- if ( response.result === 'success' ) {
55
- jQuery( instance.el ).html( dlm_onboarding.lbl_created );
56
- jQuery( instance.el ).removeClass( 'dlm-create-page' ).addClass( 'dlm-page-exists' );
57
- } else {
58
- jQuery( instance.el ).html( dlm_onboarding.lbl_create_page );
59
-
60
- if ( typeof response.error !== 'undefined' ) {
61
- alert( response.error );
62
- }
63
-
64
- instance.allowAction = true;
65
- }
66
-
67
- console.log( response );
68
- } );
69
-
70
  };
1
+ jQuery( function ( $ ) {
2
+
3
+ $.each( $( '.dlm-create-page' ), function ( k, v ) {
4
+ new DLM_Onboarding_CP( v );
5
+ } );
6
+
7
+ /*
8
+ $('.dlm-create-page').click(function() {
9
+
10
+ var page = $(this).data('page');
11
+
12
+ $(this).html(dlm_onboarding.lbl_creating);
13
+
14
+ // set loading
15
+
16
+ // do ajax request
17
+
18
+ // check response
19
+
20
+ // if success, change button to green with checkmark
21
+
22
+ });
23
+ */
24
+ } );
25
+
26
+ var DLM_Onboarding_CP = function ( el ) {
27
+ this.el = el;
28
+ this.page = jQuery( el ).data( 'page' );
29
+ this.allowAction = true;
30
+ this.setup();
31
+ };
32
+
33
+ DLM_Onboarding_CP.prototype.setup = function () {
34
+ var instance = this;
35
+ jQuery( this.el ).click( function () {
36
+ instance.process();
37
+ } );
38
+ };
39
+
40
+ DLM_Onboarding_CP.prototype.process = function () {
41
+ if ( !this.allowAction ) {
42
+ return false;
43
+ }
44
+
45
+ this.allowAction = false;
46
+
47
+ var instance = this;
48
+
49
+ jQuery( instance.el ).html( dlm_onboarding.lbl_creating );
50
+
51
+ jQuery.get( dlm_onboarding.ajax_url_create_page, {
52
+ page: this.page
53
+ }, function ( response ) {
54
+ if ( response.result === 'success' ) {
55
+ jQuery( instance.el ).html( dlm_onboarding.lbl_created );
56
+ jQuery( instance.el ).removeClass( 'dlm-create-page' ).addClass( 'dlm-page-exists' );
57
+ } else {
58
+ jQuery( instance.el ).html( dlm_onboarding.lbl_create_page );
59
+
60
+ if ( typeof response.error !== 'undefined' ) {
61
+ alert( response.error );
62
+ }
63
+
64
+ instance.allowAction = true;
65
+ }
66
+
67
+ console.log( response );
68
+ } );
69
+
70
  };
assets/js/select2/select2.min.css CHANGED
@@ -1 +1 @@
1
- .select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
1
+ .select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
assets/js/shop/admin-order-details.js CHANGED
@@ -1,46 +1,46 @@
1
- jQuery( function ( $ ) {
2
-
3
- function handleChangeOrderAction() {
4
- var button = $("#dlm-order-details-button-change-state");
5
- var ogLbl = button.html();
6
- var isWorking = false;
7
- var successBlock = null;
8
-
9
- button.click(function(){
10
- if(isWorking) {
11
- return;
12
- }
13
- isWorking = true;
14
- button.html('...');
15
-
16
- var new_status = $("#dlm-order-details-current-state").val();
17
-
18
- $.post( dlm_strings.ajax_url_change_order_status, {
19
- status: new_status,
20
- order_id: dlm_strings.order_id
21
- }, function ( response ) {
22
- if ( response.success === true ) {
23
- button.html(ogLbl);
24
- isWorking = false;
25
- if(successBlock === null) {
26
- successBlock = $("<span>").addClass("dlm-order-details-update-successful").html("✓");
27
- button.parent().append(successBlock);
28
- setTimeout(
29
- function() {
30
- successBlock.fadeOut(300, function(){
31
- successBlock.remove();
32
- successBlock = null;
33
- });
34
- }, 300
35
- );
36
- }
37
-
38
- }
39
- } );
40
-
41
- });
42
- }
43
-
44
- handleChangeOrderAction();
45
-
46
  } );
1
+ jQuery( function ( $ ) {
2
+
3
+ function handleChangeOrderAction() {
4
+ var button = $("#dlm-order-details-button-change-state");
5
+ var ogLbl = button.html();
6
+ var isWorking = false;
7
+ var successBlock = null;
8
+
9
+ button.click(function(){
10
+ if(isWorking) {
11
+ return;
12
+ }
13
+ isWorking = true;
14
+ button.html('...');
15
+
16
+ var new_status = $("#dlm-order-details-current-state").val();
17
+
18
+ $.post( dlm_strings.ajax_url_change_order_status, {
19
+ status: new_status,
20
+ order_id: dlm_strings.order_id
21
+ }, function ( response ) {
22
+ if ( response.success === true ) {
23
+ button.html(ogLbl);
24
+ isWorking = false;
25
+ if(successBlock === null) {
26
+ successBlock = $("<span>").addClass("dlm-order-details-update-successful").html("✓");
27
+ button.parent().append(successBlock);
28
+ setTimeout(
29
+ function() {
30
+ successBlock.fadeOut(300, function(){
31
+ successBlock.remove();
32
+ successBlock = null;
33
+ });
34
+ }, 300
35
+ );
36
+ }
37
+
38
+ }
39
+ } );
40
+
41
+ });
42
+ }
43
+
44
+ handleChangeOrderAction();
45
+
46
  } );
assets/js/shop/checkout.js CHANGED
@@ -1,127 +1,127 @@
1
- jQuery( function ( $ ) {
2
-
3
- $( '#dlm-form-checkout' ).submit( function ( e ) {
4
-
5
- var form = $( this );
6
-
7
- dlmShopResetErrorFields( form );
8
- dlmShopRemoveErrors( form );
9
-
10
- dlmShopShowLoading( form );
11
-
12
- var customer = {
13
- first_name: form.find( '#dlm_first_name' ).val(),
14
- last_name: form.find( '#dlm_last_name' ).val(),
15
- company: form.find( '#dlm_company' ).val(),
16
- email: form.find( '#dlm_email' ).val(),
17
- address_1: form.find( '#dlm_address_1' ).val(),
18
- postcode: form.find( '#dlm_postcode' ).val(),
19
- city: form.find( '#dlm_city' ).val(),
20
- country: form.find( '#dlm_country' ).val(),
21
- };
22
-
23
- var data = {
24
- payment_gateway: $( 'input[name=dlm_gateway]:checked', $( this ) ).val(),
25
- customer: customer
26
- };
27
-
28
- if ( typeof form.data( 'order_id' ) !== "undefined" ) {
29
- data.order_id = form.data( 'order_id' );
30
- }
31
-
32
- if ( typeof form.data( 'order_hash' ) !== "undefined" ) {
33
- data.order_hash = form.data( 'order_hash' );
34
- }
35
-
36
- // check if required data is set
37
- var errorFields = [];
38
- var success = true;
39
- for ( var i = 0; i < dlm_strings.required_fields.length; i ++ ) {
40
-
41
- if ( customer[dlm_strings.required_fields[i]] === "" ) {
42
- success = false;
43
- errorFields.push( dlm_strings.required_fields[i] );
44
- }
45
- }
46
-
47
- if ( success === false ) {
48
- dlmShopMarkErrorFields( form, errorFields );
49
-
50
- dlmShopDisplayError( form, dlm_strings.error_message_required_fields );
51
-
52
- dlmShopHideLoading( form );
53
- return false;
54
- }
55
-
56
- $.post( dlm_strings.ajax_url_place_order, data, function ( response ) {
57
- if ( response.success === true && typeof response.redirect !== 'undefined' ) {
58
- window.location.replace( response.redirect );
59
- return false;
60
- } else if ( response.success === false && response.error !== '' ) {
61
- dlmShopDisplayError( form, response.error );
62
- }
63
- dlmShopHideLoading( form );
64
- } );
65
-
66
- return false;
67
- } );
68
-
69
- function dlmShopMarkErrorFields( form, fields ) {
70
- for ( var i = 0; i < fields.length; i ++ ) {
71
- $( form ).find( '#dlm_' + fields[i] ).addClass( 'dlm-checkout-field-error' );
72
- }
73
- }
74
-
75
- function dlmShopResetErrorFields( form ) {
76
- $( form ).find( '.dlm-checkout-field-error' ).removeClass( 'dlm-checkout-field-error' );
77
- }
78
-
79
- function dlmShopDisplayError( form, errorMessage ) {
80
- var errorContainer = $( '<div>' ).addClass( "dlm-checkout-error" );
81
- errorContainer.append( $( '<img>' ).attr( 'src', dlm_strings.icon_error ).attr( 'alt', 'Checkout error' ).addClass( 'dlm-checkout-error-icon' ) );
82
- errorContainer.append( $( '<p>' ).html( errorMessage ) );
83
- form.prepend( errorContainer );
84
- }
85
-
86
- function dlmShopRemoveErrors( form ) {
87
- form.find( '.dlm-checkout-error' ).remove();
88
- }
89
-
90
- function dlmShopShowLoading( form ) {
91
- $( form ).find( '#dlm_checkout_submit' ).attr( 'disabled', true );
92
-
93
- var overlayBg = $( '<div>' ).addClass( 'dlm-checkout-overlay-bg' );
94
-
95
- var overlay = $( '<div>' ).addClass( 'dlm-checkout-overlay' );
96
- overlay.append( $( '<h2>' ).html( dlm_strings.overlay_title ) );
97
- overlay.append( $( '<span>' ).html( dlm_strings.overlay_body ) );
98
- overlay.append( $( '<img>' ).attr( 'src', dlm_strings.overlay_img_src ) );
99
-
100
- $( 'body' ).append( overlayBg );
101
- $( 'body' ).append( overlay );
102
-
103
- overlayBg.fadeIn( 300, function () {
104
- overlay.css( 'display', 'block' ).css( 'top', '47%' );
105
- overlay.animate( {
106
- "top": "+=3%"
107
- }, 300 );
108
- } );
109
- }
110
-
111
- function dlmShopHideLoading( form ) {
112
-
113
- var overlay = $( '.dlm-checkout-overlay:first' );
114
- var overlayBg = $( '.dlm-checkout-overlay-bg:first' );
115
-
116
- overlay.fadeOut( 300, function () {
117
- overlay.remove();
118
- } );
119
-
120
- overlayBg.fadeOut( 300, function () {
121
- overlayBg.remove();
122
- $( form ).find( '#dlm_checkout_submit' ).attr( 'disabled', false );
123
- } );
124
- }
125
- } );
126
-
127
-
1
+ jQuery( function ( $ ) {
2
+
3
+ $( '#dlm-form-checkout' ).submit( function ( e ) {
4
+
5
+ var form = $( this );
6
+
7
+ dlmShopResetErrorFields( form );
8
+ dlmShopRemoveErrors( form );
9
+
10
+ dlmShopShowLoading( form );
11
+
12
+ var customer = {
13
+ first_name: form.find( '#dlm_first_name' ).val(),
14
+ last_name: form.find( '#dlm_last_name' ).val(),
15
+ company: form.find( '#dlm_company' ).val(),
16
+ email: form.find( '#dlm_email' ).val(),
17
+ address_1: form.find( '#dlm_address_1' ).val(),
18
+ postcode: form.find( '#dlm_postcode' ).val(),
19
+ city: form.find( '#dlm_city' ).val(),
20
+ country: form.find( '#dlm_country' ).val(),
21
+ };
22
+
23
+ var data = {
24
+ payment_gateway: $( 'input[name=dlm_gateway]:checked', $( this ) ).val(),
25
+ customer: customer
26
+ };
27
+
28
+ if ( typeof form.data( 'order_id' ) !== "undefined" ) {
29
+ data.order_id = form.data( 'order_id' );
30
+ }
31
+
32
+ if ( typeof form.data( 'order_hash' ) !== "undefined" ) {
33
+ data.order_hash = form.data( 'order_hash' );
34
+ }
35
+
36
+ // check if required data is set
37
+ var errorFields = [];
38
+ var success = true;
39
+ for ( var i = 0; i < dlm_strings.required_fields.length; i ++ ) {
40
+
41
+ if ( customer[dlm_strings.required_fields[i]] === "" ) {
42
+ success = false;
43
+ errorFields.push( dlm_strings.required_fields[i] );
44
+ }
45
+ }
46
+
47
+ if ( success === false ) {
48
+ dlmShopMarkErrorFields( form, errorFields );
49
+
50
+ dlmShopDisplayError( form, dlm_strings.error_message_required_fields );
51
+
52
+ dlmShopHideLoading( form );
53
+ return false;
54
+ }
55
+
56
+ $.post( dlm_strings.ajax_url_place_order, data, function ( response ) {
57
+ if ( response.success === true && typeof response.redirect !== 'undefined' ) {
58
+ window.location.replace( response.redirect );
59
+ return false;
60
+ } else if ( response.success === false && response.error !== '' ) {
61
+ dlmShopDisplayError( form, response.error );
62
+ }
63
+ dlmShopHideLoading( form );
64
+ } );
65
+
66
+ return false;
67
+ } );
68
+
69
+ function dlmShopMarkErrorFields( form, fields ) {
70
+ for ( var i = 0; i < fields.length; i ++ ) {
71
+ $( form ).find( '#dlm_' + fields[i] ).addClass( 'dlm-checkout-field-error' );
72
+ }
73
+ }
74
+
75
+ function dlmShopResetErrorFields( form ) {
76
+ $( form ).find( '.dlm-checkout-field-error' ).removeClass( 'dlm-checkout-field-error' );
77
+ }
78
+
79
+ function dlmShopDisplayError( form, errorMessage ) {
80
+ var errorContainer = $( '<div>' ).addClass( "dlm-checkout-error" );
81
+ errorContainer.append( $( '<img>' ).attr( 'src', dlm_strings.icon_error ).attr( 'alt', 'Checkout error' ).addClass( 'dlm-checkout-error-icon' ) );
82
+ errorContainer.append( $( '<p>' ).html( errorMessage ) );
83
+ form.prepend( errorContainer );
84
+ }
85
+
86
+ function dlmShopRemoveErrors( form ) {
87
+ form.find( '.dlm-checkout-error' ).remove();
88
+ }
89
+
90
+ function dlmShopShowLoading( form ) {
91
+ $( form ).find( '#dlm_checkout_submit' ).attr( 'disabled', true );
92
+
93
+ var overlayBg = $( '<div>' ).addClass( 'dlm-checkout-overlay-bg' );
94
+
95
+ var overlay = $( '<div>' ).addClass( 'dlm-checkout-overlay' );
96
+ overlay.append( $( '<h2>' ).html( dlm_strings.overlay_title ) );
97
+ overlay.append( $( '<span>' ).html( dlm_strings.overlay_body ) );
98
+ overlay.append( $( '<img>' ).attr( 'src', dlm_strings.overlay_img_src ) );
99
+
100
+ $( 'body' ).append( overlayBg );
101
+ $( 'body' ).append( overlay );
102
+
103
+ overlayBg.fadeIn( 300, function () {
104
+ overlay.css( 'display', 'block' ).css( 'top', '47%' );
105
+ overlay.animate( {
106
+ "top": "+=3%"
107
+ }, 300 );
108
+ } );
109
+ }
110
+
111
+ function dlmShopHideLoading( form ) {
112
+
113
+ var overlay = $( '.dlm-checkout-overlay:first' );
114
+ var overlayBg = $( '.dlm-checkout-overlay-bg:first' );
115
+
116
+ overlay.fadeOut( 300, function () {
117
+ overlay.remove();
118
+ } );
119
+
120
+ overlayBg.fadeOut( 300, function () {
121
+ overlayBg.remove();
122
+ $( form ).find( '#dlm_checkout_submit' ).attr( 'disabled', false );
123
+ } );
124
+ }
125
+ } );
126
+
127
+
assets/views/notice-lu-upgrade.php CHANGED
@@ -1,12 +1,12 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
- } // Exit if accessed directly
5
- ?>
6
- <div class="dlm-lu-upgrade-notice">
7
- <h3><?php echo esc_html__('It looks like you upgraded to the latest version of Download Monitor from a legacy version (3.x)', 'download-monitor' ); ?></h3>
8
- <p><?php printf( esc_html__( "Currently your downloads don't work like they should, we need to %s before they'll work again.", 'download-monitor' ), sprintf( '<strong>%s</strong>', esc_html__( 'upgrade your downloads', 'download-monitor' ) ) ); ?></p>
9
- <p><?php printf( esc_html__( "We've created an upgrading tool that will do all the work for you. You can read more about this tool on %sour website (click here)%s or start the upgrade now.", 'download-monitor'), '<a href="https://www.download-monitor.com/kb/legacy-upgrade?utm_source=plugin&utm_medium=dlm-lu-upgrade-notice&utm_campaign=dlm-lu-more-information" target="_blank">', '</a>' ); ?></p>
10
- <a href="<?php echo esc_url( admin_url( 'options.php?page=dlm_legacy_upgrade' ) ); ?>" class="button"><?php echo esc_html__( 'Take me to the Upgrade Tool', 'download-monitor' ); ?></a>
11
- <a href="<?php echo esc_url( admin_url( 'edit.php?post_type=dlm_download&dlm_lu_hide_notice=1' ) ); ?>" class="dlm-lu-upgrade-notice-hide"><?php echo esc_html__( 'hide notice', 'download-monitor' ); ?></a>
12
- </div>
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ } // Exit if accessed directly
5
+ ?>
6
+ <div class="dlm-lu-upgrade-notice">
7
+ <h3><?php echo esc_html__('It looks like you upgraded to the latest version of Download Monitor from a legacy version (3.x)', 'download-monitor' ); ?></h3>
8
+ <p><?php printf( esc_html__( "Currently your downloads don't work like they should, we need to %s before they'll work again.", 'download-monitor' ), sprintf( '<strong>%s</strong>', esc_html__( 'upgrade your downloads', 'download-monitor' ) ) ); ?></p>
9
+ <p><?php printf( esc_html__( "We've created an upgrading tool that will do all the work for you. You can read more about this tool on %sour website (click here)%s or start the upgrade now.", 'download-monitor'), '<a href="https://www.download-monitor.com/kb/legacy-upgrade?utm_source=plugin&utm_medium=dlm-lu-upgrade-notice&utm_campaign=dlm-lu-more-information" target="_blank">', '</a>' ); ?></p>
10
+ <a href="<?php echo esc_url( admin_url( 'options.php?page=dlm_legacy_upgrade' ) ); ?>" class="button"><?php echo esc_html__( 'Take me to the Upgrade Tool', 'download-monitor' ); ?></a>
11
+ <a href="<?php echo esc_url( admin_url( 'edit.php?post_type=dlm_download&dlm_lu_hide_notice=1' ) ); ?>" class="dlm-lu-upgrade-notice-hide"><?php echo esc_html__( 'hide notice', 'download-monitor' ); ?></a>
12
+ </div>
changelog.txt CHANGED
@@ -1,3 +1,8 @@
 
 
 
 
 
1
  = 4.5.93 - 25.05.2022 =
2
  Fixed: Robots.txt check on all pages ( https://github.com/WPChill/download-monitor/issues/937 )
3
  Added: "No file provided" notification in download admin listing for "empty" downloads ( https://github.com/WPChill/download-monitor/issues/887 )
1
+ = 4.5.94 - 31.05.2022 =
2
+ Changed: Remove Duplicator Upsells ( https://github.com/WPChill/download-monitor/issues/959 )
3
+ Fixed: Download url not working while permalinks are set to plain ( https://github.com/WPChill/download-monitor/issues/964 )
4
+ Fixed: User IPs now showing in logs/download notification emails ( https://github.com/WPChill/download-monitor/issues/965 )
5
+
6
  = 4.5.93 - 25.05.2022 =
7
  Fixed: Robots.txt check on all pages ( https://github.com/WPChill/download-monitor/issues/937 )
8
  Added: "No file provided" notification in download admin listing for "empty" downloads ( https://github.com/WPChill/download-monitor/issues/887 )
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 and selling downloadable files, monitoring downloads and outputting download links and file information on your WordPress powered site.
6
- Version: 4.5.93
7
  Author: WPChill
8
  Author URI: https://wpchill.com
9
  Requires at least: 5.4
@@ -33,7 +33,7 @@ if ( ! defined( 'ABSPATH' ) ) {
33
  } // Exit if accessed directly
34
 
35
  // Define DLM Version
36
- define( 'DLM_VERSION', '4.5.93' );
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 and selling downloadable files, monitoring downloads and outputting download links and file information on your WordPress powered site.
6
+ Version: 4.5.94
7
  Author: WPChill
8
  Author URI: https://wpchill.com
9
  Requires at least: 5.4
33
  } // Exit if accessed directly
34
 
35
  // Define DLM Version
36
+ define( 'DLM_VERSION', '4.5.94' );
37
 
38
  // Define DLM FILE
39
  define( 'DLM_PLUGIN_FILE', __FILE__ );
includes/admin/class-dlm-upsells.php CHANGED
@@ -361,16 +361,6 @@ class DLM_Upsells {
361
  */
362
  public function general_tab_upsell() {
363
 
364
- if ( ! $this->check_extension( 'dlm-download-duplicator' ) ) {
365
-
366
- $this->generate_upsell_box(
367
- __( 'Duplicate your downloads', 'download-monitor' ),
368
- __( 'You’re one click away from duplicating downloads, including their data, versions, and files.', 'download-monitor' ),
369
- 'general',
370
- 'download-duplicator'
371
- );
372
- }
373
-
374
  if ( ! $this->check_extension( 'dlm-email-notification' ) ) {
375
 
376
  $this->generate_upsell_box(
361
  */
362
  public function general_tab_upsell() {
363
 
 
 
 
 
 
 
 
 
 
 
364
  if ( ! $this->check_extension( 'dlm-email-notification' ) ) {
365
 
366
  $this->generate_upsell_box(
includes/deprecated.php CHANGED
@@ -1,37 +1,37 @@
1
- <?php
2
- /**
3
- * Deprecated code, avoid using anything that's in this file
4
- */
5
-
6
- /**
7
- * dlm_create_log function.
8
- *
9
- * @access public
10
- *
11
- * @deprecated 1.6.0
12
- *
13
- * @param string $type
14
- * @param string $status
15
- * @param string $message
16
- * @param mixed $download
17
- * @param mixed $version
18
- *
19
- * @return void
20
- */
21
- function dlm_create_log( $type, $status, $message, $download, $version ) {
22
-
23
- // Deprecated notice
24
- _deprecated_function( __FUNCTION__, '1.6.0', 'DLM_Logging->create_log()' );
25
-
26
- // Logging object
27
- $logging = new DLM_Logging();
28
-
29
- // Check if logging is enabled
30
- if( $logging->is_logging_enabled() ) {
31
-
32
- // Create log
33
- $logging->create_log( $type, $status, $message, $download, $version );
34
-
35
- }
36
-
37
- }
1
+ <?php
2
+ /**
3
+ * Deprecated code, avoid using anything that's in this file
4
+ */
5
+
6
+ /**
7
+ * dlm_create_log function.
8
+ *
9
+ * @access public
10
+ *
11
+ * @deprecated 1.6.0
12
+ *
13
+ * @param string $type
14
+ * @param string $status
15
+ * @param string $message
16
+ * @param mixed $download
17
+ * @param mixed $version
18
+ *
19
+ * @return void
20
+ */
21
+ function dlm_create_log( $type, $status, $message, $download, $version ) {
22
+
23
+ // Deprecated notice
24
+ _deprecated_function( __FUNCTION__, '1.6.0', 'DLM_Logging->create_log()' );
25
+
26
+ // Logging object
27
+ $logging = new DLM_Logging();
28
+
29
+ // Check if logging is enabled
30
+ if( $logging->is_logging_enabled() ) {
31
+
32
+ // Create log
33
+ $logging->create_log( $type, $status, $message, $download, $version );
34
+
35
+ }
36
+
37
+ }
includes/download-functions.php CHANGED
@@ -1,15 +1,15 @@
1
- <?php
2
-
3
- /**
4
- * Gets the name of the default template
5
- * @return string
6
- */
7
- function dlm_get_default_download_template() {
8
- $default = get_option( 'dlm_default_template' );
9
-
10
- if ( $default == 'custom' ) {
11
- $default = get_option( 'dlm_custom_template' );
12
- }
13
-
14
- return $default;
15
- }
1
+ <?php
2
+
3
+ /**
4
+ * Gets the name of the default template
5
+ * @return string
6
+ */
7
+ function dlm_get_default_download_template() {
8
+ $default = get_option( 'dlm_default_template' );
9
+
10
+ if ( $default == 'custom' ) {
11
+ $default = get_option( 'dlm_custom_template' );
12
+ }
13
+
14
+ return $default;
15
+ }
includes/php-too-low.php CHANGED
@@ -1,43 +1,43 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
- } // Exit if accessed directly
5
-
6
- function dlm_admin_notice_php_version() {
7
-
8
- $version_parts = explode( '.', phpversion() );
9
- $user_version_nice = '';
10
- if ( ! empty( $version_parts[0] ) ) {
11
- $user_version_nice .= $version_parts[0];
12
- }
13
- if ( ! empty( $version_parts[1] ) ) {
14
- $user_version_nice .= '.' . $version_parts[1];
15
- }
16
-
17
- ?>
18
- <div class="notice notice-error is-dismissible">
19
- <h3><?php echo esc_html__( 'PHP Version too low!', 'download-monitor' ); ?></h3>
20
- <p>
21
- <?php
22
- printf(
23
- esc_html_e( "Download Monitor can't be loaded because it needs at least %1\$s but the server that is hosting your WordPress website is running %2\$s", 'download-monitor' ),
24
- '<strong>' . sprintf( esc_html_e( 'PHP Version %s', 'download-monitor' ), '5.3' ) . '</strong>',
25
- '<strong>' . sprintf( esc_html_e( 'PHP Version %s', 'download-monitor' ), esc_html( $user_version_nice ) ) . '</strong>'
26
- );
27
- ?>
28
- </p>
29
- <p>
30
- <?php
31
- printf(
32
- esc_html_e( "You can learn more about why it's important that you update and get tips on how to update by %s", 'download-monitor' ),
33
- '<a href="https://www.download-monitor.com/kb/minimum-required-php-version/" target="_blank">' . esc_html_e( 'clicking this link', 'download-monitor' ) . '</a>'
34
- );
35
- ?>
36
- </p>
37
- <p><?php echo esc_html__( "After you've upgraded your PHP version, Download Monitor will automatically load and work.", 'download-monitor' ); ?></p>
38
- <p></p>
39
- </div>
40
- <?php
41
- }
42
-
43
- add_action( 'admin_notices', 'dlm_admin_notice_php_version' );
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ } // Exit if accessed directly
5
+
6
+ function dlm_admin_notice_php_version() {
7
+
8
+ $version_parts = explode( '.', phpversion() );
9
+ $user_version_nice = '';
10
+ if ( ! empty( $version_parts[0] ) ) {
11
+ $user_version_nice .= $version_parts[0];
12
+ }
13
+ if ( ! empty( $version_parts[1] ) ) {
14
+ $user_version_nice .= '.' . $version_parts[1];
15
+ }
16
+
17
+ ?>
18
+ <div class="notice notice-error is-dismissible">
19
+ <h3><?php echo esc_html__( 'PHP Version too low!', 'download-monitor' ); ?></h3>
20
+ <p>
21
+ <?php
22
+ printf(
23
+ esc_html_e( "Download Monitor can't be loaded because it needs at least %1\$s but the server that is hosting your WordPress website is running %2\$s", 'download-monitor' ),
24
+ '<strong>' . sprintf( esc_html_e( 'PHP Version %s', 'download-monitor' ), '5.3' ) . '</strong>',
25
+ '<strong>' . sprintf( esc_html_e( 'PHP Version %s', 'download-monitor' ), esc_html( $user_version_nice ) ) . '</strong>'
26
+ );
27
+ ?>
28
+ </p>
29
+ <p>
30
+ <?php
31
+ printf(
32
+ esc_html_e( "You can learn more about why it's important that you update and get tips on how to update by %s", 'download-monitor' ),
33
+ '<a href="https://www.download-monitor.com/kb/minimum-required-php-version/" target="_blank">' . esc_html_e( 'clicking this link', 'download-monitor' ) . '</a>'
34
+ );
35
+ ?>
36
+ </p>
37
+ <p><?php echo esc_html__( "After you've upgraded your PHP version, Download Monitor will automatically load and work.", 'download-monitor' ); ?></p>
38
+ <p></p>
39
+ </div>
40
+ <?php
41
+ }
42
+
43
+ add_action( 'admin_notices', 'dlm_admin_notice_php_version' );
includes/submodules/banner/assets/css/wpchill-welcome.css CHANGED
@@ -1,365 +1,365 @@
1
- #wpchill-welcome {
2
- padding-top: 80px;
3
- }
4
-
5
- #wpchill-welcome *, #wpchill-welcome *::before, #wpchill-welcome *::after {
6
- -webkit-box-sizing: border-box;
7
- -moz-box-sizing: border-box;
8
- box-sizing: border-box;
9
- }
10
-
11
- #wpchill-welcome .clear:before {
12
- content: " ";
13
- display: table;
14
- }
15
-
16
- #wpchill-welcome .clear:after {
17
- clear: both;
18
- content: " ";
19
- display: table;
20
- }
21
-
22
- #wpchill-welcome .container {
23
- margin: 0 auto;
24
- max-width: 800px;
25
- padding: 0;
26
- }
27
-
28
- #wpchill-welcome .block {
29
- padding: 40px;
30
- }
31
-
32
- #wpchill-welcome img {
33
- max-width: 100%;
34
- height: auto;
35
- }
36
-
37
- #wpchill-welcome h1 {
38
- color: #222;
39
- font-size: 24px;
40
- margin: 0 0 16px 0;
41
- }
42
-
43
- #wpchill-welcome h5 {
44
- color: #222;
45
- font-size: 16px;
46
- margin: 0 0 8px 0;
47
- }
48
-
49
- #wpchill-welcome h6 {
50
- font-size: 16px;
51
- font-weight: 400;
52
- line-height: 1.6;
53
- margin: 0;
54
- }
55
-
56
- #wpchill-welcome .wpmtst-btn-lg {
57
- font-size: 16px;
58
- font-weight: 600;
59
- padding: 16px 28px;
60
- }
61
-
62
- #wpchill-welcome .wpmtst-btn-block {
63
- display: block;
64
- width: 100%;
65
- }
66
-
67
- #wpchill-welcome .wpmtst-btn {
68
- border: 0;
69
- border-radius: 40px;
70
- cursor: pointer;
71
- display: inline-block;
72
- margin: 0;
73
- text-decoration: none;
74
- text-align: center;
75
- vertical-align: middle;
76
- white-space: nowrap;
77
- box-shadow: none;
78
- }
79
-
80
-
81
- #wpchill-welcome .button-wrap {
82
- max-width: 590px;
83
- margin: 0 auto 0 auto;
84
- }
85
-
86
- #wpchill-welcome .button-wrap .left {
87
- margin-bottom: 10px;
88
- }
89
-
90
- #wpchill-welcome .button-wrap-single a {
91
- font-size: 14px;
92
- }
93
-
94
- #wpchill-welcome .button-wrap-single {
95
- padding: 0 20px;
96
- }
97
-
98
- @media screen and (min-width: 720px) {
99
-
100
- #wpchill-welcome .button-wrap .left {
101
- margin-bottom: 0px;
102
- float: left;
103
- width: 50%;
104
- padding-right: 20px;
105
- }
106
-
107
- #wpchill-welcome .button-wrap .right {
108
- float: right;
109
- width: 50%;
110
- padding-left: 20px;
111
- }
112
-
113
- #wpchill-welcome .button-wrap-single a {
114
- font-size: 16px;
115
- }
116
- }
117
-
118
- /* hero section */
119
- #wpchill-welcome .hero {
120
- background-color: #fff;
121
- border-radius: 10px;
122
- margin-bottom: 30px;
123
- position: relative;
124
- box-shadow: -3px 2px 70px 0px rgba(128, 144, 174, 0.1);
125
- padding-top: 40px;
126
- }
127
-
128
- #wpchill-welcome .hero .mascot {
129
- background-color: #fff;
130
- border-radius: 50%;
131
- height: 90px;
132
- width: 90px;
133
- padding: 28px 28px;
134
- position: absolute;
135
- top: -45px;
136
- left: 50%;
137
- margin-left: -45px;
138
- }
139
-
140
- #wpchill-welcome .hero .video-thumbnail {
141
- display: block;
142
- margin: 0;
143
- width: 100%;
144
- }
145
-
146
- #wpchill-welcome .hero .button-wrap {
147
- margin-top: 20px;
148
- }
149
-
150
-
151
- /* features section */
152
- #wpchill-welcome .features {
153
- background-color: #fff;
154
- border-top-left-radius: 10px;
155
- border-top-right-radius: 10px;
156
- position: relative;
157
- padding-top: 20px;
158
- }
159
-
160
- #wpchill-welcome .features .feature-list {
161
- margin-top: 40px;
162
- }
163
-
164
- #wpchill-welcome .features .feature-block {
165
- margin-bottom: 30px;
166
- }
167
-
168
- @media screen and (min-width: 720px) {
169
-
170
- #wpchill-welcome .block-row-2 .feature-block {
171
- margin: 0 auto;
172
- float: left;
173
- width: 50%;
174
- padding-bottom: 32px;
175
- overflow: auto;
176
- }
177
-
178
- #wpchill-welcome .block-row-3 .feature-block {
179
- margin: 0 auto;
180
- float: left;
181
- width: 33%;
182
- padding-bottom: 32px;
183
- overflow: auto;
184
- }
185
-
186
- #wpchill-welcome .block-row-2 .feature-block:nth-child(odd) {
187
- padding-right: 22px;
188
- clear: both;
189
- }
190
-
191
- #wpchill-welcome .block-row-3 .feature-block:not(:nth-child(3n+3)) {
192
- padding-right: 22px;
193
- }
194
-
195
- #wpchill-welcome .block-row-3 .feature-block:nth-child(3n+1) {
196
- clear: both;
197
- }
198
-
199
- #wpchill-welcome .features .feature-block.last {
200
- padding-left: 22px;
201
- }
202
- .block-row-1 > * {
203
- width: 100%;
204
- }
205
- .block-row{
206
- display:flex;
207
- flex-wrap:wrap;
208
- align-items:flex-start;
209
- flex-direction: row;
210
- justify-content: flex-start;
211
- }
212
-
213
- .block-row-2 > * {
214
- width: 50%;
215
- }
216
-
217
- .block-row-3 > * {
218
- width: 33%;
219
- }
220
-
221
- .block-row-4 > * {
222
- width: 25%;
223
- }
224
- }
225
-
226
- #wpchill-welcome .features .feature-block img {
227
- float: left;
228
- max-width: 44px;
229
- max-height: 44px;
230
- }
231
-
232
- #wpchill-welcome .features .feature-block h5 {
233
- margin-left: 70px;
234
- }
235
-
236
- #wpchill-welcome .features .feature-block p {
237
- margin-left: 70px;
238
- }
239
-
240
- #wpchill-welcome .features .pro-label {
241
- display: inline-block;
242
- line-height: 1;
243
- color: #fff;
244
- padding: 3px 6px;
245
- font-size: 0.75rem;
246
- border-radius: 20px;
247
- vertical-align: text-top;
248
- margin-left: 20px;
249
- }
250
-
251
- #wpchill-welcome .features .feature-list a {
252
- color: #5333ED;
253
- }
254
-
255
- /* upgrade section */
256
- #wpchill-welcome .upgrade {
257
- background-color: white;
258
- text-align: center;
259
- }
260
-
261
- #wpchill-welcome .upgrade h1{
262
- color: #fff;
263
- }
264
-
265
- @media screen and (min-width: 720px) {
266
-
267
- #wpchill-welcome .upgrade .left{
268
- float: left;
269
- width: 50%;
270
- padding-left: 20%;
271
- margin-bottom: 30px;
272
- text-align: left;
273
- }
274
-
275
- #wpchill-welcome .upgrade .right{
276
- float: left;
277
- width: 50%;
278
- padding-right: 20%;
279
- margin-bottom: 30px;
280
- text-align: left;
281
- }
282
- #wpchill-welcome .button-wrap-single{
283
- width: 50%;
284
- margin: 0 auto;
285
- }
286
- }
287
-
288
- /* testimonials section */
289
- #wpchill-welcome .testimonials {
290
- background-color: #fafafa;
291
-
292
- position: relative;
293
- box-shadow: -3px 2px 70px 0px rgba(128, 144, 174, 0.1);
294
- }
295
-
296
- #wpchill-welcome .testimonials .testimonial-block {
297
- padding: 0 16px 32px;
298
- overflow: auto;
299
- margin-top: 40px;
300
- text-align: center;
301
- }
302
-
303
- @media screen and (min-width: 720px) {
304
-
305
- #wpchill-welcome .testimonials .testimonial-block {
306
- float: left;
307
- width: 50%;
308
- }
309
-
310
- }
311
-
312
- #wpchill-welcome .testimonials .testimonial-block p {
313
- font-size: 14px;
314
- font-weight: 400;
315
- line-height: 1.6;
316
- }
317
-
318
- #wpchill-welcome .testimonials .testimonial-block img {
319
- max-width: 60px;
320
- max-height: 60px;
321
- border-radius: 50%;
322
- filter: grayscale(100%);
323
- box-shadow: 0 0 12px rgba(0,0,0,0.15);
324
- }
325
-
326
- /* testimonials footer */
327
- #wpchill-welcome .footer {
328
- background-color: #fff;
329
- border-bottom-left-radius: 10px;
330
- border-bottom-right-radius: 10px;
331
- margin-bottom: 30px;
332
- position: relative;
333
- box-shadow: -3px 2px 70px 0px rgba(128, 144, 174, 0.1);
334
- }
335
-
336
- #wpchill-welcome .container {
337
- position: relative;
338
- width: 100%;
339
- height: 0;
340
- padding-bottom: 56.25%;
341
- }
342
-
343
- #wpchill-welcome .video {
344
- position: absolute;
345
- top: 0;
346
- left: 0;
347
- width: 100%;
348
- height: 100%;
349
- }
350
-
351
- #wpchill-welcome .stars_wrapper svg {
352
- height: 20px;
353
- }
354
-
355
- #wpchill-welcome .wpchill_empty_space{
356
- display:block;
357
- clear:both;
358
- }
359
-
360
- .wpchill_horizontal_delimiter {
361
- background-color: #f0f0f1;
362
- height:20px;
363
- width:100%;
364
- margin:0 auto;
365
  }
1
+ #wpchill-welcome {
2
+ padding-top: 80px;
3
+ }
4
+
5
+ #wpchill-welcome *, #wpchill-welcome *::before, #wpchill-welcome *::after {
6
+ -webkit-box-sizing: border-box;
7
+ -moz-box-sizing: border-box;
8
+ box-sizing: border-box;
9
+ }
10
+
11
+ #wpchill-welcome .clear:before {
12
+ content: " ";
13
+ display: table;
14
+ }
15
+
16
+ #wpchill-welcome .clear:after {
17
+ clear: both;
18
+ content: " ";
19
+ display: table;
20
+ }
21
+
22
+ #wpchill-welcome .container {
23
+ margin: 0 auto;
24
+ max-width: 800px;
25
+ padding: 0;
26
+ }
27
+
28
+ #wpchill-welcome .block {
29
+ padding: 40px;
30
+ }
31
+
32
+ #wpchill-welcome img {
33
+ max-width: 100%;
34
+ height: auto;
35
+ }
36
+
37
+ #wpchill-welcome h1 {
38
+ color: #222;
39
+ font-size: 24px;
40
+ margin: 0 0 16px 0;
41
+ }
42
+
43
+ #wpchill-welcome h5 {
44
+ color: #222;
45
+ font-size: 16px;
46
+ margin: 0 0 8px 0;
47
+ }
48
+
49
+ #wpchill-welcome h6 {
50
+ font-size: 16px;
51
+ font-weight: 400;
52
+ line-height: 1.6;
53
+ margin: 0;
54
+ }
55
+
56
+ #wpchill-welcome .wpmtst-btn-lg {
57
+ font-size: 16px;
58
+ font-weight: 600;
59
+ padding: 16px 28px;
60
+ }
61
+
62
+ #wpchill-welcome .wpmtst-btn-block {
63
+ display: block;
64
+ width: 100%;
65
+ }
66
+
67
+ #wpchill-welcome .wpmtst-btn {
68
+ border: 0;
69
+ border-radius: 40px;
70
+ cursor: pointer;
71
+ display: inline-block;
72
+ margin: 0;
73
+ text-decoration: none;
74
+ text-align: center;
75
+ vertical-align: middle;
76
+ white-space: nowrap;
77
+ box-shadow: none;
78
+ }
79
+
80
+
81
+ #wpchill-welcome .button-wrap {
82
+ max-width: 590px;
83
+ margin: 0 auto 0 auto;
84
+ }
85
+
86
+ #wpchill-welcome .button-wrap .left {
87
+ margin-bottom: 10px;
88
+ }
89
+
90
+ #wpchill-welcome .button-wrap-single a {
91
+ font-size: 14px;
92
+ }
93
+
94
+ #wpchill-welcome .button-wrap-single {
95
+ padding: 0 20px;
96
+ }
97
+
98
+ @media screen and (min-width: 720px) {
99
+
100
+ #wpchill-welcome .button-wrap .left {
101
+ margin-bottom: 0px;
102
+ float: left;
103
+ width: 50%;
104
+ padding-right: 20px;
105
+ }
106
+
107
+ #wpchill-welcome .button-wrap .right {
108
+ float: right;
109
+ width: 50%;
110
+ padding-left: 20px;
111
+ }
112
+
113
+ #wpchill-welcome .button-wrap-single a {
114
+ font-size: 16px;
115
+ }
116
+ }
117
+
118
+ /* hero section */
119
+ #wpchill-welcome .hero {
120
+ background-color: #fff;
121
+ border-radius: 10px;
122
+ margin-bottom: 30px;
123
+ position: relative;
124
+ box-shadow: -3px 2px 70px 0px rgba(128, 144, 174, 0.1);
125
+ padding-top: 40px;
126
+ }
127
+
128
+ #wpchill-welcome .hero .mascot {
129
+ background-color: #fff;
130
+ border-radius: 50%;
131
+ height: 90px;
132
+ width: 90px;
133
+ padding: 28px 28px;
134
+ position: absolute;
135
+ top: -45px;
136
+ left: 50%;
137
+ margin-left: -45px;
138
+ }
139
+
140
+ #wpchill-welcome .hero .video-thumbnail {
141
+ display: block;
142
+ margin: 0;
143
+ width: 100%;
144
+ }
145
+
146
+ #wpchill-welcome .hero .button-wrap {
147
+ margin-top: 20px;
148
+ }
149
+
150
+
151
+ /* features section */
152
+ #wpchill-welcome .features {
153
+ background-color: #fff;
154
+ border-top-left-radius: 10px;
155
+ border-top-right-radius: 10px;
156
+ position: relative;
157
+ padding-top: 20px;
158
+ }
159
+
160
+ #wpchill-welcome .features .feature-list {
161
+ margin-top: 40px;
162
+ }
163
+
164
+ #wpchill-welcome .features .feature-block {
165
+ margin-bottom: 30px;
166
+ }
167
+
168
+ @media screen and (min-width: 720px) {
169
+
170
+ #wpchill-welcome .block-row-2 .feature-block {
171
+ margin: 0 auto;
172
+ float: left;
173
+ width: 50%;
174
+ padding-bottom: 32px;
175
+ overflow: auto;
176
+ }
177
+
178
+ #wpchill-welcome .block-row-3 .feature-block {
179
+ margin: 0 auto;
180
+ float: left;
181
+ width: 33%;
182
+ padding-bottom: 32px;
183
+ overflow: auto;
184
+ }
185
+
186
+ #wpchill-welcome .block-row-2 .feature-block:nth-child(odd) {
187
+ padding-right: 22px;
188
+ clear: both;
189
+ }
190
+
191
+ #wpchill-welcome .block-row-3 .feature-block:not(:nth-child(3n+3)) {
192
+ padding-right: 22px;
193
+ }
194
+
195
+ #wpchill-welcome .block-row-3 .feature-block:nth-child(3n+1) {
196
+ clear: both;
197
+ }
198
+
199
+ #wpchill-welcome .features .feature-block.last {
200
+ padding-left: 22px;
201
+ }
202
+ .block-row-1 > * {
203
+ width: 100%;
204
+ }
205
+ .block-row{
206
+ display:flex;
207
+ flex-wrap:wrap;
208
+ align-items:flex-start;
209
+ flex-direction: row;
210
+ justify-content: flex-start;
211
+ }
212
+
213
+ .block-row-2 > * {
214
+ width: 50%;
215
+ }
216
+
217
+ .block-row-3 > * {
218
+ width: 33%;
219
+ }
220
+
221
+ .block-row-4 > * {
222
+ width: 25%;
223
+ }
224
+ }
225
+
226
+ #wpchill-welcome .features .feature-block img {
227
+ float: left;
228
+ max-width: 44px;
229
+ max-height: 44px;
230
+ }
231
+
232
+ #wpchill-welcome .features .feature-block h5 {
233
+ margin-left: 70px;
234
+ }
235
+
236
+ #wpchill-welcome .features .feature-block p {
237
+ margin-left: 70px;
238
+ }
239
+
240
+ #wpchill-welcome .features .pro-label {
241
+ display: inline-block;
242
+ line-height: 1;
243
+ color: #fff;
244
+ padding: 3px 6px;
245
+ font-size: 0.75rem;
246
+ border-radius: 20px;
247
+ vertical-align: text-top;
248
+ margin-left: 20px;
249
+ }
250
+
251
+ #wpchill-welcome .features .feature-list a {
252
+ color: #5333ED;
253
+ }
254
+
255
+ /* upgrade section */
256
+ #wpchill-welcome .upgrade {
257
+ background-color: white;
258
+ text-align: center;
259
+ }
260
+
261
+ #wpchill-welcome .upgrade h1{
262
+ color: #fff;
263
+ }
264
+
265
+ @media screen and (min-width: 720px) {
266
+
267
+ #wpchill-welcome .upgrade .left{
268
+ float: left;
269
+ width: 50%;
270
+ padding-left: 20%;
271
+ margin-bottom: 30px;
272
+ text-align: left;
273
+ }
274
+
275
+ #wpchill-welcome .upgrade .right{
276
+ float: left;
277
+ width: 50%;
278
+ padding-right: 20%;
279
+ margin-bottom: 30px;
280
+ text-align: left;
281
+ }
282
+ #wpchill-welcome .button-wrap-single{
283
+ width: 50%;
284
+ margin: 0 auto;
285
+ }
286
+ }
287
+
288
+ /* testimonials section */
289
+ #wpchill-welcome .testimonials {
290
+ background-color: #fafafa;
291
+
292
+ position: relative;
293
+ box-shadow: -3px 2px 70px 0px rgba(128, 144, 174, 0.1);
294
+ }
295
+
296
+ #wpchill-welcome .testimonials .testimonial-block {
297
+ padding: 0 16px 32px;
298
+ overflow: auto;
299
+ margin-top: 40px;
300
+ text-align: center;
301
+ }
302
+
303
+ @media screen and (min-width: 720px) {
304
+
305
+ #wpchill-welcome .testimonials .testimonial-block {
306
+ float: left;
307
+ width: 50%;
308
+ }
309
+
310
+ }
311
+
312
+ #wpchill-welcome .testimonials .testimonial-block p {
313
+ font-size: 14px;
314
+ font-weight: 400;
315
+ line-height: 1.6;
316
+ }
317
+
318
+ #wpchill-welcome .testimonials .testimonial-block img {
319
+ max-width: 60px;
320
+ max-height: 60px;
321
+ border-radius: 50%;
322
+ filter: grayscale(100%);
323
+ box-shadow: 0 0 12px rgba(0,0,0,0.15);
324
+ }
325
+
326
+ /* testimonials footer */
327
+ #wpchill-welcome .footer {
328
+ background-color: #fff;
329
+ border-bottom-left-radius: 10px;
330
+ border-bottom-right-radius: 10px;
331
+ margin-bottom: 30px;
332
+ position: relative;
333
+ box-shadow: -3px 2px 70px 0px rgba(128, 144, 174, 0.1);
334
+ }
335
+
336
+ #wpchill-welcome .container {
337
+ position: relative;
338
+ width: 100%;
339
+ height: 0;
340
+ padding-bottom: 56.25%;
341
+ }
342
+
343
+ #wpchill-welcome .video {
344
+ position: absolute;
345
+ top: 0;
346
+ left: 0;
347
+ width: 100%;
348
+ height: 100%;
349
+ }
350
+
351
+ #wpchill-welcome .stars_wrapper svg {
352
+ height: 20px;
353
+ }
354
+
355
+ #wpchill-welcome .wpchill_empty_space{
356
+ display:block;
357
+ clear:both;
358
+ }
359
+
360
+ .wpchill_horizontal_delimiter {
361
+ background-color: #f0f0f1;
362
+ height:20px;
363
+ width:100%;
364
+ margin:0 auto;
365
  }
includes/submodules/banner/assets/img/star.svg CHANGED
@@ -1,12 +1,12 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="-274 399.8 53 43.1" style="enable-background:new -274 399.8 53 43.1;" xml:space="preserve">
5
- <style type="text/css">
6
- .st0{fill:#5333ED;}
7
- </style>
8
- <g>
9
- <path class="st0" d="M-234.8,415h-11.5l-3.6-11c-1.4-4.3-3.7-4.3-5.1,0l-3.6,11h-11.5c-4.5,0-5.3,2.2-1.6,4.8l9.3,6.8l-3.6,11
10
- c-1.4,4.3,0.4,5.7,4.1,3l9.3-6.8l9.3,6.8c3.7,2.7,5.5,1.3,4.1-3l-3.6-11l9.3-6.8C-229.6,417.1-230.3,415-234.8,415z"/>
11
- </g>
12
- </svg>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="-274 399.8 53 43.1" style="enable-background:new -274 399.8 53 43.1;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#5333ED;}
7
+ </style>
8
+ <g>
9
+ <path class="st0" d="M-234.8,415h-11.5l-3.6-11c-1.4-4.3-3.7-4.3-5.1,0l-3.6,11h-11.5c-4.5,0-5.3,2.2-1.6,4.8l9.3,6.8l-3.6,11
10
+ c-1.4,4.3,0.4,5.7,4.1,3l9.3-6.8l9.3,6.8c3.7,2.7,5.5,1.3,4.1-3l-3.6-11l9.3-6.8C-229.6,417.1-230.3,415-234.8,415z"/>
11
+ </g>
12
+ </svg>
includes/submodules/banner/class-wpchill-welcome.php CHANGED
@@ -1,260 +1,260 @@
1
- <?php
2
-
3
- if ( ! class_exists( 'WPChill_Welcome' ) ) {
4
-
5
- class WPChill_Welcome {
6
-
7
- /**
8
- * Contains the instance of the Class
9
- *
10
- * @since 1.0.0
11
- * @param WPChill_Welcome $instance
12
- */
13
- private static $instance = null;
14
-
15
- /**
16
- * @since 1.0.0
17
- * @param string $textdomain - wpchill textdomain
18
- */
19
- public $textdomain = 'wpchill';
20
-
21
- private function __construct() {
22
- add_action( 'admin_footer', array( $this, 'welcome_style' ) );
23
- }
24
-
25
- /**
26
- * @since 1.0.0
27
- * Singleton
28
- */
29
- public static function get_instance() {
30
-
31
- if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WPChill_Welcome ) ) {
32
- self::$instance = new WPChill_Welcome();
33
- }
34
-
35
- return self::$instance;
36
- }
37
-
38
- /**
39
- * @since 1.0.0
40
- * Enqueue admin Wellcome style
41
- */
42
- public function welcome_style() {
43
- wp_register_style( 'wpchill-welcome-style', plugins_url( '/assets/css/wpchill-welcome.css', __FILE__ ), null, '1.0.0' );
44
- wp_print_styles( array( 'wpchill-welcome-style' ) );
45
- }
46
-
47
- /**
48
- * @since 1.0.0
49
- * Renders buttons
50
- *
51
- * @param string $text
52
- *
53
- * @param string $url
54
- *
55
- * @param bool $fill
56
- *
57
- * @param string $color
58
- */
59
- public function display_button( $text, $link, $fill = true, $color = '#5D3CE4' ) {
60
- $style = 'style="background-color:' . sanitize_hex_color( $color ) . ';border-color:' . sanitize_hex_color( $color ) . ';color:#fff;"';
61
- echo '<a href="' . esc_attr( $link ) . '" ' . ( $fill ? $style : '' ) . ' class="wpmtst-btn wpmtst-btn-block wpmtst-btn-lg">' . esc_html( $text ) . '</a>';
62
- }
63
-
64
- /**
65
- * @since 1.0.0
66
- * Renders extension html
67
- *
68
- * @param string $title
69
- *
70
- * @param string $description
71
- *
72
- * @param string $icon (icon URL)
73
- *
74
- * @param bool $pro
75
- */
76
- public function display_extension( $title, $description = '', $icon = '', $pro = false, $pro_color = '#5333ED' ) {
77
-
78
- echo '<div class="feature-block">';
79
- if ( '' != $icon ) {
80
- echo '<img src="' . esc_attr( $icon ) . '">';
81
- }
82
- echo '<h5>' . esc_html( $title ) . ( ( $pro ) ? '<div style="background-color:' . esc_attr( $pro_color ) . '" class="pro-label">PRO</div>' : '' ) . '</h5>';
83
- echo '<p>' . esc_html( $description ) . '</p>';
84
- echo '</div>';
85
- }
86
-
87
- /**
88
- * @since 1.0.0
89
- * Displays h1 heading
90
- *
91
- * @param string $text
92
- *
93
- * @param string $position
94
- */
95
- public function display_heading( $text, $position = 'center' ) {
96
- echo '<h1 style="text-align: ' . esc_attr( $position ) . ';" >' . esc_html( $text ) . '</h1>';
97
- }
98
-
99
- /**
100
- * @since 1.0.0
101
- * Displays h6 subheading
102
- *
103
- * @param string $text
104
- *
105
- * @param string $position
106
- */
107
- public function display_subheading( $text, $position = 'center' ) {
108
- echo '<h6 style="text-align: ' . esc_attr( $position ) . '" >' . esc_html( $text ) . '</h6>';
109
- }
110
-
111
-
112
- /**
113
- * @since 1.0.0
114
- * Renders testimonial block
115
- *
116
- * @param string $text
117
- *
118
- * @param string $icon
119
- *
120
- * @param string $name
121
- *
122
- * @param string $job (reviewer's job or company)
123
- */
124
- public function display_testimonial( $text, $icon = '', $name = '', $job = '', $star_color = '' ) {
125
-
126
- echo '<div class="testimonial-block">';
127
- if ( '' != $icon ) {
128
- echo '<img src=" ' . esc_url( $icon ) . ' "/>';
129
- }
130
- echo '<p>' . esc_html( $text ) . '</p>';
131
-
132
- $this->display_stars( $star_color );
133
-
134
- if ( '' !== $name || '' !== $job ) {
135
- echo '<p>';
136
-
137
- if ( '' !== $name ) {
138
- echo '<strong>' . esc_html( $name ) . '</strong><br/>';
139
- }
140
- if ( '' !== $job ) {
141
- echo esc_html( $job );
142
- }
143
- echo '</p>';
144
- }
145
-
146
- echo '</div>';
147
- }
148
-
149
- /**
150
- * @since 1.0.0
151
- * Renders a UL list
152
- *
153
- * @param array $items - array of list items
154
- */
155
- public function display_listing( $items ) {
156
- echo '<ul>';
157
-
158
- foreach ( $items as $item ) {
159
- echo '<li>' . esc_html( $item ) . '</li>';
160
- }
161
-
162
- echo '</ul>';
163
- }
164
-
165
-
166
- /**
167
- * @since 1.0.0
168
- * Renders a UL list
169
- *
170
- * @param string $url - youtube.com url
171
- */
172
- public function display_video( $url ) {
173
- parse_str( wp_parse_url( esc_url( $url ), PHP_URL_QUERY ), $video_vars );
174
- echo '<div class="container"><iframe src="https://www.youtube.com/embed/' . esc_attr( $video_vars['v'] ) . '" frameborder="0" allowfullscreen class="video"></iframe></div>';
175
- }
176
-
177
- /**
178
- * @since 1.0.0
179
- * Renders rating stars block
180
- *
181
- * @param string $color - code of the star color fill
182
- */
183
- public function display_stars( $color ) {
184
- $color = ( '' === $color ) ? '#FFD700' : sanitize_hex_color( $color );
185
- $id = wp_rand( 0, 9999999 );
186
- $star = '<svg version="1.1" class="svg-' . absint( $id ) . '" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-274 399.8 53 43.1" style="enable-background:new -274 399.8 53 43.1;" xml:space="preserve">
187
- <g>
188
- <path class="st0" d="M-234.8,415h-11.5l-3.6-11c-1.4-4.3-3.7-4.3-5.1,0l-3.6,11h-11.5c-4.5,0-5.3,2.2-1.6,4.8l9.3,6.8l-3.6,11
189
- c-1.4,4.3,0.4,5.7,4.1,3l9.3-6.8l9.3,6.8c3.7,2.7,5.5,1.3,4.1-3l-3.6-11l9.3-6.8C-229.6,417.1-230.3,415-234.8,415z"/>
190
- </g>
191
- </svg>';
192
-
193
- $svg_args = array(
194
- 'svg' => array(
195
- 'class' => true,
196
- 'aria-hidden' => true,
197
- 'aria-labelledby' => true,
198
- 'role' => true,
199
- 'xmlns' => true,
200
- 'width' => true,
201
- 'height' => true,
202
- 'viewbox' => true, // <= Must be lower case!
203
- 'id' => true,
204
- ),
205
- 'g' => array( 'fill' => true ),
206
- 'title' => array( 'title' => true ),
207
- 'path' => array(
208
- 'd' => true,
209
- 'fill' => true,
210
- ),
211
- 'style' => array( 'type' => true ),
212
- );
213
-
214
- echo '<style>';
215
- echo '.svg-' . absint( $id ) . '{ fill:' . sanitize_hex_color( $color ) . ';}';
216
- echo '</style>';
217
- echo '<div class="stars_wrapper">' . wp_kses( $star . $star . $star . $star . $star, $svg_args ) . '</div>';
218
- }
219
-
220
- /**
221
- * @since 1.0.0
222
- * Columns wrapper start
223
- *
224
- * @param int $cols - # of columns the contained objects should be displayed as. (1/2/3)
225
- */
226
- public function layout_start( $cols = 2, $class = '' ) {
227
- echo '<div class="' . esc_attr( $class ) . ' block-row block-row-' . absint( $cols ) . '">';
228
- }
229
-
230
- /**
231
- * @since 1.0.0
232
- * Columns wrapper end
233
- */
234
- public function layout_end() {
235
- echo '</div>';
236
- }
237
-
238
- /**
239
- * @since 1.0.0
240
- * Renders empty space block
241
- *
242
- * @param int $height - height(px) of space
243
- */
244
- public function display_empty_space( $height = 25 ) {
245
-
246
- echo '<div class="wpchill_empty_space" style="height:' . esc_attr( $height ) . 'px;"></div>';
247
- }
248
-
249
- /**
250
- * Horizontal delimiter
251
- *
252
- * @return void
253
- * @since 1.0.0
254
- */
255
- public function horizontal_delimiter() {
256
- echo '<hr class="wpchill_horizontal_delimiter">';
257
- }
258
-
259
- }
260
- }
1
+ <?php
2
+
3
+ if ( ! class_exists( 'WPChill_Welcome' ) ) {
4
+
5
+ class WPChill_Welcome {
6
+
7
+ /**
8
+ * Contains the instance of the Class
9
+ *
10
+ * @since 1.0.0
11
+ * @param WPChill_Welcome $instance
12
+ */
13
+ private static $instance = null;
14
+
15
+ /**
16
+ * @since 1.0.0
17
+ * @param string $textdomain - wpchill textdomain
18
+ */
19
+ public $textdomain = 'wpchill';
20
+
21
+ private function __construct() {
22
+ add_action( 'admin_footer', array( $this, 'welcome_style' ) );
23
+ }
24
+
25
+ /**
26
+ * @since 1.0.0
27
+ * Singleton
28
+ */
29
+ public static function get_instance() {
30
+
31
+ if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WPChill_Welcome ) ) {
32
+ self::$instance = new WPChill_Welcome();
33
+ }
34
+
35
+ return self::$instance;
36
+ }
37
+
38
+ /**
39
+ * @since 1.0.0
40
+ * Enqueue admin Wellcome style
41
+ */
42
+ public function welcome_style() {
43
+ wp_register_style( 'wpchill-welcome-style', plugins_url( '/assets/css/wpchill-welcome.css', __FILE__ ), null, '1.0.0' );
44
+ wp_print_styles( array( 'wpchill-welcome-style' ) );
45
+ }
46
+
47
+ /**
48
+ * @since 1.0.0
49
+ * Renders buttons
50
+ *
51
+ * @param string $text
52
+ *
53
+ * @param string $url
54
+ *
55
+ * @param bool $fill
56
+ *
57
+ * @param string $color
58
+ */
59
+ public function display_button( $text, $link, $fill = true, $color = '#5D3CE4' ) {
60
+ $style = 'style="background-color:' . sanitize_hex_color( $color ) . ';border-color:' . sanitize_hex_color( $color ) . ';color:#fff;"';
61
+ echo '<a href="' . esc_attr( $link ) . '" ' . ( $fill ? $style : '' ) . ' class="wpmtst-btn wpmtst-btn-block wpmtst-btn-lg">' . esc_html( $text ) . '</a>';
62
+ }
63
+
64
+ /**
65
+ * @since 1.0.0
66
+ * Renders extension html
67
+ *
68
+ * @param string $title
69
+ *
70
+ * @param string $description
71
+ *
72
+ * @param string $icon (icon URL)
73
+ *
74
+ * @param bool $pro
75
+ */
76
+ public function display_extension( $title, $description = '', $icon = '', $pro = false, $pro_color = '#5333ED' ) {
77
+
78
+ echo '<div class="feature-block">';
79
+ if ( '' != $icon ) {
80
+ echo '<img src="' . esc_attr( $icon ) . '">';
81
+ }
82
+ echo '<h5>' . esc_html( $title ) . ( ( $pro ) ? '<div style="background-color:' . esc_attr( $pro_color ) . '" class="pro-label">PRO</div>' : '' ) . '</h5>';
83
+ echo '<p>' . esc_html( $description ) . '</p>';
84
+ echo '</div>';
85
+ }
86
+
87
+ /**
88
+ * @since 1.0.0
89
+ * Displays h1 heading
90
+ *
91
+ * @param string $text
92
+ *
93
+ * @param string $position
94
+ */
95
+ public function display_heading( $text, $position = 'center' ) {
96
+ echo '<h1 style="text-align: ' . esc_attr( $position ) . ';" >' . esc_html( $text ) . '</h1>';
97
+ }
98
+
99
+ /**
100
+ * @since 1.0.0
101
+ * Displays h6 subheading
102
+ *
103
+ * @param string $text
104
+ *
105
+ * @param string $position
106
+ */
107
+ public function display_subheading( $text, $position = 'center' ) {
108
+ echo '<h6 style="text-align: ' . esc_attr( $position ) . '" >' . esc_html( $text ) . '</h6>';
109
+ }
110
+
111
+
112
+ /**
113
+ * @since 1.0.0
114
+ * Renders testimonial block
115
+ *
116
+ * @param string $text
117
+ *
118
+ * @param string $icon
119
+ *
120
+ * @param string $name
121
+ *
122
+ * @param string $job (reviewer's job or company)
123
+ */
124
+ public function display_testimonial( $text, $icon = '', $name = '', $job = '', $star_color = '' ) {
125
+
126
+ echo '<div class="testimonial-block">';
127
+ if ( '' != $icon ) {
128
+ echo '<img src=" ' . esc_url( $icon ) . ' "/>';
129
+ }
130
+ echo '<p>' . esc_html( $text ) . '</p>';
131
+
132
+ $this->display_stars( $star_color );
133
+
134
+ if ( '' !== $name || '' !== $job ) {
135
+ echo '<p>';
136
+
137
+ if ( '' !== $name ) {
138
+ echo '<strong>' . esc_html( $name ) . '</strong><br/>';
139
+ }
140
+ if ( '' !== $job ) {
141
+ echo esc_html( $job );
142
+ }
143
+ echo '</p>';
144
+ }
145
+
146
+ echo '</div>';
147
+ }
148
+
149
+ /**
150
+ * @since 1.0.0
151
+ * Renders a UL list
152
+ *
153
+ * @param array $items - array of list items
154
+ */
155
+ public function display_listing( $items ) {
156
+ echo '<ul>';
157
+
158
+ foreach ( $items as $item ) {
159
+ echo '<li>' . esc_html( $item ) . '</li>';
160
+ }
161
+
162
+ echo '</ul>';
163
+ }
164
+
165
+
166
+ /**
167
+ * @since 1.0.0
168
+ * Renders a UL list
169
+ *
170
+ * @param string $url - youtube.com url
171
+ */
172
+ public function display_video( $url ) {
173
+ parse_str( wp_parse_url( esc_url( $url ), PHP_URL_QUERY ), $video_vars );
174
+ echo '<div class="container"><iframe src="https://www.youtube.com/embed/' . esc_attr( $video_vars['v'] ) . '" frameborder="0" allowfullscreen class="video"></iframe></div>';
175
+ }
176
+
177
+ /**
178
+ * @since 1.0.0
179
+ * Renders rating stars block
180
+ *
181
+ * @param string $color - code of the star color fill
182
+ */
183
+ public function display_stars( $color ) {
184
+ $color = ( '' === $color ) ? '#FFD700' : sanitize_hex_color( $color );
185
+ $id = wp_rand( 0, 9999999 );
186
+ $star = '<svg version="1.1" class="svg-' . absint( $id ) . '" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-274 399.8 53 43.1" style="enable-background:new -274 399.8 53 43.1;" xml:space="preserve">
187
+ <g>
188
+ <path class="st0" d="M-234.8,415h-11.5l-3.6-11c-1.4-4.3-3.7-4.3-5.1,0l-3.6,11h-11.5c-4.5,0-5.3,2.2-1.6,4.8l9.3,6.8l-3.6,11
189
+ c-1.4,4.3,0.4,5.7,4.1,3l9.3-6.8l9.3,6.8c3.7,2.7,5.5,1.3,4.1-3l-3.6-11l9.3-6.8C-229.6,417.1-230.3,415-234.8,415z"/>
190
+ </g>
191
+ </svg>';
192
+
193
+ $svg_args = array(
194
+ 'svg' => array(
195
+ 'class' => true,
196
+ 'aria-hidden' => true,
197
+ 'aria-labelledby' => true,
198
+ 'role' => true,
199
+ 'xmlns' => true,
200
+ 'width' => true,
201
+ 'height' => true,
202
+ 'viewbox' => true, // <= Must be lower case!
203
+ 'id' => true,
204
+ ),
205
+ 'g' => array( 'fill' => true ),
206
+ 'title' => array( 'title' => true ),
207
+ 'path' => array(
208
+ 'd' => true,
209
+ 'fill' => true,
210
+ ),
211
+ 'style' => array( 'type' => true ),
212
+ );
213
+
214
+ echo '<style>';
215
+ echo '.svg-' . absint( $id ) . '{ fill:' . sanitize_hex_color( $color ) . ';}';
216
+ echo '</style>';
217
+ echo '<div class="stars_wrapper">' . wp_kses( $star . $star . $star . $star . $star, $svg_args ) . '</div>';
218
+ }
219
+
220
+ /**
221
+ * @since 1.0.0
222
+ * Columns wrapper start
223
+ *
224
+ * @param int $cols - # of columns the contained objects should be displayed as. (1/2/3)
225
+ */
226
+ public function layout_start( $cols = 2, $class = '' ) {
227
+ echo '<div class="' . esc_attr( $class ) . ' block-row block-row-' . absint( $cols ) . '">';
228
+ }
229
+
230
+ /**
231
+ * @since 1.0.0
232
+ * Columns wrapper end
233
+ */
234
+ public function layout_end() {
235
+ echo '</div>';
236
+ }
237
+
238
+ /**
239
+ * @since 1.0.0
240
+ * Renders empty space block
241
+ *
242
+ * @param int $height - height(px) of space
243
+ */
244
+ public function display_empty_space( $height = 25 ) {
245
+
246
+ echo '<div class="wpchill_empty_space" style="height:' . esc_attr( $height ) . 'px;"></div>';
247
+ }
248
+
249
+ /**
250
+ * Horizontal delimiter
251
+ *
252
+ * @return void
253
+ * @since 1.0.0
254
+ */
255
+ public function horizontal_delimiter() {
256
+ echo '<hr class="wpchill_horizontal_delimiter">';
257
+ }
258
+
259
+ }
260
+ }
includes/submodules/banner/readme.txt CHANGED
@@ -1 +1 @@
1
- Readme
1
+ Readme
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: wpchill, silkalns, barrykooij, mikejolley
3
  Tags: download manager, document management, file manager, digital store, ecommerce, document management plugin, download monitor, download counter, password protection, download protection, password, protect downloads, tracker, sell, shop, ecommerce, paypal
4
  Requires at least: 5.4
5
  Tested up to: 6.0
6
- Stable tag: 4.5.93
7
  License: GPLv3
8
  Text Domain: -
9
  Requires PHP: 5.6
@@ -121,4 +121,604 @@ More documentation can be found in our [Knowledge Base](https://www.download-mon
121
 
122
  == Changelog ==
123
 
124
- See <a href="https://github.com/WPChill/download-monitor/blob/master/changelog.txt" target="_blank">changelog</a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  Tags: download manager, document management, file manager, digital store, ecommerce, document management plugin, download monitor, download counter, password protection, download protection, password, protect downloads, tracker, sell, shop, ecommerce, paypal
4
  Requires at least: 5.4
5
  Tested up to: 6.0
6
+ Stable tag: 4.5.94
7
  License: GPLv3
8
  Text Domain: -
9
  Requires PHP: 5.6
121
 
122
  == Changelog ==
123
 
124
+ = 4.5.94 - 31.05.2022 =
125
+ Changed: Remove Duplicator Upsells ( https://github.com/WPChill/download-monitor/issues/959 )
126
+ Fixed: Download url not working while permalinks are set to plain ( https://github.com/WPChill/download-monitor/issues/964 )
127
+ Fixed: User IPs now showing in logs/download notification emails ( https://github.com/WPChill/download-monitor/issues/965 )
128
+
129
+ = 4.5.93 - 25.05.2022 =
130
+ Fixed: Robots.txt check on all pages ( https://github.com/WPChill/download-monitor/issues/937 )
131
+ Added: "No file provided" notification in download admin listing for "empty" downloads ( https://github.com/WPChill/download-monitor/issues/887 )
132
+ Added: Product ID in admin DLM products listing ( https://github.com/WPChill/download-monitor/issues/885 )
133
+ Fixed: Downloads hanging at 99% in multi-threaded mode ( https://github.com/WPChill/download-monitor/issues/816 )
134
+ Fixed: Critical error on quick-editing a Download/Product ( https://github.com/WPChill/download-monitor/issues/906 )
135
+ Changed: Onboarding page ( https://github.com/WPChill/download-monitor/issues/820 )
136
+ Changed: Partition the Download Monitor's menu into groups ( https://github.com/WPChill/download-monitor/issues/776 )
137
+ Fixed: the_title filter too few arguments ( https://github.com/WPChill/download-monitor/issues/908 )
138
+ Added: Notice for BETA testers ( https://github.com/WPChill/download-monitor/issues/951 )
139
+
140
+ = 4.5.92 - 11.04.2022 =
141
+ Fixed: Missing Files/Access denied for users with out of root wp-content ( https://github.com/WPChill/download-monitor/issues/888 )
142
+ Added: New setting for out of root/uploads directory for files to be downloaded
143
+
144
+ = 4.5.91 - 05.04.2022 =
145
+ Fixed: Error when checking for robots.txt file ( https://github.com/WPChill/download-monitor/issues/883 )
146
+
147
+ = 4.5.9 - 05.04.2022 =
148
+ Fixed: Security issues regarding file downloads and download titles
149
+ Added: Option to not count admin downloads. ( https://github.com/WPChill/download-monitor/issues/854 )
150
+ Added: No-index/no-follow header for redirect to file option ( https://github.com/WPChill/download-monitor/issues/879 )
151
+ Added: Welcome banner on activation ( https://github.com/WPChill/download-monitor/issues/874 )
152
+ Added: Robots.txt generation/protection setting ( https://github.com/WPChill/download-monitor/issues/878 )
153
+ Added: Metabox and shortcode column for products ( https://github.com/WPChill/download-monitor/issues/866 )
154
+ Fixed: Error downloading files if the files have been modified directly using a File Manager and the Download has not been updated ( https://github.com/WPChill/download-monitor/issues/860 )
155
+ Fixed: Polyfill DateTimeImmutable __set_state array initialization
156
+
157
+ = 4.5.8 - 28.03.2022 =
158
+ Fixed: Upgrade to PRO now disappears when all extensions installed ( https://github.com/WPChill/download-monitor/issues/875 )
159
+
160
+ = 4.5.7 - 21.03.2022 =
161
+ Changed: Removed Download Duplicator from LITE vs PRO page ( https://github.com/WPChill/download-monitor/issues/872 )
162
+ Changed: Versions from Gutenberg block now mention `n/a #id` as title if they are non-versioned ( https://github.com/WPChill/download-monitor/issues/873 )
163
+ Added: Upgrade to pro link in plugins page ( https://github.com/WPChill/download-monitor/issues/870 )
164
+ Added: do_action in shortcodes so we can add scripts only if shortcode is present ( https://github.com/WPChill/download-monitor/issues/868 )
165
+ Change: members_only column to locked_downloads in admin listing table and added filters so we can override from extensions ( https://github.com/WPChill/download-monitor/issues/867 )
166
+
167
+ = 4.5.6 - 14.03.2022 =
168
+ Fixed: Endpoint changing value notice and flushing permalinks on endpoint change ( https://github.com/WPChill/download-monitor/issues/801 )
169
+ Fixed: Place back the categories column in admin list view and change the copy shortcode functionality ( https://github.com/WPChill/download-monitor/issues/821 )
170
+ Changed: Removed thumb column from Admin list table
171
+ Fixed: PolyLang compatibility ( https://github.com/WPChill/download-monitor/issues/733 )
172
+ Changed: Uploader enhancement ( https://github.com/WPChill/download-monitor/issues/869 )
173
+
174
+ = 4.5.5 - 08.03.2022 =
175
+ * Fixed: Uninstall now completely removes everything based on selection ( https://github.com/WPChill/download-monitor/issues/761 )
176
+ * Added: New option to display featured downloads for the [downloads] shortcode ( https://github.com/WPChill/download-monitor/issues/624)
177
+ * Added: Shortcode visible on all downloads page ( #821 )
178
+ * Fixed: Set our own orderby param on Admin Dashboard ( https://github.com/WPChill/download-monitor/issues/809 )
179
+ * Fixed: PayPal - new API ( https://github.com/WPChill/download-monitor/issues/861, https://github.com/WPChill/download-monitor/issues/796, https://github.com/WPChill/download-monitor/issues/665, https://github.com/WPChill/download-monitor/issues/636 )
180
+ * Fixed: Direct upload button ( https://github.com/WPChill/download-monitor/issues/863 )
181
+ * Fixed: Escaping on shop e-mail templates
182
+ * Fixed: Issue preventing a product to be added to cart. ( https://github.com/WPChill/download-monitor/issues/865 )
183
+
184
+ = 4.5.4 - 28.02.2022 =
185
+ Added: Included DLM Download Duplicator as core Download Monitor function ( https://github.com/WPChill/download-monitor/issues/848 )
186
+ Fixed: Insert downloads button ( https://github.com/WPChill/download-monitor/issues/811 )
187
+ Fixed: File/Version date error ( https://github.com/WPChill/download-monitor/issues/812 )
188
+ Fixed: Download Monitor endpoint already in use by a page/post ( https://github.com/WPChill/download-monitor/issues/826 )
189
+ Added: Secure attribute on wp_dlm_downloading cookie ( https://github.com/WPChill/download-monitor/issues/592 )
190
+ Fixed: DLM_Admin_Fields esc_attr insead of esc_attr ( https://github.com/WPChill/download-monitor/issues/656 )
191
+ Fixed: Dismissable warnings ( https://github.com/WPChill/download-monitor/issues/680 )
192
+ Fixed: Browse for file should use Wordpress Media Manager ( https://github.com/WPChill/download-monitor/issues/670 )
193
+ Added: Shop enabled - create a new tab ( https://github.com/WPChill/download-monitor/issues/858 )
194
+ Added: Lite vs Pro button in upsells ( https://github.com/WPChill/download-monitor/issues/857 )
195
+ Fixed: Orders submenu entry under the Shop Menu entry ( https://github.com/WPChill/download-monitor/issues/859 )
196
+
197
+
198
+ = 4.5.3 - 21.02.2022 =
199
+ Added: LITE vs PRO page - https://github.com/WPChill/download-monitor/issues/851
200
+ Changed: Extensions UI/texts update ( -https://github.com/WPChill/download-monitor/issues/846, https://github.com/WPChill/download-monitor/issues/849, https://github.com/WPChill/download-monitor/issues/838 )
201
+ Fixed: Escaping the excerpt - https://github.com/WPChill/download-monitor/issues/790
202
+ Fixed: Error in logs `select user` filter if user was deleted - https://github.com/WPChill/download-monitor/issues/828
203
+ Added: Setting to disable file browser - https://github.com/WPChill/download-monitor/issues/469
204
+ Fixed: Translation & escaping fixes
205
+
206
+ = 4.5.2 - 16.02.2022 =
207
+ Fixed: Reports date selection bug - ( https://github.com/WPChill/download-monitor/issues/823 )
208
+ Fixed: Extensions page view on Safari
209
+
210
+ = 4.5.1 - 31.01.2022 =
211
+ Removed: Removed plugin updater from lite.
212
+
213
+ = 4.5.0 - 26.01.2022 =
214
+ Fixed: Style missing in `[downloads]` shortcode - ( https://wordpress.org/support/topic/box-template-styling-stopped-displaying/ )
215
+ Fixed: Downloads not being filtered by categories - https://github.com/WPChill/download-monitor/issues/815
216
+ Fixed: Missing admin.css file for Download Monitor admin header in category edit page - https://github.com/WPChill/download-monitor/issues/817
217
+ Changed: Category link in Downloads view table will now work similar to Posts and keep already set filters - https://github.com/WPChill/download-monitor/issues/818
218
+ Changed: Minor sanitization and escaping fix
219
+ Changed: Redo public taxonomies ( https://github.com/WPChill/download-monitor/issues/775 )
220
+
221
+ = 4.4.14 - 12.01.2022 =
222
+ Added: Filter 'dlm_filemanager_get_file_name' to filter the displayed file name.
223
+ Fixed: Check if there are pages/posts/cpt with the same slug as the endpoint ( https://github.com/WPChill/download-monitor/issues/774 )
224
+ Added: Filter 'dlm_completed_order_download' to filter download button in checkout page.
225
+ Added: DLM Rest Routes for dlm_download, dlm_download_category & dlm_download_tag
226
+ Fixed: Changed the escaping method to allow some html tags to be inserted in the title ( https://github.com/WPChill/download-monitor/issues/783 )
227
+ Changed: The "View" category button in Downloads > Categories should not exist ( https://github.com/WPChill/download-monitor/issues/775 )
228
+ Added: Upsells in admin download page options metabox ( https://github.com/WPChill/download-monitor/issues/780 )
229
+ Fixed: Fixed a typo in settings. ( https://github.com/WPChill/download-monitor/issues/663 )
230
+ Added: Quick copy button in download page. ( https://github.com/WPChill/download-monitor/issues/717 )
231
+ Fixed: Wrong post_type in url. Coud not see order details. ( https://github.com/WPChill/download-monitor/issues/788 )
232
+ Changed: The plugin's css will only load when the shortcode is present. ( https://github.com/WPChill/download-monitor/issues/782 )
233
+
234
+ = 4.4.13 - 16.11.2021 =
235
+ Fixed: Fatal error because an extra semicolon
236
+
237
+ = 4.4.12 - 16.11.2021 =
238
+ Fixed: Dependencies in widgets screen cc @HardeepAsrani
239
+ Removed: Custom webpack build and replaced with @wordpress/scripts cc @HardeepAsrani
240
+ Fixed: Optimized block with React Hooks for readibility purposes cc @HardeepAsrani
241
+ Fixed: Product not saving in downloads select ( https://github.com/WPChill/download-monitor/issues/770 )
242
+ Fixed: Typo in file URLs
243
+ Fixed: Widget options update - https://github.com/WPChill/download-monitor/issues/768
244
+ Fixed: Downloads not working with shop enabled - https://github.com/WPChill/download-monitor/issues/769
245
+
246
+ = 4.4.11 - 03.11.2021 =
247
+ Fixed: Reports date changing ( https://github.com/WPChill/download-monitor/issues/755 )
248
+ Fixed: Log page - Status Column width ( https://github.com/WPChill/download-monitor/issues/756 )
249
+ Fixed: Password protection form, password field not being displayed ( https://github.com/WPChill/download-monitor/issues/757 )
250
+ Fixed: Escaping problem in the No-Access page ( https://github.com/WPChill/download-monitor/issues/758 )
251
+
252
+ = 4.4.10 - 02.11.2021 =
253
+ Fixed: Escaping in admin "All Downloads" page. ( https://github.com/WPChill/download-monitor/issues/753 )
254
+ Added: Review request in dashboard.
255
+
256
+ = 4.4.9 - 01.11.2021 =
257
+ Fixed: Escaping in admin column, displaying HTLM instead of correct form
258
+ Added: Clear transients button.
259
+
260
+ = 4.4.8 - 29.10.2021 =
261
+ Fixed: Insert Download/Quick Download Button
262
+
263
+ = 4.4.7 - 29.10.2021 =
264
+ Fixed: Sanitization & Escaping
265
+
266
+ = 4.4.6 - 20.10.2021 =
267
+ Fixed: Checking for modifications to the upload folder
268
+
269
+ = 4.4.5 - 20.10.2021 =
270
+ Fixed: PHP 8 bug - slow query ( https://github.com/WPChill/download-monitor/issues/685 )
271
+ Fixed: Deprecated PHP 8 notice (https://github.com/WPChill/download-monitor/issues/682 thanks to @ashleyfae )
272
+ Fixed: PHP templates errors ( https://github.com/WPChill/download-monitor/issues/691 )
273
+ Fixed: Single shop download error ( https://github.com/WPChill/download-monitor/issues/690 )
274
+ Fixed: Permalink errors - retrieved permalinks on archives didn't show the correct URL ( https://github.com/WPChill/download-monitor/issues/689 )
275
+ Fixed : [downloads] shortcode now displays both featured and not featured downloads when left as is ( thanks to @kadimi https://github.com/WPChill/download-monitor/pull/526 )
276
+ Added : Size filter in the placeholder image ( thanks to @jamesgol https://github.com/WPChill/download-monitor/pull/507 )
277
+ Fixed : Sha256 support added when new files are added ( thanks to @jamesgol https://github.com/WPChill/download-monitor/pull/633 )
278
+ Added: Upsells
279
+ Fixed: Fix download from CDN where uploads folder is replaced ( https://github.com/WPChill/download-monitor/issues/698 )
280
+ Fixed: Fatal error on URL with version param ( https://github.com/WPChill/download-monitor/issues/709 )
281
+ Changed: Notice display
282
+ Changed: Tab reconstruction and settings structure
283
+ Changed: TinyMCE interface for short description ( https://github.com/WPChill/download-monitor/issues/708 )
284
+ Fixed : Added layer of security against certain SQL Injections
285
+
286
+ = 4.4.4: October 19, 2020 =
287
+ * Tweak: Fixed PHP 7.4 notices.
288
+ * Tweak: Check if download variable is set in content-download template. This prevents a fatal error in odd case no download is given.
289
+ * Tweak: Now passing variables to actions to version.php admin view file.
290
+ * Tweak: Bump websocket-extensions from 0.1.3 to 0.1.4
291
+
292
+ = 4.4.3: June 8, 2020 =
293
+ * Tweak: Small minor fixes and tweaks.
294
+
295
+ = 4.4.2: April 3, 2019 =
296
+ * Tweak: Fixed an relative inclusion bug that sometimes caused bootstrap not to properly load. (Undefined function dlm_is_shop_enabled()).
297
+
298
+ = 4.4.1: March 27, 2019 =
299
+ * Tweak: Added proper html escaping to order overview page, props Nam.Dinh.
300
+
301
+ = 4.4.0: March 8, 2019 =
302
+ * Feature: Added a new product post type to create a clear separation between downloads and the products you can sell. Read more about this here: https://www.download-monitor.com/kb/products/
303
+ * Feature: Shop products now have a basic detail (single) page. This will be improved in future updates.
304
+ * Feature: Added "Paid Only" option to downloads. This allows you to require users to have a purchase linked to the download before file can be downloaded.
305
+ * Feature: Versions are now passed through the no-access page.
306
+ * Tweak: dlm_buy shortcode now takes a product id, instead of a download ID. These need to be updated manually.
307
+ * Tweak: Shop feature has been more isolated from non-shop. To enable shop, go to general Download Monitor settings and check "Enable Shop".
308
+ * Tweak: PayPal gateway is now enabled by default.
309
+
310
+ = 4.3.0: February 27, 2019 =
311
+ * Feature: Added Shop (Beta) feature. You can now sell your downloads via Download Monitor! More addition to shop (like taxes and discounts) coming soon.
312
+ * Feature: Added PayPal integration for shop feature.
313
+ * Feature: Added an onboarding screen, helping the user set up the plugin.
314
+ * Tweak: Fixed an error when changing dates in reports on Safari.
315
+ * Tweak: Added download ID to Reports overview table.
316
+ * Tweak: Increased spacing of download title on reports summary block.
317
+ * Tweak: We're no longer automatically creating the No Access page. This is now done via the onboarding screen.
318
+ * Tweak: We're no longer supporting PHP 5.2. If you upgrade and are still running PHP 5.2, the plugin will not load but display an upgrade notice instead. More info: https://www.download-monitor.com/kb/minimum-required-php-version/
319
+ * Tweak: Updated translations.
320
+
321
+ = 4.2.1: January 31, 2019 =
322
+ * Tweak: Correctly set default template of Gutenberg block on frontend of website when no specific template is set.
323
+
324
+ = 4.2.0: January 24, 2019 =
325
+ * Feature: Added Gutenberg download block. Type /download in your post screen to see it in action!
326
+
327
+ = 4.1.1: September 12, 2018 =
328
+ * Tweak: Fixed a bug that incorrectly included featured downloads by default in [downloads].
329
+ * Tweak: Added 'dlm_get_template_part_args' filter that allows argument filtering on Download Monitor templates.
330
+
331
+ = 4.1.0: May 21, 2018 =
332
+ * Feature: Added a new option that allows site-owners if and how they wish to track IP addresses of users.
333
+ * Feature: Added a new option that allows site-owners to decide if they wish to track user agent of users.
334
+ * Tweak: Fixed an issue where title of log dates had incorrect date.
335
+ * Tweak: Added compatibility for 'Post Types Order' plugin. The dashboard widget no longer is affected by their custom order.
336
+ * Tweak: Added dlm_frontend_scripts filter, allows user to not include DLM frontend assets.
337
+ * Tweak: No longer load jQuery UI CSS from Google CDN, file is now included in plugin.
338
+ * Tweak: No longer loading jQuery images from Google CDN, images are now included in plugin.
339
+
340
+ = 4.0.8: May 3, 2018 =
341
+ * Tweak: Fixed a bug in the legacy upgrader that caused versions with empty dates not to added.
342
+ * Tweak: Fixed the use of getTimeStamp() because PHP 5.2 doesn't support this.
343
+
344
+ = 4.0.7: April 13, 2018 =
345
+ * Tweak: Fixed a bug that caused certain months in the reports filter to crash for non English languages.
346
+ * Tweak: Fixed a bug that caused the 10 download limit on the Dashboard Widget to be ignored.
347
+ * Tweak: Added "dlm_remove_dashboard_popular_downloads" filter that allows for not loading of dashboard widget.
348
+ * Tweak: Moved 'dlm_log_item' filter to within the WordPressLogItemRepository::persist() method. This way the filter will always be called upon a log persist.
349
+ * Tweak: Filter 'dlm_log_item' 2nd and 3rd argument changed from DLM_Download & DLM_Download_Version type to int (ID's of both download and version).
350
+ * Tweak: Moved 'dlm_downloading_log_item_added' filter to within the WordPressLogItemRepository::persist() method. This way the filter will always be called upon a log persist.
351
+ * Tweak: Filter 'dlm_downloading_log_item_added' 2nd and 3rd argument changed from DLM_Download & DLM_Download_Version type to int (ID's of both download and version).
352
+ * Tweak: Added filter 'dlm_reports_page_start' to add content on top of admin reports page.
353
+ * Tweak: Added filter 'dlm_reports_page_end' to add content on bottom of admin reports page.
354
+ * Tweak: Added download id and download object to 'dlm_placeholder_image_src' filter, props [James Golovich](https://github.com/jamesgol).
355
+ * Tweak: Added filter 'dlm_download_get_versions' on return of DLM_Download::get_versions(), props [James Golovich](https://github.com/jamesgol).
356
+ * Tweak: Added $atts to various shortcode filters, props [James Golovich](https://github.com/jamesgol).
357
+
358
+ = 4.0.6: March 8, 2018 =
359
+ * Tweak: Fixed a bug in the version-list template, correct version links are now displayed.
360
+
361
+ = 4.0.5: February 21, 2018 =
362
+ * Tweak: Fixed a bug that caused the "Add file" button to not appear on the Add New Download screen.
363
+ * Tweak: Fixed a bug that caused the crc32b hash not to be saved when adding a download via the 'Quick-add Download' option.
364
+ * Tweak: WordPressVersionRepository no longer explicitly sets 'post_content' and 'post_excerpt' database fields of dlm_download_version to empty strings. Props [Erin Morelli](https://github.com/ErinMorelli).
365
+
366
+ = 4.0.4: February 19, 2018 =
367
+ * Tweak: Fixed a bug where versions of draft and pending review downloads were not displayed in the backend.
368
+
369
+ = 4.0.3: February 9, 2018 =
370
+ * Tweak: We now cache if we need to upgrade legacy downloads. This prevents us from checking if we need to upgrade on every pageload, improving performance and preventing constant sql warning when legacy table doesn't exist.
371
+ * Tweak: Fixed SQL error in has_ip_downloaded_version() call ('type' does not exist).
372
+
373
+ = 4.0.2: February 2, 2018 =
374
+ * Tweak: Moved no cache headers up in download process, improving cache prevention.
375
+ * Tweak: Added new log item meta data methods, making it easier to add meta data.
376
+ * Tweak: Added new action 'dlm_downloading_log_item_added'. Is triggered after log item is added on download request.
377
+ * Tweak: Added $download and $version arguments to 'dlm_log_item' filter.
378
+
379
+ = 4.0.1: January 25, 2018 =
380
+ * Tweak: Fixed an issue that caused widget limit to not work.
381
+ * Tweak: Fixed an count() warning in PHP7.2 on extension page.
382
+ * Tweak: Fixed a passed by reference notice in lower PHP versions in get_visitor_ip() call.
383
+ * Tweak: Added 'dlm_download_count' filter to fitler get_download_count() return value.
384
+ * Tweak: Downloads now return an empty version if no version is added. This prevents mulitple possible fatal errors when external scripts don't check if get_version() returns null.
385
+ * Tweak: Added an extra check to if website needs upgrading. If there are new downloads in the database, no upgrade is recommended.
386
+ * Tweak: Added an extra warning on the upgrade page to users that navigate to the page while we think no upgrade is needed.
387
+ * Tweak: Requesting a non existing download no longer triggers a fatal error (exception is now properly handled).
388
+ * Tweak: Correct exception handling when trying to save meta boxes of non existing download.
389
+
390
+ = 4.0.0: January 22, 2018 =
391
+ * Feature: Added reports page for download statistics.
392
+ * Feature: Added hash values to version blocks.
393
+ * Feature: Added option to include downloads in WordPress default search results, props [Kurt Zenisek](https://github.com/KZeni).
394
+ * Feature: Added SHA256 hash.
395
+ * Feature: Added support for regex patterns in user agent blacklist, props [Matt Mower](https://github.com/mdmower).
396
+ * Feature: Added user filter to logs, props [neptuneweb](https://github.com/neptuneweb).
397
+ * Feature: Log columns in log table are now sortable.
398
+ * Feature: Added an option for the user to remove all transients.
399
+ * Feature: Added the ability to exclude tags from the [downloads] shortcode.
400
+ * Feature: Added search option in "Insert Download" overlay.
401
+ * Feature: Added builtin legacy upgrade tool to help users move their downloads from legacy to current version.
402
+ * Tweak: Added 'dlm_file_path' filter to filter file_path in download request.
403
+ * Tweak: We're now only serving downloads when requested over the GET or POST HTTP method. This can be filtered via filter dlm_accepted_request_methods.
404
+ * Tweak: Added Download Title to download log CSV export file.
405
+ * Tweak: Added 'dlm_shortcode_total_downloads' filter to output of [total_downloads] shortcode, props [Joel James](https://github.com/Joel-James).
406
+ * Tweak: Added support for Apache 2.4 and up in generated .htaccess file.
407
+ * Tweak: Added 'dlm_download_use_version_transient' filter to allow website to not use cache transients.
408
+ * Tweak: Downloads need to be published in order to exist, draft downloads can no longer be downloaded.
409
+ * Tweak: Fixed plugin links on plugin overview page.
410
+ * Tweak: Optimization rewrite of DLM_Download class.
411
+ * Tweak: Optimization rewrite of DLM_Download_Version class.
412
+ * Tweak: Introduction of Factory and Repository design patterns for Downloads and Versions.
413
+ * Tweak: Complete rewrite of setting fields.
414
+ * Tweak: Updated template files to use new download methods.
415
+ * Tweak: Introduced new filter "dlm_setting_field_TYPE", allowing third party programs to add custom field types to settings.
416
+ * Tweak: Implemented Composer autoloader.
417
+ * Tweak: Download Categories and Download Tags label name now contains 'Download'.
418
+ * Tweak: Download Widget now uses default template output set in settings when no output template is set.
419
+ * Tweak: Download Widget CSS tweaks.
420
+ * Tweak: Download category and download tags are now excluded from Yoast SEO sitemap.
421
+ * Tweak: 'Delete Logs' button now requires a confirmation.
422
+ * Tweak: Placeholders for download thumbnails in media library list view are now also properly replaced.
423
+ * Tweak: Minor UX improvement on Download Information fields making it easier to copy these, props [Danny van Kooten](https://github.com/dannyvankooten).
424
+ * Tweak: Replaced double underscore prefixed functions with single underscore prefix to comply with PHP reserved method naming rules.
425
+
426
+ = 1.9.9: October 18, 2017 =
427
+ * Tweak: Fixed an issue with 'No Access' page not saving correctly.
428
+
429
+ = 1.9.8: October 6, 2017 =
430
+ * Tweak: Add option to allow HTTP header X_FORWARD_FOR. Allowing Download Monitor to use the X_FORWARDED_FOR HTTP header set by proxies as the IP address.
431
+ * Tweak: Download files that are added via 'Quick-add download' are now properly added to WP media library.
432
+ * Tweak: Introduced 'lazy select' option for Download Monitor settings. Options of these select elements are only loaded on setting pages, increasing overall plugin performance.
433
+ * Tweak: We're now filtering attachment thumbnails in media library for files in dlm_uploads. This solves 403 errors on thumbnails in the protected folder.
434
+
435
+ = 1.9.7: May 5, 2017 =
436
+ * Tweak: Added capability checks to log export and delete functionality. Props [Pritect](http://www.pritect.net/).
437
+ * Tweak: We're now redirecting users to home on empty download request. Behavior can be changed via filters. See https://www.download-monitor.com/kb/empty-download-request-redirection/
438
+
439
+ = 1.9.6: February 28, 2017 =
440
+ * Tweak: Fix display for unknown user in exported log, props [Matt Mower](https://github.com/mdmower).
441
+ * Tweak: Settings screen hash tweaks.
442
+ * Tweak: Display correct tab on settings save, props [Matt Mower](https://github.com/mdmower).
443
+ * Tweak: Fixed issue with some dismissible notices.
444
+ * Tweak: Add Portuguese (pt_PT) translation, props [Pedro Mendonça](https://github.com/pedro-mendonca).
445
+ * Tweak: Included various language tweaks via Transifex. Help out over at [Transifex](https://www.transifex.com/barrykooijplugins/download-monitor/).
446
+
447
+ = 1.9.5: August 23, 2016 =
448
+ * Tweak: Fixed a bug where Download Options couldn't be checked off in quick edit.
449
+ * Tweak: Updated settings screen description for custom templates.
450
+ * Tweak: Download Information input fields are now readonly since these fields are informational only. Props [kraftner](https://github.com/kraftner).
451
+ * Tweak: Removed code that triggered PHP7 incompatibility false positives in PHP7 compatibility scans.
452
+ * Tweak: Removed old JSON library since default JSON functions are available from PHP 5.2 and up.
453
+
454
+ = 1.9.4: May 2, 2016 =
455
+ * Tweak: Various cookie tweaks to prevent incorrect double logging entries.
456
+ * Tweak: Added a Cookie Manager class to centralize cookie related tasks.
457
+
458
+ = 1.9.3: April 11, 2016 =
459
+ * Tweak: Small rework of [downloads] loop. Downloads now filterable per download via dlm_shortcode_downloads_loop_download.
460
+ * Tweak: We now report missing versions for removed downloads in logs, props [Matt Mower](https://github.com/mdmower).
461
+ * Tweak: Updated Danish translation, props [Georg Adamsen](https://github.com/GSAdev).
462
+
463
+ = 1.9.2: March 27, 2016 =
464
+ * Tweak: Fixed bug where 'version' and 'version_id' were ignored in [download].
465
+ * Tweak: Fixed a bug that caused the file upload overlay to append file URL to wrong version, props [kraftner](https://github.com/kraftner).
466
+ * Tweak: Optimized [download] shortcode code.
467
+ * Tweak: Flush rewrites in admin settings on shutdown instead of during page load, props [sybrew](https://github.com/sybrew).
468
+ * Tweak: Added extra checks to blacklist checks to prevent stristr empty needle notices, props [Matt Mower](https://github.com/mdmower).
469
+ * Tweak: Removed DS_Store backups, props [Matt Mower](https://github.com/mdmower).
470
+ * Tweak: Added Ukrainian translation, props [Fremler](https://www.transifex.com/user/profile/Fremler/).
471
+ * Tweak: Added Croatian translation, props [molekula](https://www.transifex.com/user/profile/molekula/).
472
+ * Tweak: Updated Dutch translation.
473
+ * Tweak: Updated Portuguese (Brazil) translation.
474
+
475
+ = 1.9.1: December 1, 2015 =
476
+ * Tweak: Check if $visitor_ua isn't empty to prevent stristr warnings.
477
+ * Tweak: Added wmv filetype icon support
478
+ * Tweak: Correctly populate data on quick edit of download.
479
+ * Tweak: Settings tab now loads tab of set URL hash.
480
+
481
+ = 1.9.0: September 15, 2015 =
482
+ * Feature: We added a separate 'No Access' page that includes the following features:
483
+ * No Access Page : Added [dlm_no_access] shortcode that displays the no access content.
484
+ * No Access Page : Added new option in Access settings tab to set No Access Page.
485
+ * No Access Page : Added new template file for no access page.
486
+ * No Access Page : We now redirect to set No Access page (if set) when user has no access to download.
487
+ * Feature: Added ability to remove log entries.
488
+ * Feature: Added browser detection for IE 11 and up.
489
+ * Feature: Added OS detection for Windows 8.1
490
+ * Feature: Added OS detection for Windows 10
491
+ * Feature: Added Featured download, Members only and Redirect to file to bulk edit options.
492
+ * Feature: Added Featured download, Members only and Redirect to file to quick edit options.
493
+
494
+ = 1.8.1: August 21, 2015 =
495
+ * Tweak: Small tweak to make download count fit better in box template.
496
+ * Tweak: Fixed a zero file size bug.
497
+ * Tweak: Fixed featured image disappears bug, props [Ricardo](https://wordpress.org/support/profile/ricardopires).
498
+ * Tweak: Search template file in custom path before in plugin path.
499
+
500
+ = 1.8.0: July 10, 2015 =
501
+ * Feature: Added option to only count downloads and add logs from unique ip addresses, props [Matt Mower](https://github.com/mdmower).
502
+ * Feature: It's now possible to display downloads with the downloads shortcode that are in all given categories (AND instead of OR) by using + (plus_ instead of , (comma).
503
+ * Feature: Display nginx rules if server is running nginx.
504
+ * Feature: Added Multisite / Network compatibility.
505
+ * Feature: Redone blacklist IP feature, now available in the 'Access' tab.
506
+ * Feature: Redone blacklist user agent feature, now available in the 'Access' tab.
507
+ * Tweak: Added icon support for Office X Excel & PPT extensions.
508
+ * Tweak: Run thumbnail compatibility method later to allowed themes to register first.
509
+ * Tweak: Prefixed admin CSS classes to prevent plugin conflicts.
510
+ * Tweak: Fix checking shortcodes for empty version strings, props [Matt Mower](https://github.com/mdmower).
511
+ * Tweak: Fixed a call of trigger() in DLM_Download_Handler, props [Matt Mower](https://github.com/mdmower).
512
+ * Tweak: Remove trailing space from downloads count, props [Matt Mower](https://github.com/mdmower).
513
+ * Tweak: Directory browser items are now always in alphabetical order, props [Matt Mower](https://github.com/mdmower).
514
+ * Tweak: The 60 seconds download counter increment cool down is now set to version ID instead of download ID, props [Matt Mower](https://github.com/mdmower).
515
+ * Tweak: Created and implemented local independent basename fixing issues with Cyrillic alphabets.
516
+ * Tweak: Made user agents regexes filterable: dlm_ua_parser_regexes.
517
+ * Tweak: Optimized log status icons, also fixes WP emoji conflict.
518
+ * Tweak: Members Only check now only does check if requester can still download.
519
+ * Tweak: Replaced PHP4 constructors in widget.
520
+ * Tweak: Added Danish translation.
521
+ * Tweak: Updated Dutch translation.
522
+ * Tweak: Updated German translation.
523
+
524
+ = 1.7.2: April 29, 2015 =
525
+ * Tweak: Fixed a bug that caused logs not to be displayed in WP 4.2.
526
+
527
+ = 1.7.1: April 17, 2015 =
528
+ * Tweak: Pass third arg to add_query_arg to prevent XSS.
529
+
530
+ = 1.7.0: March 22, 2015 =
531
+ * Feature: Added 'Download Information' meta box to edit download screen that displays useful download information.
532
+ * Feature: Error message shown when visitor has no access to download is now an option.
533
+ * Tweak: Fixing a bug where versions with spaces did not work, versions now are checked on a sanitized title.
534
+ * Tweak: Viewing logs now needs custom capability: dlm_manage_logs (automatically added to administrators).
535
+ * Tweak: Improved hotlink prevention check.
536
+ * Tweak: Extension page tweaks.
537
+ * Tweak: Added $download_id argument to dlm_hotlink_redirect filter.
538
+ * Tweak: Moved hash settings to their own tab.
539
+ * Tweak: Moved 'X-Accel-Redirect / X-Sendfile' and 'Prevent hotlinking' settings to General tab.
540
+ * Tweak: Optimized the Insert Download button.
541
+ * Tweak: Introduced a multi-byte-safe pathinfo so we can handle 'special' filenames.
542
+ * Tweak: Also set the post_date_gmt value for version dates.
543
+ * Tweak: Updated French translation. Props Li-An.
544
+ * Tweak: Updated German translation. Props maphy-psd.
545
+ * Tweak: Updated Swedish translation. Props EyesX.
546
+ * Tweak: Update Slovakian translation. Props attitude.
547
+ * Tweak: Added Dutch translation.
548
+
549
+ = 1.6.4: March 8, 2015 =
550
+ * Removed unused library jqueryFileTree.
551
+ * dlm_shortcode_download_content filter now also includes $atts.
552
+ * Fixed small parse file parse error because of whitespace.
553
+ * Changed some admin menu hook priorities.
554
+
555
+ = 1.6.3: January 18, 2015 =
556
+ * Fixed an undefined method call 'get_filesize'.
557
+ * Allow third party extensions to hijack [downloads] shortcode with filter dlm_shortcode_download_content.
558
+ * Made 'wp_dlm_downloading' cookie only accessible through the HTTP protocol, props [Matt Mower](https://github.com/mdmower).
559
+
560
+ = 1.6.2: January 11, 2015 =
561
+ * Fixed a bug that caused translations not to load.
562
+ * Fixed a bug that prevented download versions from being removed.
563
+ * Fixed a pagination in 'insert download' shortcode bug.
564
+ * Fixed a bug in the template loader when used with a custom directory, a slug and no custom template.
565
+ * Removed assigning by reference, fixed strict notice when deleting downloads.
566
+ * Tweaked template loader to accept arguments.
567
+ * Allow downloads shortcode WP_Query arguments to be filtered with 'dlm_shortcode_downloads_args'.
568
+
569
+ = 1.6.1: January 9, 2015 =
570
+ * Fixed an extension activation error.
571
+ * Fixed a bug that caused the featured image to disappear in some themes.
572
+ * Tweak: In multisite only users that are a member of the blog can download 'member only' downloads.
573
+
574
+ = 1.6.0: January 8, 2015 =
575
+ * Plugin is now initiated at plugins_loaded.
576
+ * Implemented auto loader.
577
+ * Classes are no longer initiated at bottom of class file but whenever an object is needed.
578
+ * Code standards corrections.
579
+ * Introduced Template_Handler. Loading of template parts should be done through this class.
580
+ * Removed $GLOBALS['dlm_logging'] global.
581
+ * Removed $GLOBALS['DLM_Download_Handler'] global.
582
+ * Removed internal use of $download_monitor global.
583
+ * Moved all inline JavaScript to separate JavaScript files.
584
+ * Moved all install related code to installer class.
585
+ * Moved main plugin class to it's own file.
586
+ * Deprecated 'dlm_create_log' function.
587
+ * Redone extensions page.
588
+ * Fixed a bug in shortcode download where orderby=download_count wasn't working.
589
+ * Fixed a bug where downloads didn't work with default WP permalink structure.
590
+ * Delete dlm_file_version_ids_ transient on save.
591
+ * Added dlm_download_headers filter.
592
+ * Added dlm_get_template_part filter.
593
+
594
+ = 1.5.1 =
595
+ * Fallback for JSON_UNESCAPED_UNICODE to fix accented characters on < PHP 5.4.
596
+ * Changed default orderby for downloads shortcode to date, desc.
597
+
598
+ = 1.5.0 =
599
+ * JSON_UNESCAPED_UNICODE for files to fix unicode chars when json encoded. Fix needs PHP 5.4+ to work, but won't break lower versions.
600
+ * Style filetype-docx
601
+ * Update get_version_id to work with non-numeric versions.
602
+ * Fix shortcode arg booleans.
603
+ * Add transient cache for get_file_version_ids.
604
+ * Moved all translations to Transifex - https://www.transifex.com/projects/p/download-monitor/
605
+ * Changed text domain from download_monitor to download-monitor.
606
+ * Added Grunt.
607
+ * Added options to generate file hashes DISABLED BY DEFAULT as they can cause performance issues with large files.
608
+
609
+ = 1.4.4 =
610
+ * Use home_dir instead of site_dir - fixes hot-linking protections against own site (when not in root dir)
611
+ * Replace hardcoded WP_CONTENT_DIR and WP_CONTENT_URL with wp_upload_dir to work when UPLOADS and UPLOADS_URL constants are set.
612
+ * Added some filters for hotlink protection customisation.
613
+
614
+ = 1.4.3 =
615
+ * Add password form to download page when required
616
+ * Run shortcodes in excerpt/short desc
617
+ * Various hook additions
618
+ * pr_br and zh_cn translation
619
+ * Sort download count by meta_value_num
620
+ * Store URLs in JSON format to allow easier search/replace
621
+ * Fix dashboard sorting
622
+ * Option for basic referer checking to prevent hotlinking.
623
+ * Only get file hashes on save as they are resource heavy.
624
+ * Disable remote file hash generation, but can be enabled with filter dlm_allow_remote_hash_file
625
+ * Radio buttons instead of select (with pagination) in popup to improve performance.
626
+
627
+ = 1.4.2 =
628
+ * Fix for site_url -> abspath
629
+ * Check if hash functions are supported before use.
630
+
631
+ = 1.4.1 =
632
+ * Fix file_exists error in download handlers
633
+
634
+ = 1.4.0 =
635
+ * MP6/3.8 admin styling. Requires 3.8.
636
+ * Polish translation.
637
+ * Turkish translation.
638
+ * Change capability required to view dashboard widget.
639
+ * Don't show "insert download" when editing a download.
640
+ * Allow pagination for the [downloads] shortcode. Simply add paginate=true to the shortcode.
641
+ * Reverted flush change in download handler to reduce memory usage on some hosting envrionments
642
+ * changed download handlers and fixed corruption when resuming files
643
+ * Calculate md5/sha1/crc32 hashes for files. Obtainable via methods or download_data, e.g. [download_data id="86" data="md5"]
644
+ * Added file_date data
645
+
646
+ = 1.3.2 =
647
+ * Cleaned up log table queries
648
+ * Tweaked download handler headers
649
+ * Tweaked logging
650
+ * Limit UA to 200
651
+ * Setcookie to prevent double logging
652
+ * Addons page (disable using add_filter( 'dlm_show_addons_page', '__return_false' ); )
653
+
654
+ = 1.3.1 =
655
+ * Added some new hooks
656
+ * FR and SR_RS updates
657
+
658
+ = 1.3.0 =
659
+ * Fix 0kb downloads in some hosting enviroments
660
+ * Added button to delete logs
661
+ * Fixed log page when no logs are present
662
+ * FR and HU updates
663
+ * Added dropdown for the default template option to make available templates more obvious
664
+ * Added version-list and title templates
665
+
666
+ = 1.2.0 =
667
+ * Option to redirect to files only (do not force)
668
+ * Fixed textdomains
669
+ * HU translation by Győző Farkas
670
+ * Fix dlm_upload folder when not using month/day upload folders.
671
+ * Fix IP lookup
672
+ * Resumable download support
673
+ * Tweaked download handler
674
+
675
+ = 1.1.2 =
676
+ * HTTPS headers for IE fix
677
+ * Italian locale
678
+
679
+ = 1.1.1 =
680
+ * Specify error statuses on wp_die messages e.g. 404 for missing files.
681
+ * Moved DONOTCACHEPAGE
682
+
683
+ = 1.1.0 =
684
+ * Fixed admin notices
685
+ * Added download link to admin 'file' column for copying and pasting
686
+ * Farsi localisation
687
+ * Wrapping content in a [download] shortcode will wrap it in a simple link.
688
+
689
+ = 1.0.6 =
690
+ * Hide taxonomies from nav menus
691
+ * Fix categories in download_data method.
692
+
693
+ = 1.0.5 =
694
+ * When do_not_force is enabled, still replace abspath with home_url
695
+ * Exclude dlm_download from search and disable query var
696
+ * Added category_include_children option for downloads shortcode
697
+ * Fixed logs time offset.
698
+
699
+ = 1.0.4 =
700
+ * Tweak admin page detection to work when no downloads exist.
701
+ * Fix dashboard widget warning.
702
+ * Add filters to logs and export csv function.
703
+ * Added extra columns to CSV.
704
+
705
+ = 1.0.3 =
706
+ * Fix config page to work with multibyte tab names.
707
+ * Japanese locale by hide92795
708
+ * Admin CSS/script conditonally loaded
709
+ * Versions are now strtolower to be compatible with version_compare and to standardise numbers.
710
+
711
+ = 1.0.2 =
712
+ * Only use wp_remote_head to get fielsize on remote files. Prevents timeouts when a file doesn't exist.
713
+ * If a filesize cannot be found, set to -1 to prevent re-tries.
714
+ * Insert button added to all CPT except downloads.
715
+ * French locale by Jean-Michel MEYER.
716
+
717
+ = 1.0.1 =
718
+ * Update blockui
719
+ * Workaround root relative URLS
720
+
721
+ = 1.0.0 =
722
+ * Complete rewrite of the plugin making use of custom post types and other best practices. Fresh start version '1' to prevent auto-updates (legacy importer needs to be used to migrate from old versions).
723
+
724
+ == Upgrade Notice ==
src/Admin/CategoryWalker.php CHANGED
@@ -1,53 +1,53 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
- } // Exit if accessed directly
5
-
6
- /**
7
- * DLM_Category_Walker class.
8
- *
9
- * @extends Walker
10
- */
11
- class DLM_Category_Walker extends Walker {
12
-
13
- var $tree_type = 'category';
14
- var $db_fields = array( 'parent' => 'parent', 'id' => 'term_id', 'slug' => 'slug' );
15
-
16
- /**
17
- * @see Walker::start_el()
18
- * @since 2.1.0
19
- *
20
- * @param string $output Passed by reference. Used to append additional content.
21
- * @param object $category Category data object.
22
- * @param int $depth Depth of category in reference to parents.
23
- * @param array $args
24
- */
25
- function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {
26
-
27
- if ( ! empty( $args['hierarchical'] ) ) {
28
- $pad = str_repeat( '&nbsp;', $depth * 3 );
29
- } else {
30
- $pad = '';
31
- }
32
-
33
- $cat_name = apply_filters( 'list_product_cats', $object->name, $object );
34
-
35
- $value = isset( $args['value'] ) && $args['value'] == 'id' ? $object->term_id : $object->slug;
36
-
37
- $output .= "\t<option class=\"level-$depth\" value=\"" . $value . "\"";
38
-
39
- if ( $value == $args['selected'] || ( is_array( $args['selected'] ) && in_array( $value, $args['selected'] ) ) ) {
40
- $output .= ' selected="selected"';
41
- }
42
-
43
- $output .= '>';
44
-
45
- $output .= $pad . __( $cat_name, 'download-monitor' );
46
-
47
- if ( ! empty( $args['show_count'] ) ) {
48
- $output .= '&nbsp;(' . $object->count . ')';
49
- }
50
-
51
- $output .= "</option>\n";
52
- }
53
  }
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ } // Exit if accessed directly
5
+
6
+ /**
7
+ * DLM_Category_Walker class.
8
+ *
9
+ * @extends Walker
10
+ */
11
+ class DLM_Category_Walker extends Walker {
12
+
13
+ var $tree_type = 'category';
14
+ var $db_fields = array( 'parent' => 'parent', 'id' => 'term_id', 'slug' => 'slug' );
15
+
16
+ /**
17
+ * @see Walker::start_el()
18
+ * @since 2.1.0
19
+ *
20
+ * @param string $output Passed by reference. Used to append additional content.
21
+ * @param object $category Category data object.
22
+ * @param int $depth Depth of category in reference to parents.
23
+ * @param array $args
24
+ */
25
+ function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {
26
+
27
+ if ( ! empty( $args['hierarchical'] ) ) {
28
+ $pad = str_repeat( '&nbsp;', $depth * 3 );
29
+ } else {
30
+ $pad = '';
31
+ }
32
+
33
+ $cat_name = apply_filters( 'list_product_cats', $object->name, $object );
34
+
35
+ $value = isset( $args['value'] ) && $args['value'] == 'id' ? $object->term_id : $object->slug;
36
+
37
+ $output .= "\t<option class=\"level-$depth\" value=\"" . $value . "\"";
38
+
39
+ if ( $value == $args['selected'] || ( is_array( $args['selected'] ) && in_array( $value, $args['selected'] ) ) ) {
40
+ $output .= ' selected="selected"';
41
+ }
42
+
43
+ $output .= '>';
44
+
45
+ $output .= $pad . __( $cat_name, 'download-monitor' );
46
+
47
+ if ( ! empty( $args['show_count'] ) ) {
48
+ $output .= '&nbsp;(' . $object->count . ')';
49
+ }
50
+
51
+ $output .= "</option>\n";
52
+ }
53
  }
src/Admin/CustomLabels.php CHANGED
@@ -1,60 +1,60 @@
1
- <?php
2
-
3
- class DLM_Custom_Labels {
4
-
5
- /**
6
- * Setup custom labels
7
- */
8
- public function setup() {
9
- add_filter( 'enter_title_here', array( $this, 'enter_title_here' ), 1, 2 );
10
- add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
11
- }
12
-
13
- /**
14
- * enter_title_here function.
15
- *
16
- * @param string $text
17
- * @param WP_Post $post
18
- *
19
- * @access public
20
- * @return string
21
- */
22
- public function enter_title_here( $text, $post ) {
23
- if ( 'dlm_download' == $post->post_type ) {
24
- return __( 'Download title', 'download-monitor' );
25
- }
26
-
27
- return $text;
28
- }
29
-
30
- /**
31
- * post_updated_messages function.
32
- *
33
- * @access public
34
- *
35
- * @param array $messages
36
- *
37
- * @return array
38
- */
39
- public function post_updated_messages( $messages ) {
40
- global $post;
41
-
42
- $messages['dlm_download'] = array(
43
- 0 => '', // Unused. Messages start at index 1.
44
- 1 => __( 'Download updated.', 'download-monitor' ),
45
- 2 => __( 'Custom field updated.', 'download-monitor' ),
46
- 3 => __( 'Custom field deleted.', 'download-monitor' ),
47
- 4 => __( 'Download updated.', 'download-monitor' ),
48
- 5 => isset( $_GET['revision'] ) ? sprintf( esc_html__( 'Download restored to revision from %s', 'download-monitor' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
49
- 6 => __( 'Download published.', 'download-monitor' ),
50
- 7 => __( 'Download saved.', 'download-monitor' ),
51
- 8 => __( 'Download submitted.', 'download-monitor' ),
52
- 9 => sprintf( __( 'Download scheduled for: <strong>%1$s</strong>.', 'download-monitor' ),
53
- date_i18n( __( 'M j, Y @ G:i', 'download-monitor' ), strtotime( $post->post_date ) ) ),
54
- 10 => __( 'Download draft updated.', 'download-monitor' ),
55
- );
56
-
57
- return $messages;
58
- }
59
-
60
  }
1
+ <?php
2
+
3
+ class DLM_Custom_Labels {
4
+
5
+ /**
6
+ * Setup custom labels
7
+ */
8
+ public function setup() {
9
+ add_filter( 'enter_title_here', array( $this, 'enter_title_here' ), 1, 2 );
10
+ add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
11
+ }
12
+
13
+ /**
14
+ * enter_title_here function.
15
+ *
16
+ * @param string $text
17
+ * @param WP_Post $post
18
+ *
19
+ * @access public
20
+ * @return string
21
+ */
22
+ public function enter_title_here( $text, $post ) {
23
+ if ( 'dlm_download' == $post->post_type ) {
24
+ return __( 'Download title', 'download-monitor' );
25
+ }
26
+
27
+ return $text;
28
+ }
29
+
30
+ /**
31
+ * post_updated_messages function.
32
+ *
33
+ * @access public
34
+ *
35
+ * @param array $messages
36
+ *
37
+ * @return array
38
+ */
39
+ public function post_updated_messages( $messages ) {
40
+ global $post;
41
+
42
+ $messages['dlm_download'] = array(
43
+ 0 => '', // Unused. Messages start at index 1.
44
+ 1 => __( 'Download updated.', 'download-monitor' ),
45
+ 2 => __( 'Custom field updated.', 'download-monitor' ),
46
+ 3 => __( 'Custom field deleted.', 'download-monitor' ),
47
+ 4 => __( 'Download updated.', 'download-monitor' ),
48
+ 5 => isset( $_GET['revision'] ) ? sprintf( esc_html__( 'Download restored to revision from %s', 'download-monitor' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
49
+ 6 => __( 'Download published.', 'download-monitor' ),
50
+ 7 => __( 'Download saved.', 'download-monitor' ),
51
+ 8 => __( 'Download submitted.', 'download-monitor' ),
52
+ 9 => sprintf( __( 'Download scheduled for: <strong>%1$s</strong>.', 'download-monitor' ),
53
+ date_i18n( __( 'M j, Y @ G:i', 'download-monitor' ), strtotime( $post->post_date ) ) ),
54
+ 10 => __( 'Download draft updated.', 'download-monitor' ),
55
+ );
56
+
57
+ return $messages;
58
+ }
59
+
60
  }
src/Admin/OptionsUpsells.php CHANGED
@@ -1,96 +1,96 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit;
5
- } // Exit if accessed directly
6
-
7
- /**
8
- * DLM_Admin class.
9
- */
10
- class DLM_Admin_OptionsUpsells {
11
-
12
- /**
13
- * __construct function.
14
- *
15
- * @access public
16
- */
17
- public function __construct() {
18
- add_action( 'dlm_options_end', array( $this, 'add_upsells_products' ), 99 );
19
- }
20
-
21
- public function get_active_addons(){
22
-
23
- return DLM_Product_Manager::get()->get_products();
24
- }
25
-
26
- public function add_upsells_products(){
27
-
28
- $active_addons = $this->get_active_addons();
29
-
30
- if( !array_key_exists( 'dlm-terms-and-conditions', $active_addons ) ){
31
- $this->render_terms_and_conditions_upsell();
32
- }
33
-
34
- if( !array_key_exists( 'dlm-twitter-lock', $active_addons ) ){
35
- $this->render_twitter_lock_upsell();
36
- }
37
-
38
- if( !array_key_exists( 'dlm-email-lock', $active_addons ) ){
39
- $this->render_email_lock_upsell();
40
- }
41
-
42
- if( !array_key_exists( 'dlm-captcha', $active_addons ) ){
43
- $this->render_captcha_upsell();
44
- }
45
-
46
-
47
- }
48
-
49
- public function render_terms_and_conditions_upsell(){
50
- ?>
51
- <a href="<?php echo esc_url( 'https://www.download-monitor.com/pricing/?utm_source=plugin&utm_medium=extension-block&utm_campaign=Terms%20and%20Conditions' ); ?>" class="options_upsell_link" target="_blank">
52
- <p class="form-field form-field-checkbox not-active">
53
- <span class="dashicons dashicons-lock"></span>
54
- <span><?php esc_html_e( 'Terms &amp; Conditions Required', 'download-monitor' ); ?><span class="dlm-upsell-badge">PRO</span> </span>
55
- <span class="dlm-description"> <?php esc_html_e( 'This download will only be downloadable after accepting the terms and conditions.', 'download-monitor' ); ?></span>
56
- </p>
57
- </a>
58
- <?php
59
- }
60
-
61
- public function render_twitter_lock_upsell(){
62
- ?>
63
- <a href="<?php echo esc_url( 'https://www.download-monitor.com/pricing/?utm_source=plugin&utm_medium=extension-block&utm_campaign=Twitter%20Lock' ); ?>" class="options_upsell_link" target="_blank">
64
- <p class="form-field form-field-checkbox not-active">
65
- <span class="dashicons dashicons-lock"></span>
66
- <span><?php esc_html_e( 'Twitter Lock', 'download-monitor' ); ?><span class="dlm-upsell-badge">PRO</span></span>
67
- <span class="dlm-description"> <?php esc_html_e( 'Twitter locked downloads will only be available after user tweets a predefined text.', 'download-monitor' ); ?></span>
68
- </p>
69
- </a>
70
- <?php
71
- }
72
-
73
- public function render_email_lock_upsell(){
74
- ?>
75
- <a href="<?php echo esc_url( 'https://www.download-monitor.com/pricing/?utm_source=plugin&utm_medium=extension-block&utm_campaign=Email%20Lock' ); ?>" class="options_upsell_link" target="_blank">
76
- <p class="form-field form-field-checkbox not-active">
77
- <span class="dashicons dashicons-lock"></span>
78
- <span><?php esc_html_e( 'Email Lock', 'download-monitor' ); ?><span class="dlm-upsell-badge">PRO</span></span>
79
- <span class="dlm-description"> <?php esc_html_e( 'Email locked downloads will only be available after user entered their email address.', 'download-monitor' ); ?></span>
80
- </p>
81
- </a>
82
- <?php
83
- }
84
-
85
- public function render_captcha_upsell(){
86
- ?>
87
- <a href="<?php echo esc_url( 'https://www.download-monitor.com/pricing/?utm_source=plugin&utm_medium=extension-block&utm_campaign=Captcha' ); ?>" class="options_upsell_link" target="_blank">
88
- <p class="form-field form-field-checkbox not-active">
89
- <span class="dashicons dashicons-lock"></span>
90
- <span><?php esc_html_e( 'Require Captcha', 'download-monitor' ); ?><span class="dlm-upsell-badge">PRO</span></span>
91
- <span class="dlm-description"> <?php esc_html_e( 'User is required to complete a reCAPTCHA before access is granted to the dowload.', 'download-monitor' ); ?></span>
92
- </p>
93
- </a>
94
- <?php
95
- }
96
  }
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ } // Exit if accessed directly
6
+
7
+ /**
8
+ * DLM_Admin class.
9
+ */
10
+ class DLM_Admin_OptionsUpsells {
11
+
12
+ /**
13
+ * __construct function.
14
+ *
15
+ * @access public
16
+ */
17
+ public function __construct() {
18
+ add_action( 'dlm_options_end', array( $this, 'add_upsells_products' ), 99 );
19
+ }
20
+
21
+ public function get_active_addons(){
22
+
23
+ return DLM_Product_Manager::get()->get_products();
24
+ }
25
+
26
+ public function add_upsells_products(){
27
+
28
+ $active_addons = $this->get_active_addons();
29
+
30
+ if( !array_key_exists( 'dlm-terms-and-conditions', $active_addons ) ){
31
+ $this->render_terms_and_conditions_upsell();
32
+ }
33
+
34
+ if( !array_key_exists( 'dlm-twitter-lock', $active_addons ) ){
35
+ $this->render_twitter_lock_upsell();
36
+ }
37
+
38
+ if( !array_key_exists( 'dlm-email-lock', $active_addons ) ){
39
+ $this->render_email_lock_upsell();
40
+ }
41
+
42
+ if( !array_key_exists( 'dlm-captcha', $active_addons ) ){
43
+ $this->render_captcha_upsell();
44
+ }
45
+
46
+
47
+ }
48
+
49
+ public function render_terms_and_conditions_upsell(){
50
+ ?>
51
+ <a href="<?php echo esc_url( 'https://www.download-monitor.com/pricing/?utm_source=plugin&utm_medium=extension-block&utm_campaign=Terms%20and%20Conditions' ); ?>" class="options_upsell_link" target="_blank">
52
+ <p class="form-field form-field-checkbox not-active">
53
+ <span class="dashicons dashicons-lock"></span>
54
+ <span><?php esc_html_e( 'Terms &amp; Conditions Required', 'download-monitor' ); ?><span class="dlm-upsell-badge">PRO</span> </span>
55
+ <span class="dlm-description"> <?php esc_html_e( 'This download will only be downloadable after accepting the terms and conditions.', 'download-monitor' ); ?></span>
56
+ </p>
57
+ </a>
58
+ <?php
59
+ }
60
+
61
+ public function render_twitter_lock_upsell(){
62
+ ?>
63
+ <a href="<?php echo esc_url( 'https://www.download-monitor.com/pricing/?utm_source=plugin&utm_medium=extension-block&utm_campaign=Twitter%20Lock' ); ?>" class="options_upsell_link" target="_blank">
64
+ <p class="form-field form-field-checkbox not-active">
65
+ <span class="dashicons dashicons-lock"></span>
66
+ <span><?php esc_html_e( 'Twitter Lock', 'download-monitor' ); ?><span class="dlm-upsell-badge">PRO</span></span>
67
+ <span class="dlm-description"> <?php esc_html_e( 'Twitter locked downloads will only be available after user tweets a predefined text.', 'download-monitor' ); ?></span>
68
+ </p>
69
+ </a>
70
+ <?php
71
+ }
72
+
73
+ public function render_email_lock_upsell(){
74
+ ?>
75
+ <a href="<?php echo esc_url( 'https://www.download-monitor.com/pricing/?utm_source=plugin&utm_medium=extension-block&utm_campaign=Email%20Lock' ); ?>" class="options_upsell_link" target="_blank">
76
+ <p class="form-field form-field-checkbox not-active">
77
+ <span class="dashicons dashicons-lock"></span>
78
+ <span><?php esc_html_e( 'Email Lock', 'download-monitor' ); ?><span class="dlm-upsell-badge">PRO</span></span>
79
+ <span class="dlm-description"> <?php esc_html_e( 'Email locked downloads will only be available after user entered their email address.', 'download-monitor' ); ?></span>
80
+ </p>
81
+ </a>
82
+ <?php
83
+ }
84
+
85
+ public function render_captcha_upsell(){
86
+ ?>
87
+ <a href="<?php echo esc_url( 'https://www.download-monitor.com/pricing/?utm_source=plugin&utm_medium=extension-block&utm_campaign=Captcha' ); ?>" class="options_upsell_link" target="_blank">
88
+ <p class="form-field form-field-checkbox not-active">
89
+ <span class="dashicons dashicons-lock"></span>
90
+ <span><?php esc_html_e( 'Require Captcha', 'download-monitor' ); ?><span class="dlm-upsell-badge">PRO</span></span>
91
+ <span class="dlm-description"> <?php esc_html_e( 'User is required to complete a reCAPTCHA before access is granted to the dowload.', 'download-monitor' ); ?></span>
92
+ </p>
93
+ </a>
94
+ <?php
95
+ }
96
  }
src/Admin/Settings/Fields/ActionButton.php CHANGED
@@ -1,56 +1,56 @@
1
- <?php
2
-
3
- class DLM_Admin_Fields_Field_ActionButton extends DLM_Admin_Fields_Field {
4
-
5
- /** @var string */
6
- private $link;
7
-
8
- /** @var string */
9
- private $label;
10
-
11
- /**
12
- * DLM_Admin_Fields_Field constructor.
13
- *
14
- * @param String $name
15
- * @param String $link
16
- * @param String $label
17
- */
18
- public function __construct( $name, $link, $label ) {
19
- $this->link = $link;
20
- $this->label = $label;
21
- parent::__construct( $name, '', '' );
22
- }
23
-
24
- /**
25
- * Generate nonce
26
- *
27
- * @return string
28
- */
29
- private function generate_nonce() {
30
- return wp_create_nonce( $this->get_name() );
31
- }
32
-
33
- /**
34
- * Get prepped URL
35
- *
36
- * @return string
37
- */
38
- private function get_url() {
39
- return add_query_arg( array(
40
- 'dlm_action' => $this->get_name(),
41
- 'dlm_nonce' => $this->generate_nonce()
42
- ), $this->link );
43
- }
44
-
45
- /**
46
- * Renders field
47
- *
48
- * The Button is quite an odd 'field'. It's basically just an a tag.
49
- */
50
- public function render() {
51
- ?>
52
- <a class="button" href="<?php echo esc_url( $this->get_url() ); ?>"><?php echo esc_html( $this->label ); ?></a>
53
- <?php
54
- }
55
-
56
  }
1
+ <?php
2
+
3
+ class DLM_Admin_Fields_Field_ActionButton extends DLM_Admin_Fields_Field {
4
+
5
+ /** @var string */
6
+ private $link;
7
+
8
+ /** @var string */
9
+ private $label;
10
+
11
+ /**
12
+ * DLM_Admin_Fields_Field constructor.
13
+ *
14
+ * @param String $name
15
+ * @param String $link
16
+ * @param String $label
17
+ */
18
+ public function __construct( $name, $link, $label ) {
19
+ $this->link = $link;
20
+ $this->label = $label;
21
+ parent::__construct( $name, '', '' );
22
+ }
23
+
24
+ /**
25
+ * Generate nonce
26
+ *
27
+ * @return string
28
+ */
29
+ private function generate_nonce() {
30
+ return wp_create_nonce( $this->get_name() );
31
+ }
32
+
33
+ /**
34
+ * Get prepped URL
35
+ *
36
+ * @return string
37
+ */
38
+ private function get_url() {
39
+ return add_query_arg( array(
40
+ 'dlm_action' => $this->get_name(),
41
+ 'dlm_nonce' => $this->generate_nonce()
42
+ ), $this->link );
43
+ }
44
+
45
+ /**
46
+ * Renders field
47
+ *
48
+ * The Button is quite an odd 'field'. It's basically just an a tag.
49
+ */
50
+ public function render() {
51
+ ?>
52
+ <a class="button" href="<?php echo esc_url( $this->get_url() ); ?>"><?php echo esc_html( $this->label ); ?></a>
53
+ <?php
54
+ }
55
+
56
  }
src/Admin/Settings/Fields/Desc.php CHANGED
@@ -1,14 +1,14 @@
1
- <?php
2
-
3
- class DLM_Admin_Fields_Field_Desc extends DLM_Admin_Fields_Field {
4
-
5
- /**
6
- * Renders field
7
- */
8
- public function render() {
9
- ?>
10
- <p class="dlm-setting-field-description"><?php echo wp_kses_post( $this->get_value() ); ?></p>
11
- <?php
12
- }
13
-
14
  }
1
+ <?php
2
+
3
+ class DLM_Admin_Fields_Field_Desc extends DLM_Admin_Fields_Field {
4
+
5
+ /**
6
+ * Renders field
7
+ */
8
+ public function render() {
9
+ ?>
10
+ <p class="dlm-setting-field-description"><?php echo wp_kses_post( $this->get_value() ); ?></p>
11
+ <?php
12
+ }
13
+
14
  }
src/Admin/Settings/Fields/Title.php CHANGED
@@ -1,30 +1,30 @@
1
- <?php
2
-
3
- class DLM_Admin_Fields_Field_Title extends DLM_Admin_Fields_Field {
4
-
5
- /** @var string */
6
- private $link;
7
-
8
- /** @var string */
9
- private $title;
10
-
11
- /**
12
- * DLM_Admin_Fields_Field_Title constructor.
13
- *
14
- * @param String $title
15
- */
16
- public function __construct( $title ) {
17
- $this->title = $title;
18
- parent::__construct( '', '', '' );
19
- }
20
-
21
- /**
22
- * Renders field
23
- */
24
- public function render() {
25
- ?>
26
- <h3><?php echo esc_html( $this->title ); ?></h3>
27
- <?php
28
- }
29
-
30
  }
1
+ <?php
2
+
3
+ class DLM_Admin_Fields_Field_Title extends DLM_Admin_Fields_Field {
4
+
5
+ /** @var string */
6
+ private $link;
7
+
8
+ /** @var string */
9
+ private $title;
10
+
11
+ /**
12
+ * DLM_Admin_Fields_Field_Title constructor.
13
+ *
14
+ * @param String $title
15
+ */
16
+ public function __construct( $title ) {
17
+ $this->title = $title;
18
+ parent::__construct( '', '', '' );
19
+ }
20
+
21
+ /**
22
+ * Renders field
23
+ */
24
+ public function render() {
25
+ ?>
26
+ <h3><?php echo esc_html( $this->title ); ?></h3>
27
+ <?php
28
+ }
29
+
30
  }
src/Admin/ViewManager.php CHANGED
@@ -1,33 +1,33 @@
1
- <?php
2
-
3
- class DLM_View_Manager {
4
-
5
- /**
6
- * Display a view
7
- *
8
- * @param String $view
9
- * @param array $vars
10
- * @param String $path
11
- */
12
- public function display( $view, $vars=array(), $path = '' ) {
13
-
14
- // setup variables
15
- extract( $vars );
16
-
17
- // set default path if $path is empty
18
- if ( empty( $path ) ) {
19
- $path = download_monitor()->get_plugin_path() . 'assets/views/';
20
- }
21
-
22
- // setup full view path
23
- $view = $path . $view . '.php';
24
-
25
- // check if view exists
26
- if ( file_exists( $view ) ) {
27
-
28
- // load view
29
- include( $view );
30
- }
31
- }
32
-
33
  }
1
+ <?php
2
+
3
+ class DLM_View_Manager {
4
+
5
+ /**
6
+ * Display a view
7
+ *
8
+ * @param String $view
9
+ * @param array $vars
10
+ * @param String $path
11
+ */
12
+ public function display( $view, $vars=array(), $path = '' ) {
13
+
14
+ // setup variables
15
+ extract( $vars );
16
+
17
+ // set default path if $path is empty
18
+ if ( empty( $path ) ) {
19
+ $path = download_monitor()->get_plugin_path() . 'assets/views/';
20
+ }
21
+
22
+ // setup full view path
23
+ $view = $path . $view . '.php';
24
+
25
+ // check if view exists
26
+ if ( file_exists( $view ) ) {
27
+
28
+ // load view
29
+ include( $view );
30
+ }
31
+ }
32
+
33
  }
src/Ajax/Ajax.php CHANGED
@@ -1,33 +1,33 @@
1
- <?php
2
-
3
- abstract class DLM_Ajax {
4
- private $tag = '';
5
-
6
- /**
7
- * @param string $tag
8
- */
9
- public function __construct( $tag ) {
10
- $this->tag = $tag;
11
- }
12
-
13
- /**
14
- * Register AJAX action
15
- */
16
- public function register() {
17
- add_action( DLM_Ajax_Manager::ENDPOINT . $this->tag, array( $this, 'run' ) );
18
- }
19
-
20
- /**
21
- * Checks AJAX nonce
22
- */
23
- protected function check_nonce() {
24
- check_ajax_referer( 'dlm_ajax_nonce_' . $this->tag, 'nonce' );
25
- }
26
-
27
- /**
28
- * AJAX callback method, must be overridden
29
- *
30
- * @return void
31
- */
32
- public abstract function run();
33
  }
1
+ <?php
2
+
3
+ abstract class DLM_Ajax {
4
+ private $tag = '';
5
+
6
+ /**
7
+ * @param string $tag
8
+ */
9
+ public function __construct( $tag ) {
10
+ $this->tag = $tag;
11
+ }
12
+
13
+ /**
14
+ * Register AJAX action
15
+ */
16
+ public function register() {
17
+ add_action( DLM_Ajax_Manager::ENDPOINT . $this->tag, array( $this, 'run' ) );
18
+ }
19
+
20
+ /**
21
+ * Checks AJAX nonce
22
+ */
23
+ protected function check_nonce() {
24
+ check_ajax_referer( 'dlm_ajax_nonce_' . $this->tag, 'nonce' );
25
+ }
26
+
27
+ /**
28
+ * AJAX callback method, must be overridden
29
+ *
30
+ * @return void
31
+ */
32
+ public abstract function run();
33
  }
src/Ajax/GetDownloads.php CHANGED
@@ -1,41 +1,41 @@
1
- <?php
2
-
3
- class DLM_Ajax_GetDownloads extends DLM_Ajax {
4
-
5
- /**
6
- * Constructor
7
- */
8
- public function __construct() {
9
- parent::__construct( 'get_downloads' );
10
- }
11
-
12
- /**
13
- * AJAX callback method
14
- *
15
- * @return void
16
- */
17
- public function run() {
18
- // check nonce
19
- $this->check_nonce();
20
-
21
- $downloads = download_monitor()->service( 'download_repository' )->retrieve( array(
22
- 'orderby' => 'title',
23
- 'order' => 'ASC'
24
- ) );
25
- $downloads_array = array();
26
- if ( ! empty( $downloads ) ) {
27
- /** @var DLM_Download $download */
28
- foreach ( $downloads as $download ) {
29
- $downloads_array[] = array(
30
- 'value' => $download->get_id(),
31
- 'label' => $download->get_title()
32
- );
33
- }
34
- }
35
-
36
- wp_send_json( $downloads_array );
37
-
38
- exit;
39
- }
40
-
41
  }
1
+ <?php
2
+
3
+ class DLM_Ajax_GetDownloads extends DLM_Ajax {
4
+
5
+ /**
6
+ * Constructor
7
+ */
8
+ public function __construct() {
9
+ parent::__construct( 'get_downloads' );
10
+ }
11
+
12
+ /**
13
+ * AJAX callback method
14
+ *
15
+ * @return void
16
+ */
17
+ public function run() {
18
+ // check nonce
19
+ $this->check_nonce();
20
+
21
+ $downloads = download_monitor()->service( 'download_repository' )->retrieve( array(
22
+ 'orderby' => 'title',
23
+ 'order' => 'ASC'
24
+ ) );
25
+ $downloads_array = array();
26
+ if ( ! empty( $downloads ) ) {
27
+ /** @var DLM_Download $download */
28
+ foreach ( $downloads as $download ) {
29
+ $downloads_array[] = array(
30
+ 'value' => $download->get_id(),
31
+ 'label' => $download->get_title()
32
+ );
33
+ }
34
+ }
35
+
36
+ wp_send_json( $downloads_array );
37
+
38
+ exit;
39
+ }
40
+
41
  }
src/Ajax/Manager.php CHANGED
@@ -1,85 +1,85 @@
1
- <?php
2
-
3
- class DLM_Ajax_Manager {
4
- const ENDPOINT = 'dlm-ajax';
5
-
6
- /**a
7
- * Setup custom AJAX calls & custom AJAX handler
8
- */
9
- public function setup() {
10
- add_action( 'init', array( $this, 'add_endpoints' ) );
11
- add_action( 'template_redirect', array( $this, 'handle_ajax' ), 0 );
12
- $this->add_ajax_actions();
13
- }
14
-
15
- /**
16
- * Add endpoints
17
- */
18
- public function add_endpoints() {
19
- add_rewrite_tag( '%' . self::ENDPOINT . '%', '([^/]*)' );
20
- add_rewrite_rule( self::ENDPOINT . '/([^/]*)/?', 'index.php?' . self::ENDPOINT . '=$matches[1]', 'top' );
21
- add_rewrite_rule( 'index.php/' . self::ENDPOINT . '/([^/]*)/?', 'index.php?' . self::ENDPOINT . '=$matches[1]', 'top' );
22
- }
23
-
24
- /**
25
- * Get AJAX for given ajax
26
- *
27
- * @param string $action
28
- * @param bool $include_nonce
29
- *
30
- * @return string
31
- */
32
- public static function get_ajax_url( $action, $include_nonce = true ) {
33
- return untrailingslashit( home_url( sprintf( '?%s=%s&nonce=%s', self::ENDPOINT, $action, wp_create_nonce( 'dlm_ajax_nonce_' . $action ) ) ) );
34
- }
35
-
36
- /**
37
- * Add AJAX actions
38
- */
39
- private function add_ajax_actions() {
40
-
41
- $get_downloads = new DLM_Ajax_GetDownloads();
42
- $get_downloads->register();
43
-
44
- $get_versions = new DLM_Ajax_GetVersions();
45
- $get_versions->register();
46
-
47
- $create_page = new DLM_Ajax_CreatePage();
48
- $create_page->register();
49
-
50
- }
51
-
52
- /**
53
- * Handle AJAX requests
54
- */
55
- public function handle_ajax() {
56
- global $wp_query;
57
-
58
- // set AJAX action if it's set in $_GET
59
- if ( ! empty( $_GET[ self::ENDPOINT ] ) ) {
60
- $wp_query->set( self::ENDPOINT, sanitize_text_field( wp_unslash($_GET[ self::ENDPOINT ]) ) );
61
- }
62
-
63
- // check if endpoint is not false or an empty string
64
- if ( false != $wp_query->get( self::ENDPOINT ) && '' != trim( $wp_query->get( self::ENDPOINT ) ) ) {
65
-
66
- // set AJAX action into var
67
- $action = sanitize_text_field( $wp_query->get( self::ENDPOINT ) );
68
-
69
- // set DOING AJAX to true
70
- if ( ! defined( 'DOING_AJAX' ) ) {
71
- define( 'DOING_AJAX', true );
72
- }
73
-
74
- // set is_home to false
75
- $wp_query->is_home = false;
76
-
77
- // run custom AJAX action
78
- do_action( self::ENDPOINT . $action );
79
-
80
- // bye
81
- die();
82
-
83
- }
84
- }
85
  }
1
+ <?php
2
+
3
+ class DLM_Ajax_Manager {
4
+ const ENDPOINT = 'dlm-ajax';
5
+
6
+ /**a
7
+ * Setup custom AJAX calls & custom AJAX handler
8
+ */
9
+ public function setup() {
10
+ add_action( 'init', array( $this, 'add_endpoints' ) );
11
+ add_action( 'template_redirect', array( $this, 'handle_ajax' ), 0 );
12
+ $this->add_ajax_actions();
13
+ }
14
+
15
+ /**
16
+ * Add endpoints
17
+ */
18
+ public function add_endpoints() {
19
+ add_rewrite_tag( '%' . self::ENDPOINT . '%', '([^/]*)' );
20
+ add_rewrite_rule( self::ENDPOINT . '/([^/]*)/?', 'index.php?' . self::ENDPOINT . '=$matches[1]', 'top' );
21
+ add_rewrite_rule( 'index.php/' . self::ENDPOINT . '/([^/]*)/?', 'index.php?' . self::ENDPOINT . '=$matches[1]', 'top' );
22
+ }
23
+
24
+ /**
25
+ * Get AJAX for given ajax
26
+ *
27
+ * @param string $action
28
+ * @param bool $include_nonce
29
+ *
30
+ * @return string
31
+ */
32
+ public static function get_ajax_url( $action, $include_nonce = true ) {
33
+ return untrailingslashit( home_url( sprintf( '?%s=%s&nonce=%s', self::ENDPOINT, $action, wp_create_nonce( 'dlm_ajax_nonce_' . $action ) ) ) );
34
+ }
35
+
36
+ /**
37
+ * Add AJAX actions
38
+ */
39
+ private function add_ajax_actions() {
40
+
41
+ $get_downloads = new DLM_Ajax_GetDownloads();
42
+ $get_downloads->register();
43
+
44
+ $get_versions = new DLM_Ajax_GetVersions();
45
+ $get_versions->register();
46
+
47
+ $create_page = new DLM_Ajax_CreatePage();
48
+ $create_page->register();
49
+
50
+ }
51
+
52
+ /**
53
+ * Handle AJAX requests
54
+ */
55
+ public function handle_ajax() {
56
+ global $wp_query;
57
+
58
+ // set AJAX action if it's set in $_GET
59
+ if ( ! empty( $_GET[ self::ENDPOINT ] ) ) {
60
+ $wp_query->set( self::ENDPOINT, sanitize_text_field( wp_unslash($_GET[ self::ENDPOINT ]) ) );
61
+ }
62
+
63
+ // check if endpoint is not false or an empty string
64
+ if ( false != $wp_query->get( self::ENDPOINT ) && '' != trim( $wp_query->get( self::ENDPOINT ) ) ) {
65
+
66
+ // set AJAX action into var
67
+ $action = sanitize_text_field( $wp_query->get( self::ENDPOINT ) );
68
+
69
+ // set DOING AJAX to true
70
+ if ( ! defined( 'DOING_AJAX' ) ) {
71
+ define( 'DOING_AJAX', true );
72
+ }
73
+
74
+ // set is_home to false
75
+ $wp_query->is_home = false;
76
+
77
+ // run custom AJAX action
78
+ do_action( self::ENDPOINT . $action );
79
+
80
+ // bye
81
+ die();
82
+
83
+ }
84
+ }
85
  }
src/AjaxHandler.php CHANGED
@@ -1,287 +1,287 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit;
5
- } // Exit if accessed directly
6
-
7
- /**
8
- * DLM_Ajax_Handler class.
9
- */
10
- class DLM_Ajax_Handler {
11
-
12
- /**
13
- * __construct function.
14
- *
15
- * @access public
16
- */
17
- public function __construct() {
18
- add_action( 'wp_ajax_download_monitor_remove_file', array( $this, 'remove_file' ) );
19
- add_action( 'wp_ajax_download_monitor_add_file', array( $this, 'add_file' ) );
20
- add_action( 'wp_ajax_download_monitor_list_files', array( $this, 'list_files' ) );
21
- add_action( 'wp_ajax_download_monitor_insert_panel_upload', array( $this, 'insert_panel_upload' ) );
22
- add_action( 'wp_ajax_dlm_settings_lazy_select', array( $this, 'handle_settings_lazy_select' ) );
23
- add_action( 'wp_ajax_dlm_extension', array( $this, 'handle_extensions' ) );
24
- add_action( 'wp_ajax_dlm_dismiss_notice', array( $this, 'dismiss_notice' ) );
25
- }
26
-
27
- /**
28
- * insert_panel_upload function.
29
- *
30
- * @access public
31
- * @return void
32
- */
33
- public function insert_panel_upload() {
34
-
35
- check_ajax_referer( 'file-upload' );
36
-
37
- // Check user rights
38
- if ( ! current_user_can( 'manage_downloads' ) ) {
39
- die();
40
- }
41
-
42
- require_once( ABSPATH . 'wp-admin/includes/image.php' );
43
- require_once( ABSPATH . 'wp-admin/includes/file.php' );
44
- require_once( ABSPATH . 'wp-admin/includes/media.php' );
45
-
46
- $attachment_id = media_handle_upload( 'async-upload', 0 );
47
-
48
- if ( ! is_wp_error( $attachment_id ) ) {
49
- $attachment_url = wp_get_attachment_url( $attachment_id );
50
-
51
- if ( false !== $attachment_url ) {
52
- echo esc_url( $attachment_url );
53
- }
54
- }
55
-
56
- die();
57
- }
58
-
59
- /**
60
- * remove_file function.
61
- *
62
- * @access public
63
- * @return void
64
- */
65
- public function remove_file() {
66
-
67
- check_ajax_referer( 'remove-file', 'security' );
68
-
69
- // Check user rights
70
- if ( ! current_user_can( 'manage_downloads' ) ) {
71
- die();
72
- }
73
-
74
- if ( ! isset( $_POST['file_id'] ) ) {
75
- die();
76
- }
77
-
78
- $file = get_post( intval( $_POST['file_id'] ) );
79
-
80
- if ( $file && $file->post_type == "dlm_download_version" ) {
81
- // clear transient
82
- download_monitor()->service( 'transient_manager' )->clear_versions_transient( $file->post_parent );
83
-
84
- wp_delete_post( $file->ID );
85
- }
86
-
87
- die();
88
- }
89
-
90
- /**
91
- * add_file function.
92
- *
93
- * @access public
94
- * @return void
95
- */
96
- public function add_file() {
97
-
98
- // check nonce
99
- check_ajax_referer( 'add-file', 'security' );
100
-
101
- // Check user rights
102
- if ( ! current_user_can( 'manage_downloads' ) ) {
103
- die();
104
- }
105
-
106
- // get POST data
107
- $download_id = isset( $_POST['post_id'] ) ? absint( $_POST['post_id'] ) : 0;
108
- $size = isset( $_POST['size'] ) ? absint( $_POST['size'] ) : 0;
109
-
110
- /** @var DLM_Download_Version $new_version */
111
- $new_version = new DLM_Download_Version();
112
-
113
- // set download id
114
- $new_version->set_download_id( $download_id );
115
-
116
- // set other version data
117
- $new_version->set_author( get_current_user_id() );
118
- $new_version->set_date( new DateTime( current_time( 'mysql' ) ) );
119
-
120
- // persist new version
121
- download_monitor()->service( 'version_repository' )->persist( $new_version );
122
-
123
- // clear download transient
124
- download_monitor()->service( 'transient_manager' )->clear_versions_transient( $download_id );
125
-
126
- // output new version admin html
127
- download_monitor()->service( 'view_manager' )->display( 'meta-box/version', array(
128
- 'version_increment' => $size,
129
- 'file_id' => $new_version->get_id(),
130
- 'file_version' => $new_version->get_version(),
131
- 'file_post_date' => $new_version->get_date(),
132
- 'file_download_count' => $new_version->get_download_count(),
133
- 'file_urls' => $new_version->get_mirrors(),
134
- 'version' => $new_version
135
- ) );
136
-
137
- die();
138
- }
139
-
140
- /**
141
- * list_files function.
142
- *
143
- * @access public
144
- * @return void
145
- */
146
- public function list_files() {
147
-
148
- // Check Nonce
149
- check_ajax_referer( 'list-files', 'security' );
150
-
151
- // Check user rights
152
- if ( ! current_user_can( 'manage_downloads' ) ) {
153
- die();
154
- }
155
-
156
- if ( ! isset( $_POST['path'] ) ) {
157
- die();
158
- }
159
-
160
- $path = sanitize_text_field( wp_unslash( $_POST['path'] ) );
161
-
162
- // List all files
163
- $files = download_monitor()->service( 'file_manager' )->list_files( $path );
164
-
165
- foreach ( $files as $found_file ) {
166
-
167
- // Multi-byte-safe pathinfo
168
- $file = download_monitor()->service( 'file_manager' )->mb_pathinfo( $found_file['path'] );
169
-
170
- if ( $found_file['type'] == 'folder' ) {
171
-
172
- echo '<li><a href="#" class="folder" data-path="' . esc_attr( trailingslashit( $file['dirname'] ) ) . esc_attr( $file['basename'] ) . '">' . esc_attr( $file['basename'] ) . '</a></li>';
173
-
174
- } else {
175
-
176
- $filename = $file['basename'];
177
- $extension = ( empty( $file['extension'] ) ) ? '' : $file['extension'];
178
-
179
- if ( substr( $filename, 0, 1 ) == '.' ) {
180
- continue;
181
- } // Ignore files starting with . like htaccess
182
- if ( in_array( $extension, array( '', 'php', 'html', 'htm', 'tmp' ) ) ) {
183
- continue;
184
- } // Ignored file types
185
-
186
- echo '<li><a href="#" class="file filetype-' . esc_attr( sanitize_title( $extension ) ) . '" data-path="' . esc_attr( trailingslashit( $file['dirname'] ) ) . esc_attr( $file['basename'] ) . '">' . esc_attr( $file['basename'] ) . '</a></li>';
187
-
188
- }
189
-
190
- }
191
-
192
- die();
193
- }
194
-
195
- /**
196
- * Handle notice dismissal
197
- */
198
- public function dismiss_notice() {
199
-
200
- // check notice
201
- if ( ! isset( $_POST['notice'] ) || empty( $_POST['notice'] ) ) {
202
- exit;
203
- }
204
-
205
- // the notice
206
- $notice = sanitize_text_field( wp_unslash($_POST['notice']) );
207
-
208
- // check nonce
209
- check_ajax_referer( 'dlm_hide_notice-' . $notice, 'nonce' );
210
-
211
- // update option
212
- update_option( 'dlm_hide_notice-' . $notice, 1 );
213
-
214
- // send JSON
215
- wp_send_json( array( 'response' => 'success' ) );
216
- }
217
-
218
- /**
219
- * Handle lazy select AJAX calls
220
- */
221
- public function handle_settings_lazy_select() {
222
-
223
- // check nonce
224
- check_ajax_referer( 'dlm-settings-lazy-select-nonce', 'nonce' );
225
-
226
- if ( ! isset( $_POST['option'] ) ) {
227
- wp_send_json_error();
228
- exit;
229
- }
230
-
231
- // settings key
232
- $option_key = sanitize_text_field( wp_unslash($_POST['option']) );
233
-
234
- // get options
235
- $options = apply_filters( 'dlm_settings_lazy_select_'.$option_key, array() );
236
-
237
- // send options
238
- wp_send_json( $options );
239
- exit;
240
-
241
- }
242
-
243
- /**
244
- * Handle extensions AJAX
245
- */
246
- public function handle_extensions() {
247
-
248
- // Check nonce
249
- check_ajax_referer( 'dlm-ajax-nonce', 'nonce' );
250
-
251
- // Post vars
252
- $product_id = isset( $_POST['product_id'] ) ? sanitize_text_field( wp_unslash($_POST['product_id']) ) : 0;
253
- $key = isset( $_POST['key'] ) ? sanitize_text_field( wp_unslash($_POST['key']) ) : '';
254
- $email = isset( $_POST['email'] ) ? sanitize_text_field( wp_unslash($_POST['email']) ) : '';
255
- $extension_action = isset( $_POST['extension_action'] ) ? sanitize_text_field( wp_unslash($_POST['extension_action']) ) : 'activate';
256
-
257
- // Get products
258
- $products = DLM_Product_Manager::get()->get_products();
259
-
260
- // Check if product exists
261
- $response = "";
262
- if ( isset( $products[ $product_id ] ) ) {
263
-
264
- // Get correct product
265
- /** @var DLM_Product $product */
266
- $product = $products[ $product_id ];
267
-
268
- // Set new key in license object
269
- $product->get_license()->set_key( $key );
270
-
271
- // Set new email in license object
272
- $product->get_license()->set_email( $email );
273
-
274
- if ( 'activate' === $extension_action ) {
275
- // Try to activate the license
276
- $response = $product->activate();
277
- } else {
278
- // Try to deactivate the license
279
- $response = $product->deactivate();
280
- }
281
-
282
- }
283
-
284
- // Send JSON
285
- wp_send_json( $response );
286
- }
287
  }
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ } // Exit if accessed directly
6
+
7
+ /**
8
+ * DLM_Ajax_Handler class.
9
+ */
10
+ class DLM_Ajax_Handler {
11
+
12
+ /**
13
+ * __construct function.
14
+ *
15
+ * @access public
16
+ */
17
+ public function __construct() {
18
+ add_action( 'wp_ajax_download_monitor_remove_file', array( $this, 'remove_file' ) );
19
+ add_action( 'wp_ajax_download_monitor_add_file', array( $this, 'add_file' ) );
20
+ add_action( 'wp_ajax_download_monitor_list_files', array( $this, 'list_files' ) );
21
+ add_action( 'wp_ajax_download_monitor_insert_panel_upload', array( $this, 'insert_panel_upload' ) );
22
+ add_action( 'wp_ajax_dlm_settings_lazy_select', array( $this, 'handle_settings_lazy_select' ) );
23
+ add_action( 'wp_ajax_dlm_extension', array( $this, 'handle_extensions' ) );
24
+ add_action( 'wp_ajax_dlm_dismiss_notice', array( $this, 'dismiss_notice' ) );
25
+ }
26
+
27
+ /**
28
+ * insert_panel_upload function.
29
+ *
30
+ * @access public
31
+ * @return void
32
+ */
33
+ public function insert_panel_upload() {
34
+
35
+ check_ajax_referer( 'file-upload' );
36
+
37
+ // Check user rights
38
+ if ( ! current_user_can( 'manage_downloads' ) ) {
39
+ die();
40
+ }
41
+
42
+ require_once( ABSPATH . 'wp-admin/includes/image.php' );
43
+ require_once( ABSPATH . 'wp-admin/includes/file.php' );
44
+ require_once( ABSPATH . 'wp-admin/includes/media.php' );
45
+
46
+ $attachment_id = media_handle_upload( 'async-upload', 0 );
47
+
48
+ if ( ! is_wp_error( $attachment_id ) ) {
49
+ $attachment_url = wp_get_attachment_url( $attachment_id );
50
+
51
+ if ( false !== $attachment_url ) {
52
+ echo esc_url( $attachment_url );
53
+ }
54
+ }
55
+
56
+ die();
57
+ }
58
+
59
+ /**
60
+ * remove_file function.
61
+ *
62
+ * @access public
63
+ * @return void
64
+ */
65
+ public function remove_file() {
66
+
67
+ check_ajax_referer( 'remove-file', 'security' );
68
+
69
+ // Check user rights
70
+ if ( ! current_user_can( 'manage_downloads' ) ) {
71
+ die();
72
+ }
73
+
74
+ if ( ! isset( $_POST['file_id'] ) ) {
75
+ die();
76
+ }
77
+
78
+ $file = get_post( intval( $_POST['file_id'] ) );
79
+
80
+ if ( $file && $file->post_type == "dlm_download_version" ) {
81
+ // clear transient
82
+ download_monitor()->service( 'transient_manager' )->clear_versions_transient( $file->post_parent );
83
+
84
+ wp_delete_post( $file->ID );
85
+ }
86
+
87
+ die();
88
+ }
89
+
90
+ /**
91
+ * add_file function.
92
+ *
93
+ * @access public
94
+ * @return void
95
+ */
96
+ public function add_file() {
97
+
98
+ // check nonce
99
+ check_ajax_referer( 'add-file', 'security' );
100
+
101
+ // Check user rights
102
+ if ( ! current_user_can( 'manage_downloads' ) ) {
103
+ die();
104
+ }
105
+
106
+ // get POST data
107
+ $download_id = isset( $_POST['post_id'] ) ? absint( $_POST['post_id'] ) : 0;
108
+ $size = isset( $_POST['size'] ) ? absint( $_POST['size'] ) : 0;
109
+
110
+ /** @var DLM_Download_Version $new_version */
111
+ $new_version = new DLM_Download_Version();
112
+
113
+ // set download id
114
+ $new_version->set_download_id( $download_id );
115
+
116
+ // set other version data
117
+ $new_version->set_author( get_current_user_id() );
118
+ $new_version->set_date( new DateTime( current_time( 'mysql' ) ) );
119
+
120
+ // persist new version
121
+ download_monitor()->service( 'version_repository' )->persist( $new_version );
122
+
123
+ // clear download transient
124
+ download_monitor()->service( 'transient_manager' )->clear_versions_transient( $download_id );
125
+
126
+ // output new version admin html
127
+ download_monitor()->service( 'view_manager' )->display( 'meta-box/version', array(
128
+ 'version_increment' => $size,
129
+ 'file_id' => $new_version->get_id(),
130
+ 'file_version' => $new_version->get_version(),
131
+ 'file_post_date' => $new_version->get_date(),
132
+ 'file_download_count' => $new_version->get_download_count(),
133
+ 'file_urls' => $new_version->get_mirrors(),
134
+ 'version' => $new_version
135
+ ) );
136
+
137
+ die();
138
+ }
139
+
140
+ /**
141
+ * list_files function.
142
+ *
143
+ * @access public
144
+ * @return void
145
+ */
146
+ public function list_files() {
147
+
148
+ // Check Nonce
149
+ check_ajax_referer( 'list-files', 'security' );
150
+
151
+ // Check user rights
152
+ if ( ! current_user_can( 'manage_downloads' ) ) {
153
+ die();
154
+ }
155
+
156
+ if ( ! isset( $_POST['path'] ) ) {
157
+ die();
158
+ }
159
+
160
+ $path = sanitize_text_field( wp_unslash( $_POST['path'] ) );
161
+
162
+ // List all files
163
+ $files = download_monitor()->service( 'file_manager' )->list_files( $path );
164
+
165
+ foreach ( $files as $found_file ) {
166
+
167
+ // Multi-byte-safe pathinfo
168
+ $file = download_monitor()->service( 'file_manager' )->mb_pathinfo( $found_file['path'] );
169
+
170
+ if ( $found_file['type'] == 'folder' ) {
171
+
172
+ echo '<li><a href="#" class="folder" data-path="' . esc_attr( trailingslashit( $file['dirname'] ) ) . esc_attr( $file['basename'] ) . '">' . esc_attr( $file['basename'] ) . '</a></li>';
173
+
174
+ } else {
175
+
176
+ $filename = $file['basename'];
177
+ $extension = ( empty( $file['extension'] ) ) ? '' : $file['extension'];
178
+
179
+ if ( substr( $filename, 0, 1 ) == '.' ) {
180
+ continue;
181
+ } // Ignore files starting with . like htaccess
182
+ if ( in_array( $extension, array( '', 'php', 'html', 'htm', 'tmp' ) ) ) {
183
+ continue;
184
+ } // Ignored file types
185
+
186
+ echo '<li><a href="#" class="file filetype-' . esc_attr( sanitize_title( $extension ) ) . '" data-path="' . esc_attr( trailingslashit( $file['dirname'] ) ) . esc_attr( $file['basename'] ) . '">' . esc_attr( $file['basename'] ) . '</a></li>';
187
+
188
+ }
189
+
190
+ }
191
+
192
+ die();
193
+ }
194
+
195
+ /**
196
+ * Handle notice dismissal
197
+ */
198
+ public function dismiss_notice() {
199
+
200
+ // check notice
201
+ if ( ! isset( $_POST['notice'] ) || empty( $_POST['notice'] ) ) {
202
+ exit;
203
+ }
204
+
205
+ // the notice
206
+ $notice = sanitize_text_field( wp_unslash($_POST['notice']) );
207
+
208
+ // check nonce
209
+ check_ajax_referer( 'dlm_hide_notice-' . $notice, 'nonce' );
210
+
211
+ // update option
212
+ update_option( 'dlm_hide_notice-' . $notice, 1 );
213
+
214
+ // send JSON
215
+ wp_send_json( array( 'response' => 'success' ) );
216
+ }
217
+
218
+ /**
219
+ * Handle lazy select AJAX calls
220
+ */
221
+ public function handle_settings_lazy_select() {
222
+
223
+ // check nonce
224
+ check_ajax_referer( 'dlm-settings-lazy-select-nonce', 'nonce' );
225
+
226
+ if ( ! isset( $_POST['option'] ) ) {
227
+ wp_send_json_error();
228
+ exit;
229
+ }
230
+
231
+ // settings key
232
+ $option_key = sanitize_text_field( wp_unslash($_POST['option']) );
233
+
234
+ // get options
235
+ $options = apply_filters( 'dlm_settings_lazy_select_'.$option_key, array() );
236
+
237
+ // send options
238
+ wp_send_json( $options );
239
+ exit;
240
+
241
+ }
242
+
243
+ /**
244
+ * Handle extensions AJAX
245
+ */
246
+ public function handle_extensions() {
247
+
248
+ // Check nonce
249
+ check_ajax_referer( 'dlm-ajax-nonce', 'nonce' );
250
+
251
+ // Post vars
252
+ $product_id = isset( $_POST['product_id'] ) ? sanitize_text_field( wp_unslash($_POST['product_id']) ) : 0;
253
+ $key = isset( $_POST['key'] ) ? sanitize_text_field( wp_unslash($_POST['key']) ) : '';
254
+ $email = isset( $_POST['email'] ) ? sanitize_text_field( wp_unslash($_POST['email']) ) : '';
255
+ $extension_action = isset( $_POST['extension_action'] ) ? sanitize_text_field( wp_unslash($_POST['extension_action']) ) : 'activate';
256
+
257
+ // Get products
258
+ $products = DLM_Product_Manager::get()->get_products();
259
+
260
+ // Check if product exists
261
+ $response = "";
262
+ if ( isset( $products[ $product_id ] ) ) {
263
+
264
+ // Get correct product
265
+ /** @var DLM_Product $product */
266
+ $product = $products[ $product_id ];
267
+
268
+ // Set new key in license object
269
+ $product->get_license()->set_key( $key );
270
+
271
+ // Set new email in license object
272
+ $product->get_license()->set_email( $email );
273
+
274
+ if ( 'activate' === $extension_action ) {
275
+ // Try to activate the license
276
+ $response = $product->activate();
277
+ } else {
278
+ // Try to deactivate the license
279
+ $response = $product->deactivate();
280
+ }
281
+
282
+ }
283
+
284
+ // Send JSON
285
+ wp_send_json( $response );
286
+ }
287
  }
src/Constants.php CHANGED
@@ -1,16 +1,16 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit;
5
- } // Exit if accessed directly
6
-
7
- class DLM_Constants {
8
-
9
- const OPTION_CURRENT_VERSION = 'dlm_current_version';
10
-
11
- const LU_OPTION_NEEDS_UPGRADING = "dlm_lu_needs_upgrading";
12
- const LU_OPTION_UPGRADED = "dlm_lu_upgraded";
13
- const LU_OPTION_DOWNLOAD_QUEUE_BUILD = "dlm_lu_download_queue_build";
14
- const LU_OPTION_CONTENT_QUEUE_BUILD = "dlm_lu_content_queue_build";
15
-
16
  }
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ } // Exit if accessed directly
6
+
7
+ class DLM_Constants {
8
+
9
+ const OPTION_CURRENT_VERSION = 'dlm_current_version';
10
+
11
+ const LU_OPTION_NEEDS_UPGRADING = "dlm_lu_needs_upgrading";
12
+ const LU_OPTION_UPGRADED = "dlm_lu_upgraded";
13
+ const LU_OPTION_DOWNLOAD_QUEUE_BUILD = "dlm_lu_download_queue_build";
14
+ const LU_OPTION_CONTENT_QUEUE_BUILD = "dlm_lu_content_queue_build";
15
+
16
  }
src/CookieManager.php CHANGED
@@ -1,68 +1,68 @@
1
- <?php
2
-
3
- class DLM_Cookie_Manager {
4
-
5
- const KEY = 'wp_dlm_downloading';
6
-
7
- /**
8
- * Check if the cookie is exists for this download & version. If it does exists the requester has requested the exact same download & version in the past minute.
9
- *
10
- * @param DLM_Download $download
11
- *
12
- * @return bool
13
- */
14
- public static function exists( $download ) {
15
- $exists = false;
16
-
17
- // get JSON data
18
- $cdata = self::get_cookie_data();
19
-
20
- // check if no parse errors occurred
21
- if ( null != $cdata && is_array( $cdata ) && ! empty( $cdata ) ) {
22
-
23
- // check in cookie data for download AND version ID
24
- if ( $cdata['download'] == $download->get_id() && $cdata['version'] == $download->get_version()->get_version_number() ) {
25
- $exists = true;
26
- }
27
- }
28
-
29
-
30
- return $exists;
31
- }
32
-
33
- /**
34
- * Get cookie data
35
- *
36
- * @return array|null
37
- */
38
- public static function get_cookie_data() {
39
- $cdata = null;
40
- if ( ! empty( $_COOKIE[ self::KEY ] ) ) {
41
- $cdata = json_decode( base64_decode( sanitize_text_field( wp_unslash( $_COOKIE[ self::KEY ] ) ) ), true );
42
- }
43
-
44
- return $cdata;
45
- }
46
-
47
- /**
48
- * Set cookie
49
- *
50
- * @param DLM_Download $download
51
- */
52
- public static function set_cookie( $download ) {
53
-
54
- $cookie_data = apply_filters( 'wp_dlm_set_downloading_cookie', array( 'expires' => time() + 60, 'secure' => false, 'httponly' => true ) );
55
- setcookie(
56
- self::KEY,
57
- base64_encode( json_encode( array(
58
- 'download' => $download->get_id(),
59
- 'version' => $download->get_version()->get_version_number()
60
- ) ) ),
61
- $cookie_data['expires'],
62
- COOKIEPATH,
63
- COOKIE_DOMAIN,
64
- $cookie_data['secure'],
65
- $cookie_data['httponly'] );
66
- }
67
-
68
  }
1
+ <?php
2
+
3
+ class DLM_Cookie_Manager {
4
+
5
+ const KEY = 'wp_dlm_downloading';
6
+
7
+ /**
8
+ * Check if the cookie is exists for this download & version. If it does exists the requester has requested the exact same download & version in the past minute.
9
+ *
10
+ * @param DLM_Download $download
11
+ *
12
+ * @return bool
13
+ */
14
+ public static function exists( $download ) {
15
+ $exists = false;
16
+
17
+ // get JSON data
18
+ $cdata = self::get_cookie_data();
19
+
20
+ // check if no parse errors occurred
21
+ if ( null != $cdata && is_array( $cdata ) && ! empty( $cdata ) ) {
22
+
23
+ // check in cookie data for download AND version ID
24
+ if ( $cdata['download'] == $download->get_id() && $cdata['version'] == $download->get_version()->get_version_number() ) {
25
+ $exists = true;
26
+ }
27
+ }
28
+
29
+
30
+ return $exists;
31
+ }
32
+
33
+ /**
34
+ * Get cookie data
35
+ *
36
+ * @return array|null
37
+ */
38
+ public static function get_cookie_data() {
39
+ $cdata = null;
40
+ if ( ! empty( $_COOKIE[ self::KEY ] ) ) {
41
+ $cdata = json_decode( base64_decode( sanitize_text_field( wp_unslash( $_COOKIE[ self::KEY ] ) ) ), true );
42
+ }
43
+
44
+ return $cdata;
45
+ }
46
+
47
+ /**
48
+ * Set cookie
49
+ *
50
+ * @param DLM_Download $download
51
+ */
52
+ public static function set_cookie( $download ) {
53
+
54
+ $cookie_data = apply_filters( 'wp_dlm_set_downloading_cookie', array( 'expires' => time() + 60, 'secure' => false, 'httponly' => true ) );
55
+ setcookie(
56
+ self::KEY,
57
+ base64_encode( json_encode( array(
58
+ 'download' => $download->get_id(),
59
+ 'version' => $download->get_version()->get_version_number()
60
+ ) ) ),
61
+ $cookie_data['expires'],
62
+ COOKIEPATH,
63
+ COOKIE_DOMAIN,
64
+ $cookie_data['secure'],
65
+ $cookie_data['httponly'] );
66
+ }
67
+
68
  }
src/DebugLogger.php CHANGED
@@ -1,50 +1,50 @@
1
- <?php
2
-
3
- class DLM_Debug_Logger {
4
-
5
- const MSG_PREFIX = "DLM Notice: ";
6
-
7
- /**
8
- * Returns if debugging is enabled
9
- *
10
- * @return bool
11
- */
12
- private static function is_enabled() {
13
- return WP_DEBUG;
14
- }
15
-
16
- /**
17
- * Log debug message
18
- *
19
- * @param string $message
20
- */
21
- public static function log( $message ) {
22
-
23
- // Only continue if enabled
24
- if ( ! self::is_enabled() ) {
25
- return;
26
- }
27
-
28
- error_log( self::MSG_PREFIX . $message, 0 );
29
-
30
- }
31
-
32
- /**
33
- * Log deprecated warning
34
- *
35
- * @param string $method
36
- */
37
- public static function deprecated( $method ) {
38
-
39
- // Only continue if enabled
40
- if ( ! self::is_enabled() ) {
41
- return;
42
- }
43
-
44
- // Debug message
45
- $message = 'Deprecated method called: ' . $method;
46
-
47
- error_log( self::MSG_PREFIX . $message, 0 );
48
- }
49
-
50
  }
1
+ <?php
2
+
3
+ class DLM_Debug_Logger {
4
+
5
+ const MSG_PREFIX = "DLM Notice: ";
6
+
7
+ /**
8
+ * Returns if debugging is enabled
9
+ *
10
+ * @return bool
11
+ */
12
+ private static function is_enabled() {
13
+ return WP_DEBUG;
14
+ }
15
+
16
+ /**
17
+ * Log debug message
18
+ *
19
+ * @param string $message
20
+ */
21
+ public static function log( $message ) {
22
+
23
+ // Only continue if enabled
24
+ if ( ! self::is_enabled() ) {
25
+ return;
26
+ }
27
+
28
+ error_log( self::MSG_PREFIX . $message, 0 );
29
+
30
+ }
31
+
32
+ /**
33
+ * Log deprecated warning
34
+ *
35
+ * @param string $method
36
+ */
37
+ public static function deprecated( $method ) {
38
+
39
+ // Only continue if enabled
40
+ if ( ! self::is_enabled() ) {
41
+ return;
42
+ }
43
+
44
+ // Debug message
45
+ $message = 'Deprecated method called: ' . $method;
46
+
47
+ error_log( self::MSG_PREFIX . $message, 0 );
48
+ }
49
+
50
  }
src/DownloadHandler.php CHANGED
@@ -225,7 +225,7 @@ class DLM_Download_Handler {
225
  }
226
 
227
  // check if need to handle an actual download
228
- if ( ! empty( $wp->query_vars[ $this->endpoint ] ) && ( ( null === $wp->request ) || ( null !== $wp->request && strstr( $wp->request, $this->endpoint . '/' ) ) ) ) {
229
 
230
  // Prevent caching when endpoint is set
231
  if ( ! defined( 'DONOTCACHEPAGE' ) ) {
225
  }
226
 
227
  // check if need to handle an actual download
228
+ if ( ! empty( $wp->query_vars[ $this->endpoint ] ) && ( ( null === $wp->request ) || ( '' === $wp->request ) || ( strstr( $wp->request, $this->endpoint . '/' ) ) ) ) {
229
 
230
  // Prevent caching when endpoint is set
231
  if ( ! defined( 'DONOTCACHEPAGE' ) ) {
src/DownloadNoAccessPageEndpoint.php CHANGED
@@ -1,41 +1,41 @@
1
- <?php
2
-
3
- class DLM_Download_No_Access_Page_Endpoint {
4
-
5
- private $endpoint = 'download-id';
6
-
7
- /**
8
- * Setup no access page
9
- */
10
- public function setup() {
11
- // add query var and enpoint
12
- add_filter( 'query_vars', array( $this, 'add_query_vars' ), 0 );
13
- add_action( 'init', array( $this, 'add_endpoint' ), 0 );
14
- }
15
-
16
- /**
17
- * add_query_vars function.
18
- *
19
- * @access public
20
- *
21
- * @param array $vars
22
- *
23
- * @return array
24
- */
25
- public function add_query_vars( $vars ) {
26
- $vars[] = $this->endpoint;
27
-
28
- return $vars;
29
- }
30
-
31
- /**
32
- * add_endpoint function.
33
- *
34
- * @access public
35
- * @return void
36
- */
37
- public function add_endpoint() {
38
- add_rewrite_endpoint( $this->endpoint, EP_ALL );
39
- }
40
-
41
  }
1
+ <?php
2
+
3
+ class DLM_Download_No_Access_Page_Endpoint {
4
+
5
+ private $endpoint = 'download-id';
6
+
7
+ /**
8
+ * Setup no access page
9
+ */
10
+ public function setup() {
11
+ // add query var and enpoint
12
+ add_filter( 'query_vars', array( $this, 'add_query_vars' ), 0 );
13
+ add_action( 'init', array( $this, 'add_endpoint' ), 0 );
14
+ }
15
+
16
+ /**
17
+ * add_query_vars function.
18
+ *
19
+ * @access public
20
+ *
21
+ * @param array $vars
22
+ *
23
+ * @return array
24
+ */
25
+ public function add_query_vars( $vars ) {
26
+ $vars[] = $this->endpoint;
27
+
28
+ return $vars;
29
+ }
30
+
31
+ /**
32
+ * add_endpoint function.
33
+ *
34
+ * @access public
35
+ * @return void
36
+ */
37
+ public function add_endpoint() {
38
+ add_rewrite_endpoint( $this->endpoint, EP_ALL );
39
+ }
40
+
41
  }
src/DownloadPreview/Config.php CHANGED
@@ -1,49 +1,49 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit;
5
- } // Exit if accessed directly
6
-
7
- class DLM_DownloadPreview_Config {
8
-
9
- /** @var DLM_Download */
10
- private $download = null;
11
-
12
- /** @var string */
13
- private $template = "";
14
-
15
- /**
16
- * @return DLM_Download
17
- */
18
- public function get_download() {
19
- return $this->download;
20
- }
21
-
22
- /**
23
- * @param DLM_Download $download
24
- */
25
- public function set_download( $download ) {
26
- $this->download = $download;
27
- }
28
-
29
- /**
30
- * @return string
31
- */
32
- public function get_template() {
33
-
34
- if ( "settings" == $this->template ) {
35
- $this->template = dlm_get_default_download_template();
36
- }
37
-
38
- return $this->template;
39
- }
40
-
41
- /**
42
- * @param string $template
43
- */
44
- public function set_template( $template ) {
45
- $this->template = $template;
46
- }
47
-
48
-
49
  }
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ } // Exit if accessed directly
6
+
7
+ class DLM_DownloadPreview_Config {
8
+
9
+ /** @var DLM_Download */
10
+ private $download = null;
11
+
12
+ /** @var string */
13
+ private $template = "";
14
+
15
+ /**
16
+ * @return DLM_Download
17
+ */
18
+ public function get_download() {
19
+ return $this->download;
20
+ }
21
+
22
+ /**
23
+ * @param DLM_Download $download
24
+ */
25
+ public function set_download( $download ) {
26
+ $this->download = $download;
27
+ }
28
+
29
+ /**
30
+ * @return string
31
+ */
32
+ public function get_template() {
33
+
34
+ if ( "settings" == $this->template ) {
35
+ $this->template = dlm_get_default_download_template();
36
+ }
37
+
38
+ return $this->template;
39
+ }
40
+
41
+ /**
42
+ * @param string $template
43
+ */
44
+ public function set_template( $template ) {
45
+ $this->template = $template;
46
+ }
47
+
48
+
49
  }
src/DownloadPreview/Preview.php CHANGED
@@ -1,112 +1,112 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit;
5
- } // Exit if accessed directly
6
-
7
- class DLM_DownloadPreview_Preview {
8
-
9
- /**
10
- * Setup the preview hooks
11
- */
12
- public function setup() {
13
- add_action( 'template_redirect', array( $this, 'catch_preview_request' ), 999 );
14
- }
15
-
16
- /**
17
- * This method will setup a new DLM_DownloadPreview_Config object based on parameters in the URL ($_GET)
18
- *
19
- * @return DLM_DownloadPreview_Config
20
- */
21
- private function get_config_from_url() {
22
-
23
-
24
- $config = new DLM_DownloadPreview_Config();
25
-
26
- if ( isset( $_GET['download_id'] ) ) {
27
-
28
- try {
29
- /** @var DLM_Download $download */
30
- $download = download_monitor()->service( 'download_repository' )->retrieve_single( absint( $_GET['download_id'] ) );
31
-
32
-
33
- if ( isset( $_GET['version_id'] ) ) {
34
-
35
- try {
36
- /** @var DLM_Download_Version $version */
37
- $version = download_monitor()->service( 'version_repository' )->retrieve_single( absint( $_GET['version_id'] ) );
38
- $download->set_version( $version );
39
- } catch ( Exception $exception ) {
40
- // no version found, don't do anything.
41
- }
42
- }
43
-
44
- $config->set_download( $download );
45
-
46
-
47
- } catch ( Exception $exception ) {
48
- // no download found, don't do anything.
49
- }
50
- }
51
-
52
- if ( isset( $_GET['template'] ) ) {
53
- $config->set_template( sanitize_text_field( wp_unslash( $_GET['template'] ) ));
54
- }
55
-
56
- if ( isset( $_GET['custom_template'] ) ) {
57
- $config->set_template( sanitize_text_field( wp_unslash( $_GET['custom_template'] ) ) );
58
- }
59
-
60
- return $config;
61
- }
62
-
63
- /**
64
- * Output the button preview HTML
65
- */
66
- private function output_html() {
67
- echo '<!DOCTYPE html>
68
- <html lang="en-US" class="no-js">
69
- <head>';
70
- do_action( 'wp_head' );
71
- echo '</head>
72
- <body><table><tr><td valign="middle"><div id="dlmPreviewContainer">';
73
-
74
-
75
- $config = $this->get_config_from_url();
76
-
77
- if ( $config->get_download() != null ) {
78
-
79
- $template_handler = new DLM_Template_Handler();
80
-
81
- $template_handler->get_template_part( 'content-download', $config->get_template(), '', array( 'dlm_download' => $config->get_download() ) );
82
-
83
- } else {
84
- echo "<p>" . esc_html__( "Select a download first", 'download-monitor' ) . "</p>";
85
- }
86
-
87
- echo '</div></td></tr></table></body>
88
- </html>';
89
- }
90
-
91
-
92
- /**
93
- * Catch the preview request. Setup custom HTML but output WordPress head part.
94
- */
95
- public function catch_preview_request() {
96
- // check if this is a buttons preview request
97
- if ( isset( $_GET['dlm_gutenberg_download_preview'] ) ) {
98
-
99
- if ( ! current_user_can( 'edit_posts' ) ) {
100
- return;
101
- }
102
-
103
- // remove the admin bar styling
104
- remove_action( 'wp_head', '_admin_bar_bump_cb' );
105
-
106
- // it is, output HTML
107
- $this->output_html();
108
- exit;
109
- }
110
-
111
- }
112
  }
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ } // Exit if accessed directly
6
+
7
+ class DLM_DownloadPreview_Preview {
8
+
9
+ /**
10
+ * Setup the preview hooks
11
+ */
12
+ public function setup() {
13
+ add_action( 'template_redirect', array( $this, 'catch_preview_request' ), 999 );
14
+ }
15
+
16
+ /**
17
+ * This method will setup a new DLM_DownloadPreview_Config object based on parameters in the URL ($_GET)
18
+ *
19
+ * @return DLM_DownloadPreview_Config
20
+ */
21
+ private function get_config_from_url() {
22
+
23
+
24
+ $config = new DLM_DownloadPreview_Config();
25
+
26
+ if ( isset( $_GET['download_id'] ) ) {
27
+
28
+ try {
29
+ /** @var DLM_Download $download */
30
+ $download = download_monitor()->service( 'download_repository' )->retrieve_single( absint( $_GET['download_id'] ) );
31
+
32
+
33
+ if ( isset( $_GET['version_id'] ) ) {
34
+
35
+ try {
36
+ /** @var DLM_Download_Version $version */
37
+ $version = download_monitor()->service( 'version_repository' )->retrieve_single( absint( $_GET['version_id'] ) );
38
+ $download->set_version( $version );
39
+ } catch ( Exception $exception ) {
40
+ // no version found, don't do anything.
41
+ }
42
+ }
43
+
44
+ $config->set_download( $download );
45
+
46
+
47
+ } catch ( Exception $exception ) {
48
+ // no download found, don't do anything.
49
+ }
50
+ }
51
+
52
+ if ( isset( $_GET['template'] ) ) {
53
+ $config->set_template( sanitize_text_field( wp_unslash( $_GET['template'] ) ));
54
+ }
55
+
56
+ if ( isset( $_GET['custom_template'] ) ) {
57
+ $config->set_template( sanitize_text_field( wp_unslash( $_GET['custom_template'] ) ) );
58
+ }
59
+
60
+ return $config;
61
+ }
62
+
63
+ /**
64
+ * Output the button preview HTML
65
+ */
66
+ private function output_html() {
67
+ echo '<!DOCTYPE html>
68
+ <html lang="en-US" class="no-js">
69
+ <head>';
70
+ do_action( 'wp_head' );
71
+ echo '</head>
72
+ <body><table><tr><td valign="middle"><div id="dlmPreviewContainer">';
73
+
74
+
75
+ $config = $this->get_config_from_url();
76
+
77
+ if ( $config->get_download() != null ) {
78
+
79
+ $template_handler = new DLM_Template_Handler();
80
+
81
+ $template_handler->get_template_part( 'content-download', $config->get_template(), '', array( 'dlm_download' => $config->get_download() ) );
82
+
83
+ } else {
84
+ echo "<p>" . esc_html__( "Select a download first", 'download-monitor' ) . "</p>";
85
+ }
86
+
87
+ echo '</div></td></tr></table></body>
88
+ </html>';
89
+ }
90
+
91
+
92
+ /**
93
+ * Catch the preview request. Setup custom HTML but output WordPress head part.
94
+ */
95
+ public function catch_preview_request() {
96
+ // check if this is a buttons preview request
97
+ if ( isset( $_GET['dlm_gutenberg_download_preview'] ) ) {
98
+
99
+ if ( ! current_user_can( 'edit_posts' ) ) {
100
+ return;
101
+ }
102
+
103
+ // remove the admin bar styling
104
+ remove_action( 'wp_head', '_admin_bar_bump_cb' );
105
+
106
+ // it is, output HTML
107
+ $this->output_html();
108
+ exit;
109
+ }
110
+
111
+ }
112
  }
src/Hasher.php CHANGED
@@ -1,103 +1,103 @@
1
- <?php
2
-
3
- class DLM_Hasher {
4
-
5
- /**
6
- * Get array with hashes for given file path.
7
- * Array will always contain all hash keys but hash values will only be set if user option for hash is turned on.
8
- *
9
- * @param string $file_path
10
- *
11
- * @return array
12
- */
13
- public function get_file_hashes( $file_path ) {
14
- $md5 = false;
15
- $sha1 = false;
16
- $sha256 = false;
17
- $crc32b = false;
18
-
19
- if ( $file_path ) {
20
- list( $file_path, $remote_file ) = download_monitor()->service( 'file_manager' )->parse_file_path( $file_path );
21
-
22
- if ( ! empty( $file_path ) ) {
23
- if ( ! $remote_file || apply_filters( 'dlm_allow_remote_hash_file', false ) ) {
24
-
25
- if ( $this->is_hash_enabled( 'md5' ) ) {
26
- $md5 = $this->generate_hash( 'md5', $file_path );
27
- }
28
-
29
- if ( $this->is_hash_enabled( 'sha1' ) ) {
30
- $sha1 = $this->generate_hash( 'sha1', $file_path );
31
- }
32
-
33
- if ( $this->is_hash_enabled( 'sha256' ) ) {
34
- $sha256 = $this->generate_hash( 'sha256', $file_path );
35
- }
36
-
37
- if ( $this->is_hash_enabled( 'crc32b' ) ) {
38
- $crc32b = $this->generate_hash( 'crc32b', $file_path );
39
- }
40
-
41
- }
42
- }
43
- }
44
-
45
- return apply_filters( "dlm_file_hashes", array( 'md5' => $md5, 'sha1' => $sha1, 'sha256' => $sha256, 'crc32b' => $crc32b ), $file_path );
46
- }
47
-
48
- /**
49
- * Generate hash of $type for $file_path
50
- *
51
- * @param string $type
52
- * @param string $file_path
53
- *
54
- * @return string
55
- */
56
- public function generate_hash( $type, $file_path ) {
57
- $hash = "";
58
- switch ( $type ) {
59
- case 'md5':
60
- $hash = hash_file( 'md5', $file_path );
61
- break;
62
- case 'sha1':
63
- $hash = hash_file( 'sha1', $file_path );
64
- break;
65
- case 'sha256':
66
- $hash = hash_file( 'sha256', $file_path );
67
- break;
68
- case 'crc32b':
69
- $hash = hash_file( 'crc32b', $file_path );
70
- break;
71
- }
72
-
73
- return $hash;
74
- }
75
-
76
- /**
77
- * Check if generation of given hash $type is enabled
78
- *
79
- * @param string $type
80
- *
81
- * @return bool
82
- */
83
- public function is_hash_enabled( $type ) {
84
- return ( "1" == get_option( 'dlm_generate_hash_' . $type, 0 ) );
85
- }
86
-
87
- /**
88
- * Get available and enabled hashes
89
- *
90
- * @return array
91
- */
92
- public function get_available_hashes() {
93
- $hashes = array( 'md5', 'sha1', 'crc32b', 'sha256' );
94
-
95
- foreach ( $hashes as $hash_key => $hash ) {
96
- if ( ! $this->is_hash_enabled( $hash ) ) {
97
- unset( $hashes[ $hash_key ] );
98
- }
99
- }
100
-
101
- return $hashes;
102
- }
103
  }
1
+ <?php
2
+
3
+ class DLM_Hasher {
4
+
5
+ /**
6
+ * Get array with hashes for given file path.
7
+ * Array will always contain all hash keys but hash values will only be set if user option for hash is turned on.
8
+ *
9
+ * @param string $file_path
10
+ *
11
+ * @return array
12
+ */
13
+ public function get_file_hashes( $file_path ) {
14
+ $md5 = false;
15
+ $sha1 = false;
16
+ $sha256 = false;
17
+ $crc32b = false;
18
+
19
+ if ( $file_path ) {
20
+ list( $file_path, $remote_file ) = download_monitor()->service( 'file_manager' )->parse_file_path( $file_path );
21
+
22
+ if ( ! empty( $file_path ) ) {
23
+ if ( ! $remote_file || apply_filters( 'dlm_allow_remote_hash_file', false ) ) {
24
+
25
+ if ( $this->is_hash_enabled( 'md5' ) ) {
26
+ $md5 = $this->generate_hash( 'md5', $file_path );
27
+ }
28
+
29
+ if ( $this->is_hash_enabled( 'sha1' ) ) {
30
+ $sha1 = $this->generate_hash( 'sha1', $file_path );
31
+ }
32
+
33
+ if ( $this->is_hash_enabled( 'sha256' ) ) {
34
+ $sha256 = $this->generate_hash( 'sha256', $file_path );
35
+ }
36
+
37
+ if ( $this->is_hash_enabled( 'crc32b' ) ) {
38
+ $crc32b = $this->generate_hash( 'crc32b', $file_path );
39
+ }
40
+
41
+ }
42
+ }
43
+ }
44
+
45
+ return apply_filters( "dlm_file_hashes", array( 'md5' => $md5, 'sha1' => $sha1, 'sha256' => $sha256, 'crc32b' => $crc32b ), $file_path );
46
+ }
47
+
48
+ /**
49
+ * Generate hash of $type for $file_path
50
+ *
51
+ * @param string $type
52
+ * @param string $file_path
53
+ *
54
+ * @return string
55
+ */
56
+ public function generate_hash( $type, $file_path ) {
57
+ $hash = "";
58
+ switch ( $type ) {
59
+ case 'md5':
60
+ $hash = hash_file( 'md5', $file_path );
61
+ break;
62
+ case 'sha1':
63
+ $hash = hash_file( 'sha1', $file_path );
64
+ break;
65
+ case 'sha256':
66
+ $hash = hash_file( 'sha256', $file_path );
67
+ break;
68
+ case 'crc32b':
69
+ $hash = hash_file( 'crc32b', $file_path );
70
+ break;
71
+ }
72
+
73
+ return $hash;
74
+ }
75
+
76
+ /**
77
+ * Check if generation of given hash $type is enabled
78
+ *
79
+ * @param string $type
80
+ *
81
+ * @return bool
82
+ */
83
+ public function is_hash_enabled( $type ) {
84
+ return ( "1" == get_option( 'dlm_generate_hash_' . $type, 0 ) );
85
+ }
86
+
87
+ /**
88
+ * Get available and enabled hashes
89
+ *
90
+ * @return array
91
+ */
92
+ public function get_available_hashes() {
93
+ $hashes = array( 'md5', 'sha1', 'crc32b', 'sha256' );
94
+
95
+ foreach ( $hashes as $hash_key => $hash ) {
96
+ if ( ! $this->is_hash_enabled( $hash ) ) {
97
+ unset( $hashes[ $hash_key ] );
98
+ }
99
+ }
100
+
101
+ return $hashes;
102
+ }
103
  }
src/Integrations/PostTypesOrder.php CHANGED
@@ -1,21 +1,21 @@
1
- <?php
2
-
3
- class DLM_Integrations_PostTypesOrder {
4
-
5
- /**
6
- * Setup integration
7
- */
8
- public function setup() {
9
- add_filter( 'dlm_admin_dashboard_popular_downloads_filters', array( $this, 'ignore_popular_downloads_order' ), 10, 2 );
10
- }
11
-
12
- /**
13
- * @param $filters
14
- *
15
- * @return array
16
- */
17
- public function ignore_popular_downloads_order($filters) {
18
- $filters['ignore_custom_sort'] = true;
19
- return $filters;
20
- }
21
  }
1
+ <?php
2
+
3
+ class DLM_Integrations_PostTypesOrder {
4
+
5
+ /**
6
+ * Setup integration
7
+ */
8
+ public function setup() {
9
+ add_filter( 'dlm_admin_dashboard_popular_downloads_filters', array( $this, 'ignore_popular_downloads_order' ), 10, 2 );
10
+ }
11
+
12
+ /**
13
+ * @param $filters
14
+ *
15
+ * @return array
16
+ */
17
+ public function ignore_popular_downloads_order($filters) {
18
+ $filters['ignore_custom_sort'] = true;
19
+ return $filters;
20
+ }
21
  }
src/Integrations/YoastSEO.php CHANGED
@@ -1,27 +1,27 @@
1
- <?php
2
-
3
- class DLM_Integrations_YoastSEO {
4
-
5
- /**
6
- * Setup integration
7
- */
8
- public function setup() {
9
- add_filter( 'wpseo_sitemap_exclude_taxonomy', array( $this, 'exclude_taxonomies' ), 10, 2 );
10
- }
11
-
12
- /**
13
- * Exclude our categories from YoastSEO sitemap
14
- *
15
- * @param $is_excluded
16
- * @param $taxonomy_name
17
- *
18
- * @return bool
19
- */
20
- public function exclude_taxonomies( $is_excluded, $taxonomy_name ) {
21
- if ( "dlm_download_category" == $taxonomy_name || "dlm_download_tag" == $taxonomy_name ) {
22
- $is_excluded = true;
23
- }
24
-
25
- return $is_excluded;
26
- }
27
  }
1
+ <?php
2
+
3
+ class DLM_Integrations_YoastSEO {
4
+
5
+ /**
6
+ * Setup integration
7
+ */
8
+ public function setup() {
9
+ add_filter( 'wpseo_sitemap_exclude_taxonomy', array( $this, 'exclude_taxonomies' ), 10, 2 );
10
+ }
11
+
12
+ /**
13
+ * Exclude our categories from YoastSEO sitemap
14
+ *
15
+ * @param $is_excluded
16
+ * @param $taxonomy_name
17
+ *
18
+ * @return bool
19
+ */
20
+ public function exclude_taxonomies( $is_excluded, $taxonomy_name ) {
21
+ if ( "dlm_download_category" == $taxonomy_name || "dlm_download_tag" == $taxonomy_name ) {
22
+ $is_excluded = true;
23
+ }
24
+
25
+ return $is_excluded;
26
+ }
27
  }
src/LegacyUpgrader/Ajax.php CHANGED
@@ -1,158 +1,158 @@
1
- <?php
2
-
3
- class DLM_LU_Ajax {
4
-
5
- /**
6
- * Setup AJAX report hooks
7
- */
8
- public function setup() {
9
- add_action( 'wp_ajax_dlm_lu_get_download_queue', array( $this, 'handle_get_download_queue' ) );
10
- add_action( 'wp_ajax_dlm_lu_get_content_queue', array( $this, 'handle_get_content_queue' ) );
11
- add_action( 'wp_ajax_dlm_lu_upgrade_download', array( $this, 'handle_upgrade_download' ) );
12
- add_action( 'wp_ajax_dlm_lu_upgrade_content', array( $this, 'handle_upgrade_content_item' ) );
13
- add_action( 'wp_ajax_dlm_lu_mark_upgrade_done', array( $this, 'handle_mark_upgrade_done' ) );
14
- }
15
-
16
- /**
17
- * Handle dlm_lu_get_queue AJAX request
18
- */
19
- public function handle_get_download_queue() {
20
-
21
- // nonce check
22
- check_ajax_referer( 'dlm_legacy_upgrade', 'nonce' );
23
-
24
- // check cap access
25
- if ( ! current_user_can( 'manage_downloads' ) ) {
26
- exit;
27
- }
28
-
29
- // queue object
30
- $queue = new DLM_LU_Download_Queue();
31
-
32
- // build queue
33
- $queue->build_queue();
34
-
35
- // send queue as response
36
- wp_send_json( $queue->get_queue() );
37
-
38
- // houdoe
39
- exit;
40
- }
41
-
42
- /**
43
- * Handle dlm_lu_upgrade_download AJAX request
44
- */
45
- public function handle_upgrade_download() {
46
-
47
- // nonce check
48
- check_ajax_referer( 'dlm_legacy_upgrade', 'nonce' );
49
-
50
- // check cap access
51
- if ( ! current_user_can( 'manage_downloads' ) ) {
52
- exit;
53
- }
54
-
55
- if ( ! isset( $_GET['download_id'] ) ) {
56
- exit;
57
- }
58
-
59
- // get download id
60
- $download_id = absint( $_GET['download_id'] );
61
-
62
- // upgrade download
63
- $upgrader = new DLM_LU_Download_Upgrader();
64
-
65
- if ( $upgrader->upgrade_download( $download_id ) ) {
66
- wp_send_json( array( 'success' => true ) );
67
- } else {
68
- wp_send_json( array( 'success' => false ) );
69
- }
70
-
71
- // ciao
72
- exit;
73
- }
74
-
75
- /**
76
- * Handle dlm_lu_get_queue AJAX request
77
- */
78
- public function handle_get_content_queue() {
79
-
80
- // nonce check
81
- check_ajax_referer( 'dlm_legacy_upgrade', 'nonce' );
82
-
83
- // check cap access
84
- if ( ! current_user_can( 'manage_downloads' ) ) {
85
- exit;
86
- }
87
-
88
- // queue object
89
- $queue = new DLM_LU_Content_Queue();
90
-
91
- // build queue
92
- $queue->build_queue();
93
-
94
- // send queue as response
95
- wp_send_json( $queue->get_queue() );
96
-
97
- // bye
98
- exit;
99
- }
100
-
101
- /**
102
- * Handle dlm_lu_upgrade_download AJAX request
103
- */
104
- public function handle_upgrade_content_item() {
105
-
106
- // nonce check
107
- check_ajax_referer( 'dlm_legacy_upgrade', 'nonce' );
108
-
109
- // check cap access
110
- if ( ! current_user_can( 'manage_downloads' ) ) {
111
- exit;
112
- }
113
-
114
- if ( ! isset( $_GET['content_id'] ) ) {
115
- exit;
116
- }
117
-
118
- // get download id
119
- $content_id = absint( $_GET['content_id'] );
120
-
121
- // upgrade download
122
- $upgrader = new DLM_LU_Content_Upgrader();
123
-
124
- if ( $upgrader->upgrade_item( $content_id ) ) {
125
- wp_send_json( array( 'success' => true ) );
126
- } else {
127
- wp_send_json( array( 'success' => false ) );
128
- }
129
-
130
- // alaaf
131
- exit;
132
- }
133
-
134
- /**
135
- * Handle dlm_lu_mark_upgrade_done AJAX request
136
- */
137
- public function handle_mark_upgrade_done() {
138
-
139
- // nonce check
140
- check_ajax_referer( 'dlm_legacy_upgrade', 'nonce' );
141
-
142
- // check cap access
143
- if ( ! current_user_can( 'manage_downloads' ) ) {
144
- exit;
145
- }
146
-
147
- // hide upgrade message
148
- $checker = new DLM_LU_Checker();
149
- $checker->mark_upgraded();
150
-
151
- // success
152
- wp_send_json( array( 'success' => true ) );
153
-
154
- // tschüss
155
- exit;
156
- }
157
-
158
  }
1
+ <?php
2
+
3
+ class DLM_LU_Ajax {
4
+
5
+ /**
6
+ * Setup AJAX report hooks
7
+ */
8
+ public function setup() {
9
+ add_action( 'wp_ajax_dlm_lu_get_download_queue', array( $this, 'handle_get_download_queue' ) );
10
+ add_action( 'wp_ajax_dlm_lu_get_content_queue', array( $this, 'handle_get_content_queue' ) );
11
+ add_action( 'wp_ajax_dlm_lu_upgrade_download', array( $this, 'handle_upgrade_download' ) );
12
+ add_action( 'wp_ajax_dlm_lu_upgrade_content', array( $this, 'handle_upgrade_content_item' ) );
13
+ add_action( 'wp_ajax_dlm_lu_mark_upgrade_done', array( $this, 'handle_mark_upgrade_done' ) );
14
+ }
15
+
16
+ /**
17
+ * Handle dlm_lu_get_queue AJAX request
18
+ */
19
+ public function handle_get_download_queue() {
20
+
21
+ // nonce check
22
+ check_ajax_referer( 'dlm_legacy_upgrade', 'nonce' );
23
+
24
+ // check cap access
25
+ if ( ! current_user_can( 'manage_downloads' ) ) {
26
+ exit;
27
+ }
28
+
29
+ // queue object
30
+ $queue = new DLM_LU_Download_Queue();
31
+
32
+ // build queue
33
+ $queue->build_queue();
34
+
35
+ // send queue as response
36
+ wp_send_json( $queue->get_queue() );
37
+
38
+ // houdoe
39
+ exit;
40
+ }
41
+
42
+ /**
43
+ * Handle dlm_lu_upgrade_download AJAX request
44
+ */
45
+ public function handle_upgrade_download() {
46
+
47
+ // nonce check
48
+ check_ajax_referer( 'dlm_legacy_upgrade', 'nonce' );
49
+
50
+ // check cap access
51
+ if ( ! current_user_can( 'manage_downloads' ) ) {
52
+ exit;
53
+ }
54
+
55
+ if ( ! isset( $_GET['download_id'] ) ) {
56
+ exit;
57
+ }
58
+
59
+ // get download id
60
+ $download_id = absint( $_GET['download_id'] );
61
+
62
+ // upgrade download
63
+ $upgrader = new DLM_LU_Download_Upgrader();
64
+
65
+ if ( $upgrader->upgrade_download( $download_id ) ) {
66
+ wp_send_json( array( 'success' => true ) );
67
+ } else {
68
+ wp_send_json( array( 'success' => false ) );
69
+ }
70
+
71
+ // ciao
72
+ exit;
73
+ }
74
+
75
+ /**
76
+ * Handle dlm_lu_get_queue AJAX request
77
+ */
78
+ public function handle_get_content_queue() {
79
+
80
+ // nonce check
81
+ check_ajax_referer( 'dlm_legacy_upgrade', 'nonce' );
82
+
83
+ // check cap access
84
+ if ( ! current_user_can( 'manage_downloads' ) ) {
85
+ exit;
86
+ }
87
+
88
+ // queue object
89
+ $queue = new DLM_LU_Content_Queue();
90
+
91
+ // build queue
92
+ $queue->build_queue();
93
+
94
+ // send queue as response
95
+ wp_send_json( $queue->get_queue() );
96
+
97
+ // bye
98
+ exit;
99
+ }
100
+
101
+ /**
102
+ * Handle dlm_lu_upgrade_download AJAX request
103
+ */
104
+ public function handle_upgrade_content_item() {
105
+
106
+ // nonce check
107
+ check_ajax_referer( 'dlm_legacy_upgrade', 'nonce' );
108
+
109
+ // check cap access
110
+ if ( ! current_user_can( 'manage_downloads' ) ) {
111
+ exit;
112
+ }
113
+
114
+ if ( ! isset( $_GET['content_id'] ) ) {
115
+ exit;
116
+ }
117
+
118
+ // get download id
119
+ $content_id = absint( $_GET['content_id'] );
120
+
121
+ // upgrade download
122
+ $upgrader = new DLM_LU_Content_Upgrader();
123
+
124
+ if ( $upgrader->upgrade_item( $content_id ) ) {
125
+ wp_send_json( array( 'success' => true ) );
126
+ } else {
127
+ wp_send_json( array( 'success' => false ) );
128
+ }
129
+
130
+ // alaaf
131
+ exit;
132
+ }
133
+
134
+ /**
135
+ * Handle dlm_lu_mark_upgrade_done AJAX request
136
+ */
137
+ public function handle_mark_upgrade_done() {
138
+
139
+ // nonce check
140
+ check_ajax_referer( 'dlm_legacy_upgrade', 'nonce' );
141
+
142
+ // check cap access
143
+ if ( ! current_user_can( 'manage_downloads' ) ) {
144
+ exit;
145
+ }
146
+
147
+ // hide upgrade message
148
+ $checker = new DLM_LU_Checker();
149
+ $checker->mark_upgraded();
150
+
151
+ // success
152
+ wp_send_json( array( 'success' => true ) );
153
+
154
+ // tschüss
155
+ exit;
156
+ }
157
+
158
  }
src/LegacyUpgrader/Checker.php CHANGED
@@ -1,108 +1,108 @@
1
- <?php
2
-
3
-
4
- class DLM_LU_Checker {
5
-
6
- /**
7
- * Check if DLM has already been upgraded
8
- *
9
- * @return bool
10
- */
11
- private function has_been_upgraded() {
12
- return ( 1 === absint( get_option( DLM_Constants::LU_OPTION_UPGRADED, 0 ) ) );
13
- }
14
-
15
- /**
16
- * Check if legacy table exists
17
- * @return bool
18
- */
19
- private function has_legacy_tables() {
20
- global $wpdb;
21
-
22
- $du = new DLM_LU_Download_Upgrader();
23
- $legacy_tables = $du->get_legacy_tables();
24
- $sql = "SELECT 1 FROM `" . $legacy_tables['files'] . "` LIMIT 1;";
25
- $o_suppress_errors = $wpdb->suppress_errors;
26
- $wpdb->suppress_errors = true;
27
- $r = $wpdb->query( $sql );
28
- $wpdb->suppress_errors = $o_suppress_errors;
29
-
30
- return ( $r !== false );
31
- }
32
-
33
- /**
34
- * Returns true if there is at least one 'new' downloads.
35
- * A new download is a custom post type with type 'dlm_download'
36
- * @return bool
37
- */
38
- private function has_modern_downloads() {
39
- $repo = new DLM_WordPress_Download_Repository();
40
- $amount = $repo->num_rows();
41
-
42
- return ( $amount > 0 );
43
- }
44
-
45
- /**
46
- * Mark website as upgraded
47
- *
48
- * @return void
49
- */
50
- public function mark_upgraded() {
51
- update_option( DLM_Constants::LU_OPTION_UPGRADED, 1 );
52
- update_option( DLM_Constants::LU_OPTION_NEEDS_UPGRADING, 0 );
53
- }
54
-
55
- /**
56
- * Check if DLM needs upgrading
57
- *
58
- * @return bool
59
- */
60
- public function needs_upgrading() {
61
-
62
- // no upgrade requests in AJAX
63
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
64
- return false;
65
- }
66
-
67
- /**
68
- * Check if we already checked if need to upgrade.
69
- * If we already checked we stored the result in this option.
70
- * This prevents us from checking on every admin load.
71
- */
72
- $needs_upgrading = get_option( DLM_Constants::LU_OPTION_NEEDS_UPGRADING, null );
73
-
74
- // if the option is null, it's not set yet and we need to check.
75
- if ( null === $needs_upgrading ) {
76
-
77
- // set default to 0 (no)
78
- $needs_upgrading = 0;
79
-
80
- // check if we already upgraded
81
- if ( ! $this->has_been_upgraded() ) {
82
-
83
- // check if we have legacy tables
84
- if ( $this->has_legacy_tables() ) {
85
-
86
- /**
87
- * Check if there are already 'new' download
88
- * We're doing this because there are users that manually upgraded in the past
89
- * So they will have the legacy tables but don't need converting
90
- */
91
- if ( ! $this->has_modern_downloads() ) {
92
-
93
- // this site needs upgrading, set to 1 (yes)
94
- $needs_upgrading = 1;
95
- }
96
-
97
- }
98
- }
99
-
100
- // store the option so we don't have to check this everytime.
101
- update_option( DLM_Constants::LU_OPTION_NEEDS_UPGRADING, $needs_upgrading );
102
- }
103
-
104
- // now convert to int and return if it's 1.
105
- return ( 1 === absint( $needs_upgrading ) );
106
- }
107
-
108
  }
1
+ <?php
2
+
3
+
4
+ class DLM_LU_Checker {
5
+
6
+ /**
7
+ * Check if DLM has already been upgraded
8
+ *
9
+ * @return bool
10
+ */
11
+ private function has_been_upgraded() {
12
+ return ( 1 === absint( get_option( DLM_Constants::LU_OPTION_UPGRADED, 0 ) ) );
13
+ }
14
+
15
+ /**
16
+ * Check if legacy table exists
17
+ * @return bool
18
+ */
19
+ private function has_legacy_tables() {
20
+ global $wpdb;
21
+
22
+ $du = new DLM_LU_Download_Upgrader();
23
+ $legacy_tables = $du->get_legacy_tables();
24
+ $sql = "SELECT 1 FROM `" . $legacy_tables['files'] . "` LIMIT 1;";
25
+ $o_suppress_errors = $wpdb->suppress_errors;
26
+ $wpdb->suppress_errors = true;
27
+ $r = $wpdb->query( $sql );
28
+ $wpdb->suppress_errors = $o_suppress_errors;
29
+
30
+ return ( $r !== false );
31
+ }
32
+
33
+ /**
34
+ * Returns true if there is at least one 'new' downloads.
35
+ * A new download is a custom post type with type 'dlm_download'
36
+ * @return bool
37
+ */
38
+ private function has_modern_downloads() {
39
+ $repo = new DLM_WordPress_Download_Repository();
40
+ $amount = $repo->num_rows();
41
+
42
+ return ( $amount > 0 );
43
+ }
44
+
45
+ /**
46
+ * Mark website as upgraded
47
+ *
48
+ * @return void
49
+ */
50
+ public function mark_upgraded() {
51
+ update_option( DLM_Constants::LU_OPTION_UPGRADED, 1 );
52
+ update_option( DLM_Constants::LU_OPTION_NEEDS_UPGRADING, 0 );
53
+ }
54
+
55
+ /**
56
+ * Check if DLM needs upgrading
57
+ *
58
+ * @return bool
59
+ */
60
+ public function needs_upgrading() {
61
+
62
+ // no upgrade requests in AJAX
63
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
64
+ return false;
65
+ }
66
+
67
+ /**
68
+ * Check if we already checked if need to upgrade.
69
+ * If we already checked we stored the result in this option.
70
+ * This prevents us from checking on every admin load.
71
+ */
72
+ $needs_upgrading = get_option( DLM_Constants::LU_OPTION_NEEDS_UPGRADING, null );
73
+
74
+ // if the option is null, it's not set yet and we need to check.
75
+ if ( null === $needs_upgrading ) {
76
+
77
+ // set default to 0 (no)
78
+ $needs_upgrading = 0;
79
+
80
+ // check if we already upgraded
81
+ if ( ! $this->has_been_upgraded() ) {
82
+
83
+ // check if we have legacy tables
84
+ if ( $this->has_legacy_tables() ) {
85
+
86
+ /**
87
+ * Check if there are already 'new' download
88
+ * We're doing this because there are users that manually upgraded in the past
89
+ * So they will have the legacy tables but don't need converting
90
+ */
91
+ if ( ! $this->has_modern_downloads() ) {
92
+
93
+ // this site needs upgrading, set to 1 (yes)
94
+ $needs_upgrading = 1;
95
+ }
96
+
97
+ }
98
+ }
99
+
100
+ // store the option so we don't have to check this everytime.
101
+ update_option( DLM_Constants::LU_OPTION_NEEDS_UPGRADING, $needs_upgrading );
102
+ }
103
+
104
+ // now convert to int and return if it's 1.
105
+ return ( 1 === absint( $needs_upgrading ) );
106
+ }
107
+
108
  }
src/LegacyUpgrader/ContentQueue.php CHANGED
@@ -1,116 +1,116 @@
1
- <?php
2
-
3
- class DLM_LU_Content_Queue {
4
-
5
- const TABLE = 'legacy_upgrade_queue_content';
6
-
7
- /**
8
- * check if queue has already been build once
9
- *
10
- * @return bool
11
- */
12
- private function is_queue_already_build() {
13
- return ( 1 === absint( get_option( DLM_Constants::LU_OPTION_CONTENT_QUEUE_BUILD, 0 ) ) );
14
- }
15
-
16
- /**
17
- * Get the queue table
18
- *
19
- * @return string
20
- */
21
- private function get_queue_table() {
22
- global $wpdb;
23
-
24
- return $wpdb->prefix . self::TABLE;
25
- }
26
-
27
- /**
28
- * Create database table if not exists
29
- *
30
- * @return bool
31
- */
32
- private function create_table_if_not_exists() {
33
- global $wpdb;
34
-
35
- // create table
36
- $sql = "CREATE TABLE IF NOT EXISTS `" . $this->get_queue_table() . "` ( `content_id` INT NOT NULL , `processing` DATETIME NULL DEFAULT NULL , `done` DATETIME NULL DEFAULT NULL , PRIMARY KEY (`content_id`)) ;";
37
- $r = $wpdb->query( $sql );
38
-
39
- return ( false === $r );
40
- }
41
-
42
- /**
43
- * Build queue of downloads that need upgrading
44
- *
45
- * @return bool
46
- */
47
- public function build_queue() {
48
- global $wpdb;
49
-
50
- // check if queue was already build because YOBO! (you only build once).
51
- if ( $this->is_queue_already_build() ) {
52
- return false;
53
- }
54
-
55
- // create database table if not exists
56
- $this->create_table_if_not_exists();
57
-
58
- // fetch content items that aren't in our queue
59
- $content_items = $wpdb->get_results( "SELECT P.`ID` FROM `{$wpdb->posts}` P LEFT JOIN `" . $this->get_queue_table() . "` Q ON P.ID=Q.content_id WHERE P.`post_type` IN ( 'post', 'page' ) AND Q.content_id IS NULL ;" );
60
-
61
- // loop and insert into queue
62
- if ( count( $content_items ) > 0 ) {
63
- foreach ( $content_items as $content_item ) {
64
- $wpdb->insert( $this->get_queue_table(), array( 'content_id' => $content_item->ID ) );
65
- }
66
- }
67
-
68
- // set queue build
69
- update_option( DLM_Constants::LU_OPTION_CONTENT_QUEUE_BUILD, 1 );
70
-
71
- return true;
72
- }
73
-
74
- /**
75
- * Get queue of content items that need upgrading.
76
- * This means we only return items that aren't currently upgrading or are already upgraded.
77
- *
78
- * @return array
79
- */
80
- public function get_queue() {
81
- global $wpdb;
82
-
83
- return $wpdb->get_col( "SELECT `content_id` AS `id` from `" . $this->get_queue_table() . "` WHERE `processing` IS NULL AND `done` IS NULL " );
84
- }
85
-
86
- /**
87
- * Mark content item as currently being upgraded
88
- *
89
- * @param int $content_id
90
- *
91
- * @return bool
92
- */
93
- public function mark_upgrading( $content_id ) {
94
- global $wpdb;
95
-
96
- $res = $wpdb->query( $wpdb->prepare( "UPDATE `" . $this->get_queue_table() . "` SET `processing` = NOW() WHERE `content_id` = %d ;", $content_id ) );
97
-
98
- return ( false === $res );
99
- }
100
-
101
- /**
102
- * Mark content item as successfully upgraded
103
- *
104
- * @param int $content_id
105
- *
106
- * @return bool
107
- */
108
- public function mark_upgraded( $content_id ) {
109
- global $wpdb;
110
-
111
- $res = $wpdb->query( $wpdb->prepare( "UPDATE `" . $this->get_queue_table() . "` SET `done` = NOW() WHERE `content_id` = %d ;", $content_id ) );
112
-
113
- return ( false === $res );
114
- }
115
-
116
  }
1
+ <?php
2
+
3
+ class DLM_LU_Content_Queue {
4
+
5
+ const TABLE = 'legacy_upgrade_queue_content';
6
+
7
+ /**
8
+ * check if queue has already been build once
9
+ *
10
+ * @return bool
11
+ */
12
+ private function is_queue_already_build() {
13
+ return ( 1 === absint( get_option( DLM_Constants::LU_OPTION_CONTENT_QUEUE_BUILD, 0 ) ) );
14
+ }
15
+
16
+ /**
17
+ * Get the queue table
18
+ *
19
+ * @return string
20
+ */
21
+ private function get_queue_table() {
22
+ global $wpdb;
23
+
24
+ return $wpdb->prefix . self::TABLE;
25
+ }
26
+
27
+ /**
28
+ * Create database table if not exists
29
+ *
30
+ * @return bool
31
+ */
32
+ private function create_table_if_not_exists() {
33
+ global $wpdb;
34
+
35
+ // create table
36
+ $sql = "CREATE TABLE IF NOT EXISTS `" . $this->get_queue_table() . "` ( `content_id` INT NOT NULL , `processing` DATETIME NULL DEFAULT NULL , `done` DATETIME NULL DEFAULT NULL , PRIMARY KEY (`content_id`)) ;";
37
+ $r = $wpdb->query( $sql );
38
+
39
+ return ( false === $r );
40
+ }
41
+
42
+ /**
43
+ * Build queue of downloads that need upgrading
44
+ *
45
+ * @return bool
46
+ */
47
+ public function build_queue() {
48
+ global $wpdb;
49
+
50
+ // check if queue was already build because YOBO! (you only build once).
51
+ if ( $this->is_queue_already_build() ) {
52
+ return false;
53
+ }
54
+
55
+ // create database table if not exists
56
+ $this->create_table_if_not_exists();
57
+
58
+ // fetch content items that aren't in our queue
59
+ $content_items = $wpdb->get_results( "SELECT P.`ID` FROM `{$wpdb->posts}` P LEFT JOIN `" . $this->get_queue_table() . "` Q ON P.ID=Q.content_id WHERE P.`post_type` IN ( 'post', 'page' ) AND Q.content_id IS NULL ;" );
60
+
61
+ // loop and insert into queue
62
+ if ( count( $content_items ) > 0 ) {
63
+ foreach ( $content_items as $content_item ) {
64
+ $wpdb->insert( $this->get_queue_table(), array( 'content_id' => $content_item->ID ) );
65
+ }
66
+ }
67
+
68
+ // set queue build
69
+ update_option( DLM_Constants::LU_OPTION_CONTENT_QUEUE_BUILD, 1 );
70
+
71
+ return true;
72
+ }
73
+
74
+ /**
75
+ * Get queue of content items that need upgrading.
76
+ * This means we only return items that aren't currently upgrading or are already upgraded.
77
+ *
78
+ * @return array
79
+ */
80
+ public function get_queue() {
81
+ global $wpdb;
82
+
83
+ return $wpdb->get_col( "SELECT `content_id` AS `id` from `" . $this->get_queue_table() . "` WHERE `processing` IS NULL AND `done` IS NULL " );
84
+ }
85
+
86
+ /**
87
+ * Mark content item as currently being upgraded
88
+ *
89
+ * @param int $content_id
90
+ *
91
+ * @return bool
92
+ */
93
+ public function mark_upgrading( $content_id ) {
94
+ global $wpdb;
95
+
96
+ $res = $wpdb->query( $wpdb->prepare( "UPDATE `" . $this->get_queue_table() . "` SET `processing` = NOW() WHERE `content_id` = %d ;", $content_id ) );
97
+
98
+ return ( false === $res );
99
+ }
100
+
101
+ /**
102
+ * Mark content item as successfully upgraded
103
+ *
104
+ * @param int $content_id
105
+ *
106
+ * @return bool
107
+ */
108
+ public function mark_upgraded( $content_id ) {
109
+ global $wpdb;
110
+
111
+ $res = $wpdb->query( $wpdb->prepare( "UPDATE `" . $this->get_queue_table() . "` SET `done` = NOW() WHERE `content_id` = %d ;", $content_id ) );
112
+
113
+ return ( false === $res );
114
+ }
115
+
116
  }
src/LegacyUpgrader/ContentUpgrader.php CHANGED
@@ -1,69 +1,69 @@
1
- <?php
2
-
3
- class DLM_LU_Content_Upgrader {
4
-
5
- /** @var array temporary id map so we don't query the same legacy id multiple times per post/page */
6
- private $id_map = array();
7
-
8
- private $download_queue;
9
-
10
- public function __construct() {
11
- $this->download_queue = new DLM_LU_Download_Queue();
12
- }
13
-
14
- /**
15
- * Regex callback. Use match parts to construct new download shortcode.
16
- *
17
- * @param $m array
18
- *
19
- * @return string
20
- */
21
- public function preg_replace_cb( $m ) {
22
-
23
- // check map, if not in map, fetch
24
- if ( ! isset( $this->id_map[ $m[3] ] ) ) {
25
- $this->id_map[ $m[3] ] = $this->download_queue->get_new_id( $m[3] );
26
- }
27
-
28
- return "[download ".$m[1]."id=".$m[2].$this->id_map[ $m[3] ].$m[2].$m[4]."]";
29
- }
30
-
31
- /**
32
- * Upgrade item
33
- *
34
- * @param $item_id int
35
- *
36
- * @return bool
37
- */
38
- public function upgrade_item( $item_id ) {
39
- global $wpdb;
40
-
41
- // make sure item id is int
42
- $item_id = absint( $item_id );
43
-
44
- // queue item
45
- $queue = new DLM_LU_Content_Queue();
46
-
47
- // mark content item as upgrading
48
- $queue->mark_upgrading( $item_id );
49
-
50
- // get 'post'
51
- $post = get_post( $item_id );
52
-
53
- // content
54
- $content = $post->post_content;
55
-
56
- // generate new content
57
- $regex = "`\[download ([^\]]*)(?:id=([\"|']{0,1})([0-9]+)(?:[\"|']{0,1}))([^\]]*)\]`";
58
- $new_content = preg_replace_callback( $regex, array( $this, 'preg_replace_cb' ), $content );
59
-
60
- // update content in database
61
- $wpdb->update( $wpdb->posts, array( 'post_content' => $new_content ), array('ID'=>$post->ID), array('%s'), array('%d') );
62
-
63
- // mark content item as upgraded
64
- $queue->mark_upgraded( $item_id );
65
-
66
- return true;
67
- }
68
-
69
  }
1
+ <?php
2
+
3
+ class DLM_LU_Content_Upgrader {
4
+
5
+ /** @var array temporary id map so we don't query the same legacy id multiple times per post/page */
6
+ private $id_map = array();
7
+
8
+ private $download_queue;
9
+
10
+ public function __construct() {
11
+ $this->download_queue = new DLM_LU_Download_Queue();
12
+ }
13
+
14
+ /**
15
+ * Regex callback. Use match parts to construct new download shortcode.
16
+ *
17
+ * @param $m array
18
+ *
19
+ * @return string
20
+ */
21
+ public function preg_replace_cb( $m ) {
22
+
23
+ // check map, if not in map, fetch
24
+ if ( ! isset( $this->id_map[ $m[3] ] ) ) {
25
+ $this->id_map[ $m[3] ] = $this->download_queue->get_new_id( $m[3] );
26
+ }
27
+
28
+ return "[download ".$m[1]."id=".$m[2].$this->id_map[ $m[3] ].$m[2].$m[4]."]";
29
+ }
30
+
31
+ /**
32
+ * Upgrade item
33
+ *
34
+ * @param $item_id int
35
+ *
36
+ * @return bool
37
+ */
38
+ public function upgrade_item( $item_id ) {
39
+ global $wpdb;
40
+
41
+ // make sure item id is int
42
+ $item_id = absint( $item_id );
43
+
44
+ // queue item
45
+ $queue = new DLM_LU_Content_Queue();
46
+
47
+ // mark content item as upgrading
48
+ $queue->mark_upgrading( $item_id );
49
+
50
+ // get 'post'
51
+ $post = get_post( $item_id );
52
+
53
+ // content
54
+ $content = $post->post_content;
55
+
56
+ // generate new content
57
+ $regex = "`\[download ([^\]]*)(?:id=([\"|']{0,1})([0-9]+)(?:[\"|']{0,1}))([^\]]*)\]`";
58
+ $new_content = preg_replace_callback( $regex, array( $this, 'preg_replace_cb' ), $content );
59
+
60
+ // update content in database
61
+ $wpdb->update( $wpdb->posts, array( 'post_content' => $new_content ), array('ID'=>$post->ID), array('%s'), array('%d') );
62
+
63
+ // mark content item as upgraded
64
+ $queue->mark_upgraded( $item_id );
65
+
66
+ return true;
67
+ }
68
+
69
  }
src/LegacyUpgrader/DownloadQueue.php CHANGED
@@ -1,136 +1,136 @@
1
- <?php
2
-
3
- class DLM_LU_Download_Queue {
4
-
5
- const TABLE = 'legacy_upgrade_queue_downloads';
6
-
7
- /**
8
- * check if queue has already been build once
9
- *
10
- * @return bool
11
- */
12
- private function is_queue_already_build() {
13
- return ( 1 === absint( get_option( DLM_Constants::LU_OPTION_DOWNLOAD_QUEUE_BUILD, 0 ) ) );
14
- }
15
-
16
- /**
17
- * Get the queue table
18
- *
19
- * @return string
20
- */
21
- private function get_queue_table() {
22
- global $wpdb;
23
-
24
- return $wpdb->prefix . self::TABLE;
25
- }
26
-
27
- /**
28
- * Create database table if not exists
29
- *
30
- * @return bool
31
- */
32
- private function create_table_if_not_exists() {
33
- global $wpdb;
34
-
35
- // create table
36
- $sql = "CREATE TABLE IF NOT EXISTS `" . $this->get_queue_table() . "` ( `legacy_id` INT NOT NULL , `new_id` INT NULL DEFAULT NULL , `processing` DATETIME NULL DEFAULT NULL , `done` DATETIME NULL DEFAULT NULL , PRIMARY KEY (`legacy_id`)) ;";
37
- $r = $wpdb->query( $sql );
38
-
39
- return ( false === $r );
40
- }
41
-
42
- /**
43
- * Get new ID of legacy ID
44
- *
45
- * @param $legacy_id
46
- *
47
- * @return int
48
- */
49
- public function get_new_id( $legacy_id ) {
50
- global $wpdb;
51
-
52
- $legacy_id = absint( $legacy_id );
53
-
54
- return absint( $wpdb->get_var( $wpdb->prepare( "SELECT `new_id` FROM `" . $this->get_queue_table() . "` WHERE `legacy_id` = %d ", $legacy_id ) ) );
55
- }
56
-
57
- /**
58
- * Build queue of downloads that need upgrading
59
- *
60
- * @return bool
61
- */
62
- public function build_queue() {
63
- global $wpdb;
64
-
65
- // check if queue was already build because YOBO! (you only build once).
66
- if ( $this->is_queue_already_build() ) {
67
- return false;
68
- }
69
-
70
- // create database table if not exists
71
- $this->create_table_if_not_exists();
72
-
73
- // legacy tables we're fetching from
74
- $upgrader = new DLM_LU_Download_Upgrader();
75
- $legacy_tables = $upgrader->get_legacy_tables();
76
-
77
- // fetch legacy downloads that aren't in our queue
78
- $legacy_downloads = $wpdb->get_results( "SELECT F.`ID` FROM `{$legacy_tables['files']}` F LEFT JOIN `" . $this->get_queue_table() . "` Q ON F.ID=Q.legacy_id WHERE Q.legacy_id IS NULL ;" );
79
-
80
- // loop and insert into queue
81
- if ( count( $legacy_downloads ) > 0 ) {
82
- foreach ( $legacy_downloads as $legacy_download ) {
83
- $wpdb->insert( $this->get_queue_table(), array( 'legacy_id' => $legacy_download->ID ) );
84
- }
85
- }
86
-
87
- // set queue build
88
- update_option( DLM_Constants::LU_OPTION_DOWNLOAD_QUEUE_BUILD, 1 );
89
-
90
- return true;
91
- }
92
-
93
- /**
94
- * Get queue of downloads that need upgrading.
95
- * This means we only return items that aren't currently upgrading or are already upgraded.
96
- *
97
- * @return array
98
- */
99
- public function get_queue() {
100
- global $wpdb;
101
-
102
- return $wpdb->get_col( "SELECT `legacy_id` AS `id` from `" . $this->get_queue_table() . "` WHERE `new_id` IS NULL AND `processing` IS NULL AND `done` IS NULL " );
103
- }
104
-
105
- /**
106
- * Mark download as currently being upgraded
107
- *
108
- * @param int $legacy_id
109
- *
110
- * @return bool
111
- */
112
- public function mark_download_upgrading( $legacy_id ) {
113
- global $wpdb;
114
-
115
- $res = $wpdb->query( $wpdb->prepare( "UPDATE `" . $this->get_queue_table() . "` SET `processing` = NOW() WHERE `legacy_id` = %d ;", $legacy_id ) );
116
-
117
- return ( false === $res );
118
- }
119
-
120
- /**
121
- * Mark download as successfully upgraded
122
- *
123
- * @param int $legacy_id
124
- * @param int $new_id
125
- *
126
- * @return bool
127
- */
128
- public function mark_download_upgraded( $legacy_id, $new_id ) {
129
- global $wpdb;
130
-
131
- $res = $wpdb->query( $wpdb->prepare( "UPDATE `" . $this->get_queue_table() . "` SET `done` = NOW(), `new_id` = %d WHERE `legacy_id` = %d ;", $new_id, $legacy_id ) );
132
-
133
- return ( false === $res );
134
- }
135
-
136
  }
1
+ <?php
2
+
3
+ class DLM_LU_Download_Queue {
4
+
5
+ const TABLE = 'legacy_upgrade_queue_downloads';
6
+
7
+ /**
8
+ * check if queue has already been build once
9
+ *
10
+ * @return bool
11
+ */
12
+ private function is_queue_already_build() {
13
+ return ( 1 === absint( get_option( DLM_Constants::LU_OPTION_DOWNLOAD_QUEUE_BUILD, 0 ) ) );
14
+ }
15
+
16
+ /**
17
+ * Get the queue table
18
+ *
19
+ * @return string
20
+ */
21
+ private function get_queue_table() {
22
+ global $wpdb;
23
+
24
+ return $wpdb->prefix . self::TABLE;
25
+ }
26
+
27
+ /**
28
+ * Create database table if not exists
29
+ *
30
+ * @return bool
31
+ */
32
+ private function create_table_if_not_exists() {
33
+ global $wpdb;
34
+
35
+ // create table
36
+ $sql = "CREATE TABLE IF NOT EXISTS `" . $this->get_queue_table() . "` ( `legacy_id` INT NOT NULL , `new_id` INT NULL DEFAULT NULL , `processing` DATETIME NULL DEFAULT NULL , `done` DATETIME NULL DEFAULT NULL , PRIMARY KEY (`legacy_id`)) ;";
37
+ $r = $wpdb->query( $sql );
38
+
39
+ return ( false === $r );
40
+ }
41
+
42
+ /**
43
+ * Get new ID of legacy ID
44
+ *
45
+ * @param $legacy_id
46
+ *
47
+ * @return int
48
+ */
49
+ public function get_new_id( $legacy_id ) {
50
+ global $wpdb;
51
+
52
+ $legacy_id = absint( $legacy_id );
53
+
54
+ return absint( $wpdb->get_var( $wpdb->prepare( "SELECT `new_id` FROM `" . $this->get_queue_table() . "` WHERE `legacy_id` = %d ", $legacy_id ) ) );
55
+ }
56
+
57
+ /**
58
+ * Build queue of downloads that need upgrading
59
+ *
60
+ * @return bool
61
+ */
62
+ public function build_queue() {
63
+ global $wpdb;
64
+
65
+ // check if queue was already build because YOBO! (you only build once).
66
+ if ( $this->is_queue_already_build() ) {
67
+ return false;
68
+ }
69
+
70
+ // create database table if not exists
71
+ $this->create_table_if_not_exists();
72
+
73
+ // legacy tables we're fetching from
74
+ $upgrader = new DLM_LU_Download_Upgrader();
75
+ $legacy_tables = $upgrader->get_legacy_tables();
76
+
77
+ // fetch legacy downloads that aren't in our queue
78
+ $legacy_downloads = $wpdb->get_results( "SELECT F.`ID` FROM `{$legacy_tables['files']}` F LEFT JOIN `" . $this->get_queue_table() . "` Q ON F.ID=Q.legacy_id WHERE Q.legacy_id IS NULL ;" );
79
+
80
+ // loop and insert into queue
81
+ if ( count( $legacy_downloads ) > 0 ) {
82
+ foreach ( $legacy_downloads as $legacy_download ) {
83
+ $wpdb->insert( $this->get_queue_table(), array( 'legacy_id' => $legacy_download->ID ) );
84
+ }
85
+ }
86
+
87
+ // set queue build
88
+ update_option( DLM_Constants::LU_OPTION_DOWNLOAD_QUEUE_BUILD, 1 );
89
+
90
+ return true;
91
+ }
92
+
93
+ /**
94
+ * Get queue of downloads that need upgrading.
95
+ * This means we only return items that aren't currently upgrading or are already upgraded.
96
+ *
97
+ * @return array
98
+ */
99
+ public function get_queue() {
100
+ global $wpdb;
101
+
102
+ return $wpdb->get_col( "SELECT `legacy_id` AS `id` from `" . $this->get_queue_table() . "` WHERE `new_id` IS NULL AND `processing` IS NULL AND `done` IS NULL " );
103
+ }
104
+
105
+ /**
106
+ * Mark download as currently being upgraded
107
+ *
108
+ * @param int $legacy_id
109
+ *
110
+ * @return bool
111
+ */
112
+ public function mark_download_upgrading( $legacy_id ) {
113
+ global $wpdb;
114
+
115
+ $res = $wpdb->query( $wpdb->prepare( "UPDATE `" . $this->get_queue_table() . "` SET `processing` = NOW() WHERE `legacy_id` = %d ;", $legacy_id ) );
116
+
117
+ return ( false === $res );
118
+ }
119
+
120
+ /**
121
+ * Mark download as successfully upgraded
122
+ *
123
+ * @param int $legacy_id
124
+ * @param int $new_id
125
+ *
126
+ * @return bool
127
+ */
128
+ public function mark_download_upgraded( $legacy_id, $new_id ) {
129
+ global $wpdb;
130
+
131
+ $res = $wpdb->query( $wpdb->prepare( "UPDATE `" . $this->get_queue_table() . "` SET `done` = NOW(), `new_id` = %d WHERE `legacy_id` = %d ;", $new_id, $legacy_id ) );
132
+
133
+ return ( false === $res );
134
+ }
135
+
136
  }
src/LegacyUpgrader/DownloadUpgrader.php CHANGED
@@ -1,347 +1,347 @@
1
- <?php
2
-
3
- class DLM_LU_Download_Upgrader {
4
-
5
- /**
6
- * Get legacy tables
7
- *
8
- * @return array
9
- */
10
- public function get_legacy_tables() {
11
- global $wpdb;
12
-
13
- return array(
14
- 'files' => $wpdb->prefix . "download_monitor_files",
15
- 'tax' => $wpdb->prefix . "download_monitor_taxonomies",
16
- 'rel' => $wpdb->prefix . "download_monitor_relationships",
17
- 'formats' => $wpdb->prefix . "download_monitor_formats",
18
- 'stats' => $wpdb->prefix . "download_monitor_stats",
19
- 'log' => $wpdb->prefix . "download_monitor_log",
20
- 'meta' => $wpdb->prefix . "download_monitor_file_meta"
21
- );
22
- }
23
-
24
- /**
25
- * Add terms to download
26
- *
27
- * @param array $terms
28
- * @param string $taxonomy
29
- * @param int $download_id
30
- */
31
- private function add_terms_to_download( $terms, $taxonomy, $download_id ) {
32
- $term_ids = array();
33
-
34
- foreach ( $terms as $term ) {
35
-
36
- try {
37
- $term_obj = term_exists( $term, $taxonomy );
38
-
39
- if ( $term_obj !== 0 && $term_obj !== null ) {
40
- $term_id = $term_obj['term_id'];
41
- } else {
42
- $term_obj = wp_insert_term( $term, $taxonomy );
43
-
44
- if ( is_wp_error( $term_obj ) ) {
45
- throw new Exception( 'Error on wp_insert_term()' );
46
- }
47
-
48
- $term_id = $term_obj['term_id'];
49
- }
50
-
51
- $term_ids[] = $term_id;
52
- } catch ( Exception $e ) {
53
- DLM_Debug_Logger::log( "add_terms_to_download Exception: " . $e->getMessage() );
54
- }
55
-
56
- }
57
-
58
- wp_set_post_terms( $download_id, $term_ids, $taxonomy );
59
- }
60
-
61
- /**
62
- * Upgrade legacy download thumnail
63
- *
64
- * @param string $url URL to fetch attachment from
65
- * @param int $download_id
66
- *
67
- * @return bool
68
- */
69
- private function upgrade_thumbnail( $url, $download_id ) {
70
-
71
- $attachment_id = '';
72
- $attachment_url = '';
73
- $attachment_file = '';
74
- $upload_dir = wp_upload_dir();
75
- $attachment_array = array(
76
- 'post_title' => '',
77
- 'post_content' => '',
78
- 'post_status' => 'inherit',
79
- 'post_parent' => $download_id
80
- );
81
-
82
- // check if thumbnail is in a local directory, if it is we copy it
83
- if ( strstr( $url, site_url() ) ) {
84
- $abs_url = str_replace( trailingslashit( site_url() ), trailingslashit( ABSPATH ), $url );
85
- $new_name = wp_unique_filename( $upload_dir['path'], basename( $url ) );
86
- $new_url = trailingslashit( $upload_dir['path'] ) . $new_name;
87
-
88
- if ( copy( $abs_url, $new_url ) ) {
89
- $url = basename( $new_url );
90
- }
91
- }
92
-
93
- try {
94
-
95
- if ( ! strstr( $url, 'http' ) ) {
96
-
97
- // Local file
98
- $attachment_file = trailingslashit( $upload_dir['path'] ) . $url;
99
-
100
- // We have the path, check it exists
101
- if ( file_exists( $attachment_file ) ) {
102
-
103
- $attachment_url = str_replace( trailingslashit( ABSPATH ), trailingslashit( site_url() ), $attachment_file );
104
-
105
- if ( $info = wp_check_filetype( $attachment_file ) ) {
106
- $attachment_array['post_mime_type'] = $info['type'];
107
- } else {
108
- throw new Exception( 'Invalid file type' );
109
- }
110
-
111
- $attachment_array['guid'] = $attachment_url;
112
-
113
- $attachment_id = wp_insert_attachment( $attachment_array, $attachment_file, $download_id );
114
-
115
- } else {
116
- throw new Exception( 'Local image did not exist!' );
117
- }
118
-
119
- } else {
120
-
121
- // if the URL is absolute, but does not contain address, then upload it assuming base_site_url
122
- if ( preg_match( '|^/[\w\W]+$|', $url ) ) {
123
- $url = rtrim( site_url(), '/' ) . $url;
124
- }
125
-
126
- // fetch remote file
127
- $upload = $this->fetch_remote_file( $url );
128
-
129
- if ( is_wp_error( $upload ) ) {
130
- throw new Exception( 'Error fetching remote file' );
131
- }
132
-
133
- if ( $info = wp_check_filetype( $upload['file'] ) ) {
134
- $attachment_array['post_mime_type'] = $info['type'];
135
- } else {
136
- throw new Exception( 'Invalid file type' );
137
- }
138
-
139
- $attachment_array['guid'] = $upload['url'];
140
-
141
- $attachment_file = $upload['file'];
142
-
143
- // as per wp-admin/includes/upload.php
144
- $attachment_id = wp_insert_attachment( $attachment_array, $attachment_file, $download_id );
145
-
146
- unset( $upload );
147
- }
148
-
149
-
150
- // set new meta data
151
- if ( ! is_wp_error( $attachment_id ) && $attachment_id > 0 ) {
152
- wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $attachment_file ) );
153
- update_post_meta( $download_id, '_thumbnail_id', $attachment_id );
154
- }
155
-
156
- } catch ( Exception $e ) {
157
- DLM_Debug_Logger::log( "Legacy Upgrade Thumbnail Exception: " . $e->getMessage() );
158
-
159
- return false;
160
- }
161
-
162
- return true;
163
- }
164
-
165
- /**
166
- * Fetch a remote file
167
- *
168
- * @param $url string
169
- *
170
- * @throws Exception
171
- *
172
- * @return array
173
- */
174
- private function fetch_remote_file( $url ) {
175
-
176
- // extract the file name and extension from the url
177
- $file_name = basename( $url );
178
-
179
- // Ensure url is valid
180
- $url = str_replace( " ", '%20', $url );
181
-
182
- // Get the file
183
- $response = wp_remote_get( $url, array(
184
- 'timeout' => 10
185
- ) );
186
-
187
- // check for error in response
188
- if ( is_wp_error( $response ) ) {
189
- throw new Exception( "wp_remote_get response is WP error " );
190
- }
191
-
192
- // Upload the file
193
- $upload = wp_upload_bits( $file_name, '', wp_remote_retrieve_body( $response ) );
194
-
195
- if ( $upload['error'] ) {
196
- throw new Exception( $upload['error'] );
197
- }
198
-
199
- // Get filesize
200
- $filesize = filesize( $upload['file'] );
201
-
202
- // check if filesize is greater than 0
203
- if ( 0 == $filesize ) {
204
- @unlink( $upload['file'] );
205
- unset( $upload );
206
-
207
- throw new Exception( 'Zero size file downloaded' );
208
- }
209
-
210
- unset( $response );
211
-
212
- return $upload;
213
- }
214
-
215
- /**
216
- * Upgrade a single download item. Do NOT call this without it being in queue.
217
- *
218
- * @param $download_id
219
- *
220
- * @return bool
221
- */
222
- public function upgrade_download( $download_id ) {
223
- global $wpdb;
224
-
225
- $queue = new DLM_LU_Download_Queue();
226
-
227
- $legacy_tables = $this->get_legacy_tables();
228
-
229
- // mark download upgrading
230
- $queue->mark_download_upgrading( $download_id );
231
-
232
- // get legacy download information
233
- $legacy_download = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `" . $legacy_tables['files'] . "` WHERE `id` = %d ;", $download_id ) );
234
-
235
- // create new Download object
236
- $download = new DLM_Download();
237
- $download->set_status( 'publish' );
238
- $download->set_author( 1 );
239
-
240
- // get user ID of user that created legacy download
241
- if ( ! empty( $legacy_download->user ) ) {
242
- $user = get_user_by( 'login', $legacy_download->user );
243
- if ( $user ) {
244
- $download->set_author( $user->ID );
245
- }
246
- }
247
-
248
- // set title & description
249
- $download->set_title( $legacy_download->title );
250
- $download->set_description( $legacy_download->file_description );
251
- $download->set_excerpt( "" );
252
-
253
- // set download options
254
- $download->set_featured( false ); // there was no featured in legacy
255
- $download->set_redirect_only( false ); // there was no redirect only in legacy
256
- $download->set_members_only( ( 1 === absint( $legacy_download->members ) ) );
257
-
258
- // set download count
259
- $download->set_download_count( absint( $legacy_download->hits ) );
260
-
261
- // store new download
262
- download_monitor()->service( 'download_repository' )->persist( $download );
263
-
264
- // create new version
265
- /** @var DLM_Download_Version $new_version */
266
- $version = new DLM_Download_Version();
267
-
268
- // set download id on version
269
- $version->set_download_id( $download->get_id() );
270
-
271
- // set version name on version
272
- $version->set_version( $legacy_download->dlversion );
273
-
274
- // set download count in version
275
- $version->set_download_count( absint( $legacy_download->hits ) );
276
-
277
- // set mirrors
278
- $urls = array();
279
- if ( $legacy_download->mirrors ) {
280
- $urls = explode( "\n", $legacy_download->mirrors );
281
- }
282
- $urls = array_filter( array_merge( array( $legacy_download->filename ), (array) $urls ) );
283
- $version->set_mirrors( $urls );
284
-
285
- // set other version data
286
- $version->set_filesize( "" ); // empty filesize so it's calculated on persist
287
- $version->set_author( $download->get_author() );
288
-
289
- // version date
290
- $version_date = new DateTime( $legacy_download->postDate );
291
- if ( $version_date->format( 'U' ) < 0 ) {
292
- $version_date = new DateTime();
293
- }
294
- $version->set_date( $version_date );
295
-
296
- // persist new version
297
- download_monitor()->service( 'version_repository' )->persist( $version );
298
-
299
- // clear download transient
300
- download_monitor()->service( 'transient_manager' )->clear_versions_transient( $download->get_id() );
301
-
302
- // upgrade categories
303
- $terms = $wpdb->get_col( $wpdb->prepare( "SELECT T.name
304
- FROM `{$legacy_tables['tax']}` AS T
305
- LEFT JOIN `{$legacy_tables['rel']}` AS R ON T.id = R.taxonomy_id
306
- WHERE R.download_id = %d
307
- AND T.taxonomy = 'category'", $legacy_download->id ) );
308
- if ( $terms ) {
309
- $this->add_terms_to_download( $terms, 'dlm_download_category', $download->get_id() );
310
- }
311
-
312
- // upgrade tags
313
- $terms = $wpdb->get_col( $wpdb->prepare( "SELECT T.name
314
- FROM `{$legacy_tables['tax']}` AS T
315
- LEFT JOIN `{$legacy_tables['rel']}` AS R ON T.id = R.taxonomy_id
316
- WHERE R.download_id = %d
317
- AND T.taxonomy = 'tag'", $legacy_download->id ) );
318
- if ( $terms ) {
319
- $this->add_terms_to_download( $terms, 'dlm_download_tag', $download->get_id() );
320
- }
321
-
322
- // upgrade any custom meta data
323
- $meta_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_name, meta_value FROM {$legacy_tables['meta']} WHERE download_id = %d;", $legacy_download->id ) );
324
-
325
- foreach ( $meta_fields as $meta ) {
326
-
327
- // thumbnails were also stored as file_meta, so we add an exception check here
328
- if ( 'thumbnail' === $meta->meta_name ) {
329
- $this->upgrade_thumbnail( $meta->meta_value, $download->get_id() );
330
- continue;
331
- }
332
-
333
- // force was an old option that is no longer supported
334
- if ( 'force' === $meta->meta_name ) {
335
- continue;
336
- }
337
-
338
- update_post_meta( $download->get_id(), $meta->meta_name, $meta->meta_value );
339
- }
340
-
341
- // mark download as upgraded
342
- $queue->mark_download_upgraded( $legacy_download->id, $download->get_id() );
343
-
344
- return true;
345
- }
346
-
347
  }
1
+ <?php
2
+
3
+ class DLM_LU_Download_Upgrader {
4
+
5
+ /**
6
+ * Get legacy tables
7
+ *
8
+ * @return array
9
+ */
10
+ public function get_legacy_tables() {
11
+ global $wpdb;
12
+
13
+ return array(
14
+ 'files' => $wpdb->prefix . "download_monitor_files",
15
+ 'tax' => $wpdb->prefix . "download_monitor_taxonomies",
16
+ 'rel' => $wpdb->prefix . "download_monitor_relationships",
17
+ 'formats' => $wpdb->prefix . "download_monitor_formats",
18
+ 'stats' => $wpdb->prefix . "download_monitor_stats",
19
+ 'log' => $wpdb->prefix . "download_monitor_log",
20
+ 'meta' => $wpdb->prefix . "download_monitor_file_meta"
21
+ );
22
+ }
23
+
24
+ /**
25
+ * Add terms to download
26
+ *
27
+ * @param array $terms
28
+ * @param string $taxonomy
29
+ * @param int $download_id
30
+ */
31
+ private function add_terms_to_download( $terms, $taxonomy, $download_id ) {
32
+ $term_ids = array();
33
+
34
+ foreach ( $terms as $term ) {
35
+
36
+ try {
37
+ $term_obj = term_exists( $term, $taxonomy );
38
+
39
+ if ( $term_obj !== 0 && $term_obj !== null ) {
40
+ $term_id = $term_obj['term_id'];
41
+ } else {
42
+ $term_obj = wp_insert_term( $term, $taxonomy );
43
+
44
+ if ( is_wp_error( $term_obj ) ) {
45
+ throw new Exception( 'Error on wp_insert_term()' );
46
+ }
47
+
48
+ $term_id = $term_obj['term_id'];
49
+ }
50
+
51
+ $term_ids[] = $term_id;
52
+ } catch ( Exception $e ) {
53
+ DLM_Debug_Logger::log( "add_terms_to_download Exception: " . $e->getMessage() );
54
+ }
55
+
56
+ }
57
+
58
+ wp_set_post_terms( $download_id, $term_ids, $taxonomy );
59
+ }
60
+
61
+ /**
62
+ * Upgrade legacy download thumnail
63
+ *
64
+ * @param string $url URL to fetch attachment from
65
+ * @param int $download_id
66
+ *
67
+ * @return bool
68
+ */
69
+ private function upgrade_thumbnail( $url, $download_id ) {
70
+
71
+ $attachment_id = '';
72
+ $attachment_url = '';
73
+ $attachment_file = '';
74
+ $upload_dir = wp_upload_dir();
75
+ $attachment_array = array(
76
+ 'post_title' => '',
77
+ 'post_content' => '',
78
+ 'post_status' => 'inherit',
79
+ 'post_parent' => $download_id
80
+ );
81
+
82
+ // check if thumbnail is in a local directory, if it is we copy it
83
+ if ( strstr( $url, site_url() ) ) {
84
+ $abs_url = str_replace( trailingslashit( site_url() ), trailingslashit( ABSPATH ), $url );
85
+ $new_name = wp_unique_filename( $upload_dir['path'], basename( $url ) );
86
+ $new_url = trailingslashit( $upload_dir['path'] ) . $new_name;
87
+
88
+ if ( copy( $abs_url, $new_url ) ) {
89
+ $url = basename( $new_url );
90
+ }
91
+ }
92
+
93
+ try {
94
+
95
+ if ( ! strstr( $url, 'http' ) ) {
96
+
97
+ // Local file
98
+ $attachment_file = trailingslashit( $upload_dir['path'] ) . $url;
99
+
100
+ // We have the path, check it exists
101
+ if ( file_exists( $attachment_file ) ) {
102
+
103
+ $attachment_url = str_replace( trailingslashit( ABSPATH ), trailingslashit( site_url() ), $attachment_file );
104
+
105
+ if ( $info = wp_check_filetype( $attachment_file ) ) {
106
+ $attachment_array['post_mime_type'] = $info['type'];
107
+ } else {
108
+ throw new Exception( 'Invalid file type' );
109
+ }
110
+
111
+ $attachment_array['guid'] = $attachment_url;
112
+
113
+ $attachment_id = wp_insert_attachment( $attachment_array, $attachment_file, $download_id );
114
+
115
+ } else {
116
+ throw new Exception( 'Local image did not exist!' );
117
+ }
118
+
119
+ } else {
120
+
121
+ // if the URL is absolute, but does not contain address, then upload it assuming base_site_url
122
+ if ( preg_match( '|^/[\w\W]+$|', $url ) ) {
123
+ $url = rtrim( site_url(), '/' ) . $url;
124
+ }
125
+
126
+ // fetch remote file
127
+ $upload = $this->fetch_remote_file( $url );
128
+
129
+ if ( is_wp_error( $upload ) ) {
130
+ throw new Exception( 'Error fetching remote file' );
131
+ }
132
+
133
+ if ( $info = wp_check_filetype( $upload['file'] ) ) {
134
+ $attachment_array['post_mime_type'] = $info['type'];
135
+ } else {
136
+ throw new Exception( 'Invalid file type' );
137
+ }
138
+
139
+ $attachment_array['guid'] = $upload['url'];
140
+
141
+ $attachment_file = $upload['file'];
142
+
143
+ // as per wp-admin/includes/upload.php
144
+ $attachment_id = wp_insert_attachment( $attachment_array, $attachment_file, $download_id );
145
+
146
+ unset( $upload );
147
+ }
148
+
149
+
150
+ // set new meta data
151
+ if ( ! is_wp_error( $attachment_id ) && $attachment_id > 0 ) {
152
+ wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $attachment_file ) );
153
+ update_post_meta( $download_id, '_thumbnail_id', $attachment_id );
154
+ }
155
+
156
+ } catch ( Exception $e ) {
157
+ DLM_Debug_Logger::log( "Legacy Upgrade Thumbnail Exception: " . $e->getMessage() );
158
+
159
+ return false;
160
+ }
161
+
162
+ return true;
163
+ }
164
+
165
+ /**
166
+ * Fetch a remote file
167
+ *
168
+ * @param $url string
169
+ *
170
+ * @throws Exception
171
+ *
172
+ * @return array
173
+ */
174
+ private function fetch_remote_file( $url ) {
175
+
176
+ // extract the file name and extension from the url
177
+ $file_name = basename( $url );
178
+
179
+ // Ensure url is valid
180
+ $url = str_replace( " ", '%20', $url );
181
+
182
+ // Get the file
183
+ $response = wp_remote_get( $url, array(
184
+ 'timeout' => 10
185
+ ) );
186
+
187
+ // check for error in response
188
+ if ( is_wp_error( $response ) ) {
189
+ throw new Exception( "wp_remote_get response is WP error " );
190
+ }
191
+
192
+ // Upload the file
193
+ $upload = wp_upload_bits( $file_name, '', wp_remote_retrieve_body( $response ) );
194
+
195
+ if ( $upload['error'] ) {
196
+ throw new Exception( $upload['error'] );
197
+ }
198
+
199
+ // Get filesize
200
+ $filesize = filesize( $upload['file'] );
201
+
202
+ // check if filesize is greater than 0
203
+ if ( 0 == $filesize ) {
204
+ @unlink( $upload['file'] );
205
+ unset( $upload );
206
+
207
+ throw new Exception( 'Zero size file downloaded' );
208
+ }
209
+
210
+ unset( $response );
211
+
212
+ return $upload;
213
+ }
214
+
215
+ /**
216
+ * Upgrade a single download item. Do NOT call this without it being in queue.
217
+ *
218
+ * @param $download_id
219
+ *
220
+ * @return bool
221
+ */
222
+ public function upgrade_download( $download_id ) {
223
+ global $wpdb;
224
+
225
+ $queue = new DLM_LU_Download_Queue();
226
+
227
+ $legacy_tables = $this->get_legacy_tables();
228
+
229
+ // mark download upgrading
230
+ $queue->mark_download_upgrading( $download_id );
231
+
232
+ // get legacy download information
233
+ $legacy_download = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `" . $legacy_tables['files'] . "` WHERE `id` = %d ;", $download_id ) );
234
+
235
+ // create new Download object
236
+ $download = new DLM_Download();
237
+ $download->set_status( 'publish' );
238
+ $download->set_author( 1 );
239
+
240
+ // get user ID of user that created legacy download
241
+ if ( ! empty( $legacy_download->user ) ) {
242
+ $user = get_user_by( 'login', $legacy_download->user );
243
+ if ( $user ) {
244
+ $download->set_author( $user->ID );
245
+ }
246
+ }
247
+
248
+ // set title & description
249
+ $download->set_title( $legacy_download->title );
250
+ $download->set_description( $legacy_download->file_description );
251
+ $download->set_excerpt( "" );
252
+
253
+ // set download options
254
+ $download->set_featured( false ); // there was no featured in legacy
255
+ $download->set_redirect_only( false ); // there was no redirect only in legacy
256
+ $download->set_members_only( ( 1 === absint( $legacy_download->members ) ) );
257
+
258
+ // set download count
259
+ $download->set_download_count( absint( $legacy_download->hits ) );
260
+
261
+ // store new download
262
+ download_monitor()->service( 'download_repository' )->persist( $download );
263
+
264
+ // create new version
265
+ /** @var DLM_Download_Version $new_version */
266
+ $version = new DLM_Download_Version();
267
+
268
+ // set download id on version
269
+ $version->set_download_id( $download->get_id() );
270
+
271
+ // set version name on version
272
+ $version->set_version( $legacy_download->dlversion );
273
+
274
+ // set download count in version
275
+ $version->set_download_count( absint( $legacy_download->hits ) );
276
+
277
+ // set mirrors
278
+ $urls = array();
279
+ if ( $legacy_download->mirrors ) {
280
+ $urls = explode( "\n", $legacy_download->mirrors );
281
+ }
282
+ $urls = array_filter( array_merge( array( $legacy_download->filename ), (array) $urls ) );
283
+ $version->set_mirrors( $urls );
284
+
285
+ // set other version data
286
+ $version->set_filesize( "" ); // empty filesize so it's calculated on persist
287
+ $version->set_author( $download->get_author() );
288
+
289
+ // version date
290
+ $version_date = new DateTime( $legacy_download->postDate );
291
+ if ( $version_date->format( 'U' ) < 0 ) {
292
+ $version_date = new DateTime();
293
+ }
294
+ $version->set_date( $version_date );
295
+
296
+ // persist new version
297
+ download_monitor()->service( 'version_repository' )->persist( $version );
298
+
299
+ // clear download transient
300
+ download_monitor()->service( 'transient_manager' )->clear_versions_transient( $download->get_id() );
301
+
302
+ // upgrade categories
303
+ $terms = $wpdb->get_col( $wpdb->prepare( "SELECT T.name
304
+ FROM `{$legacy_tables['tax']}` AS T
305
+ LEFT JOIN `{$legacy_tables['rel']}` AS R ON T.id = R.taxonomy_id
306
+ WHERE R.download_id = %d
307
+ AND T.taxonomy = 'category'", $legacy_download->id ) );
308
+ if ( $terms ) {
309
+ $this->add_terms_to_download( $terms, 'dlm_download_category', $download->get_id() );
310
+ }
311
+
312
+ // upgrade tags
313
+ $terms = $wpdb->get_col( $wpdb->prepare( "SELECT T.name
314
+ FROM `{$legacy_tables['tax']}` AS T
315
+ LEFT JOIN `{$legacy_tables['rel']}` AS R ON T.id = R.taxonomy_id
316
+ WHERE R.download_id = %d
317
+ AND T.taxonomy = 'tag'", $legacy_download->id ) );
318
+ if ( $terms ) {
319
+ $this->add_terms_to_download( $terms, 'dlm_download_tag', $download->get_id() );
320
+ }
321
+
322
+ // upgrade any custom meta data
323
+ $meta_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_name, meta_value FROM {$legacy_tables['meta']} WHERE download_id = %d;", $legacy_download->id ) );
324
+
325
+ foreach ( $meta_fields as $meta ) {
326
+
327
+ // thumbnails were also stored as file_meta, so we add an exception check here
328
+ if ( 'thumbnail' === $meta->meta_name ) {
329
+ $this->upgrade_thumbnail( $meta->meta_value, $download->get_id() );
330
+ continue;
331
+ }
332
+
333
+ // force was an old option that is no longer supported
334
+ if ( 'force' === $meta->meta_name ) {
335
+ continue;
336
+ }
337
+
338
+ update_post_meta( $download->get_id(), $meta->meta_name, $meta->meta_value );
339
+ }
340
+
341
+ // mark download as upgraded
342
+ $queue->mark_download_upgraded( $legacy_download->id, $download->get_id() );
343
+
344
+ return true;
345
+ }
346
+
347
  }
src/LegacyUpgrader/Message.php CHANGED
@@ -1,48 +1,48 @@
1
- <?php
2
-
3
- class DLM_LU_Message {
4
-
5
- const OPTION_HIDE = 'dlm_lu_notice_hide';
6
-
7
- /**
8
- * private void
9
- */
10
- private function catch_hide_message() {
11
- if ( isset( $_GET['dlm_lu_hide_notice'] ) ) {
12
- $this->hide_message();
13
- }
14
- }
15
-
16
- /**
17
- * @return void
18
- */
19
- public function hide_message() {
20
- update_option( self::OPTION_HIDE, 1 );
21
- }
22
-
23
- /**
24
- * @return bool
25
- */
26
- private function is_hidden() {
27
- return ( 1 === absint( get_option( self::OPTION_HIDE, 0 ) ) );
28
- }
29
-
30
- /**
31
- * @return void
32
- */
33
- public function display() {
34
- $this->catch_hide_message();
35
-
36
- if ( ( ! isset( $_GET['page'] ) || ( isset( $_GET['page'] ) && 'dlm_legacy_upgrade' != $_GET['page'] ) ) && ! $this->is_hidden() ) {
37
- add_action( 'admin_notices', array( $this, 'body' ) );
38
- }
39
- }
40
-
41
- /**
42
- * @return void
43
- */
44
- public function body() {
45
- $vm = new DLM_View_Manager();
46
- $vm->display( "notice-lu-upgrade" );
47
- }
48
  }
1
+ <?php
2
+
3
+ class DLM_LU_Message {
4
+
5
+ const OPTION_HIDE = 'dlm_lu_notice_hide';
6
+
7
+ /**
8
+ * private void
9
+ */
10
+ private function catch_hide_message() {
11
+ if ( isset( $_GET['dlm_lu_hide_notice'] ) ) {
12
+ $this->hide_message();
13
+ }
14
+ }
15
+
16
+ /**
17
+ * @return void
18
+ */
19
+ public function hide_message() {
20
+ update_option( self::OPTION_HIDE, 1 );
21
+ }
22
+
23
+ /**
24
+ * @return bool
25
+ */
26
+ private function is_hidden() {
27
+ return ( 1 === absint( get_option( self::OPTION_HIDE, 0 ) ) );
28
+ }
29
+
30
+ /**
31
+ * @return void
32
+ */
33
+ public function display() {
34
+ $this->catch_hide_message();
35
+
36
+ if ( ( ! isset( $_GET['page'] ) || ( isset( $_GET['page'] ) && 'dlm_legacy_upgrade' != $_GET['page'] ) ) && ! $this->is_hidden() ) {
37
+ add_action( 'admin_notices', array( $this, 'body' ) );
38
+ }
39
+ }
40
+
41
+ /**
42
+ * @return void
43
+ */
44
+ public function body() {
45
+ $vm = new DLM_View_Manager();
46
+ $vm->display( "notice-lu-upgrade" );
47
+ }
48
  }
src/LegacyUpgrader/Page.php CHANGED
@@ -1,60 +1,60 @@
1
- <?php
2
-
3
- class DLM_LU_Page {
4
-
5
- /**
6
- * Setup hooks
7
- */
8
- public function setup() {
9
- add_action( 'admin_menu', array( $this, 'add_admin_menu' ), 12 );
10
- }
11
-
12
- /**
13
- * Add settings menu item
14
- */
15
- public function add_admin_menu() {
16
- // Settings page
17
- add_submenu_page( '_dlm_not_existing_slug', __( 'Legacy Upgrader', 'download-monitor' ), __( 'Legacy Upgrader', 'download-monitor' ), 'manage_downloads', 'dlm_legacy_upgrade', array(
18
- $this,
19
- 'view'
20
- ) );
21
- }
22
-
23
- /**
24
- * Display page
25
- */
26
- public function view() {
27
-
28
- $show_upgrader = true;
29
- $checker = new DLM_LU_Checker();
30
- if ( ! $checker->needs_upgrading() ) {
31
- $show_upgrader = false;
32
- }
33
-
34
- if ( isset( $_GET['dlm_lu_force'] ) ) {
35
- $show_upgrader = true;
36
- }
37
-
38
-
39
- ?>
40
- <div class="wrap">
41
- <h1><?php echo esc_html__( 'Download Monitor - Legacy Upgrade', 'download-monitor' ); ?></h1><br/>
42
- <p><?php printf( wp_kses_post( __( "Welcome to the Download Monitor Legacy Upgrader. On this page we will upgrade your old Download Monitor (legacy) data so it will work with the latest version. If you're on this page, it should mean that you updated to this version from Download Monitor %s. If you're unsure if this is correct, or you want to read more about the legacy upgrade, we've setup a page that will explain this process in a lot more detail. %sClick here%s if to view that page.", 'download-monitor' ) ), "<strong>3.x</strong>", "<a href='https://www.download-monitor.com/kb/legacy-upgrade?utm_source=plugin&utm_medium=dlm-lu-upgrade-page&utm_campaign=dlm-lu-more-information' target='_blank'>", "</a>" ); ?></p>
43
- <?php
44
- if ( ! $show_upgrader ) {
45
- ?>
46
- <p style='font-weight:bold;color:#a00;font-size:1.4em;'><?php echo esc_html__( "WARNING: We don't think your database needs upgrading. Only continue if you're 100% sure what you're doing!", 'download-monitor' ); ?></p>
47
- <a class="button button-primary button-large"
48
- href="<?php echo esc_url( add_query_arg( array( 'page' => 'dlm_legacy_upgrade', 'dlm_lu_force' => 'true' ), admin_url( 'options.php' ) ) ); ?>"><?php echo esc_html__( "I'm sure I want to run the upgrader anyway", 'download-monitor' ); ?></a>
49
- <?php
50
- } else {
51
- ?>
52
- <div id="dlm-legacy-upgrade-container"></div>
53
- <?php
54
- }
55
- ?>
56
- </div>
57
- <?php
58
- }
59
-
60
  }
1
+ <?php
2
+
3
+ class DLM_LU_Page {
4
+
5
+ /**
6
+ * Setup hooks
7
+ */
8
+ public function setup() {
9
+ add_action( 'admin_menu', array( $this, 'add_admin_menu' ), 12 );
10
+ }
11
+
12
+ /**
13
+ * Add settings menu item
14
+ */
15
+ public function add_admin_menu() {
16
+ // Settings page
17
+ add_submenu_page( '_dlm_not_existing_slug', __( 'Legacy Upgrader', 'download-monitor' ), __( 'Legacy Upgrader', 'download-monitor' ), 'manage_downloads', 'dlm_legacy_upgrade', array(
18
+ $this,
19
+ 'view'
20
+ ) );
21
+ }
22
+
23
+ /**
24
+ * Display page
25
+ */
26
+ public function view() {
27
+
28
+ $show_upgrader = true;
29
+ $checker = new DLM_LU_Checker();
30
+ if ( ! $checker->needs_upgrading() ) {
31
+ $show_upgrader = false;
32
+ }
33
+
34
+ if ( isset( $_GET['dlm_lu_force'] ) ) {
35
+ $show_upgrader = true;
36
+ }
37
+
38
+
39
+ ?>
40
+ <div class="wrap">
41
+ <h1><?php echo esc_html__( 'Download Monitor - Legacy Upgrade', 'download-monitor' ); ?></h1><br/>
42
+ <p><?php printf( wp_kses_post( __( "Welcome to the Download Monitor Legacy Upgrader. On this page we will upgrade your old Download Monitor (legacy) data so it will work with the latest version. If you're on this page, it should mean that you updated to this version from Download Monitor %s. If you're unsure if this is correct, or you want to read more about the legacy upgrade, we've setup a page that will explain this process in a lot more detail. %sClick here%s if to view that page.", 'download-monitor' ) ), "<strong>3.x</strong>", "<a href='https://www.download-monitor.com/kb/legacy-upgrade?utm_source=plugin&utm_medium=dlm-lu-upgrade-page&utm_campaign=dlm-lu-more-information' target='_blank'>", "</a>" ); ?></p>
43
+ <?php
44
+ if ( ! $show_upgrader ) {
45
+ ?>
46
+ <p style='font-weight:bold;color:#a00;font-size:1.4em;'><?php echo esc_html__( "WARNING: We don't think your database needs upgrading. Only continue if you're 100% sure what you're doing!", 'download-monitor' ); ?></p>
47
+ <a class="button button-primary button-large"
48
+ href="<?php echo esc_url( add_query_arg( array( 'page' => 'dlm_legacy_upgrade', 'dlm_lu_force' => 'true' ), admin_url( 'options.php' ) ) ); ?>"><?php echo esc_html__( "I'm sure I want to run the upgrader anyway", 'download-monitor' ); ?></a>
49
+ <?php
50
+ } else {
51
+ ?>
52
+ <div id="dlm-legacy-upgrade-container"></div>
53
+ <?php
54
+ }
55
+ ?>
56
+ </div>
57
+ <?php
58
+ }
59
+
60
  }
src/Polyfill/DateTimeImmutable/DateTimeInterface.php CHANGED
@@ -1,28 +1,28 @@
1
- <?php
2
-
3
- /**
4
- * Interface DateTimeInterface
5
- *
6
- * Forked from https://github.com/jesseschalken/php-date-time-immutable-polyfill
7
- */
8
-
9
- // To keep the result of (new \ReflectionClass('DateTimeInterface'))->_toString()
10
- // as close as possible to PHP>=5.5, do not add, remove, reorder or change the
11
- // signature of any methods in this interface.
12
-
13
- if ( ! interface_exists( "DateTimeInterface" ) ) {
14
- interface DateTimeInterface {
15
- public function format( $format );
16
-
17
- public function getTimezone();
18
-
19
- public function getOffset();
20
-
21
- public function getTimestamp();
22
-
23
- public function diff( $object, $absolute = false );
24
-
25
- public function __wakeup();
26
- }
27
- }
28
-
1
+ <?php
2
+
3
+ /**
4
+ * Interface DateTimeInterface
5
+ *
6
+ * Forked from https://github.com/jesseschalken/php-date-time-immutable-polyfill
7
+ */
8
+
9
+ // To keep the result of (new \ReflectionClass('DateTimeInterface'))->_toString()
10
+ // as close as possible to PHP>=5.5, do not add, remove, reorder or change the
11
+ // signature of any methods in this interface.
12
+
13
+ if ( ! interface_exists( "DateTimeInterface" ) ) {
14
+ interface DateTimeInterface {
15
+ public function format( $format );
16
+
17
+ public function getTimezone();
18
+
19
+ public function getOffset();
20
+
21
+ public function getTimestamp();
22
+
23
+ public function diff( $object, $absolute = false );
24
+
25
+ public function __wakeup();
26
+ }
27
+ }
28
+
src/Product/ProductErrorHandler.php CHANGED
@@ -1,90 +1,90 @@
1
- <?php
2
-
3
- // Exit if accessed directly
4
- if ( ! defined( 'ABSPATH' ) ) {
5
- exit;
6
- }
7
-
8
- class DLM_Product_Error_Handler {
9
-
10
- /**
11
- * @var DLM_Product_Error_Handler
12
- */
13
- private static $instance = null;
14
-
15
- /**
16
- * @var array<string>
17
- */
18
- private $errors = array();
19
-
20
- /**
21
- * Private constructor
22
- */
23
- private function __construct() {
24
- $this->setup();
25
- }
26
-
27
- /**
28
- * Singleton get method
29
- *
30
- * @since 1.0.0
31
- * @access public
32
- *
33
- * @return DLM_Product_Error_Handler
34
- */
35
- public static function get() {
36
- if ( null == self::$instance ) {
37
- self::$instance = new self();
38
- }
39
-
40
- return self::$instance;
41
- }
42
-
43
- private function setup() {
44
- $this->load();
45
- add_action( 'admin_notices', array( $this, 'display' ) );
46
- add_action( 'shutdown', array( $this, 'store' ) );
47
- }
48
-
49
- /**
50
- * Add message to error array
51
- *
52
- * @param string $message
53
- */
54
- public function add( $message ) {
55
- $this->errors[] = $message;
56
- }
57
-
58
- /**
59
- * Load error messages
60
- */
61
- public function load() {
62
- $this->errors = get_option( 'dlm_product_errors', array() );
63
- }
64
-
65
- /**
66
- * Store error messags
67
- */
68
- public function store() {
69
- update_option( 'dlm_product_errors', $this->errors );
70
- }
71
-
72
- /**
73
- * Display errors
74
- */
75
- public function display() {
76
- if ( ! empty( $this->errors ) ) {
77
- foreach ( $this->errors as $key => $error ) {
78
- ?>
79
- <div class="error">
80
- <p><?php echo wp_kses_post( $error ); ?></p>
81
- </div>
82
- <?php
83
- // unset error
84
- unset( $this->errors[ $key ] );
85
- }
86
- }
87
- }
88
-
89
-
90
  }
1
+ <?php
2
+
3
+ // Exit if accessed directly
4
+ if ( ! defined( 'ABSPATH' ) ) {
5
+ exit;
6
+ }
7
+
8
+ class DLM_Product_Error_Handler {
9
+
10
+ /**
11
+ * @var DLM_Product_Error_Handler
12
+ */
13
+ private static $instance = null;
14
+
15
+ /**
16
+ * @var array<string>
17
+ */
18
+ private $errors = array();
19
+
20
+ /**
21
+ * Private constructor
22
+ */
23
+ private function __construct() {
24
+ $this->setup();
25
+ }
26
+
27
+ /**
28
+ * Singleton get method
29
+ *
30
+ * @since 1.0.0
31
+ * @access public
32
+ *
33
+ * @return DLM_Product_Error_Handler
34
+ */
35
+ public static function get() {
36
+ if ( null == self::$instance ) {
37
+ self::$instance = new self();
38
+ }
39
+
40
+ return self::$instance;
41
+ }
42
+
43
+ private function setup() {
44
+ $this->load();
45
+ add_action( 'admin_notices', array( $this, 'display' ) );
46
+ add_action( 'shutdown', array( $this, 'store' ) );
47
+ }
48
+
49
+ /**
50
+ * Add message to error array
51
+ *
52
+ * @param string $message
53
+ */
54
+ public function add( $message ) {
55
+ $this->errors[] = $message;
56
+ }
57
+
58
+ /**
59
+ * Load error messages
60
+ */
61
+ public function load() {
62
+ $this->errors = get_option( 'dlm_product_errors', array() );
63
+ }
64
+
65
+ /**
66
+ * Store error messags
67
+ */
68
+ public function store() {
69
+ update_option( 'dlm_product_errors', $this->errors );
70
+ }
71
+
72
+ /**
73
+ * Display errors
74
+ */
75
+ public function display() {
76
+ if ( ! empty( $this->errors ) ) {
77
+ foreach ( $this->errors as $key => $error ) {
78
+ ?>
79
+ <div class="error">
80
+ <p><?php echo wp_kses_post( $error ); ?></p>
81
+ </div>
82
+ <?php
83
+ // unset error
84
+ unset( $this->errors[ $key ] );
85
+ }
86
+ }
87
+ }
88
+
89
+
90
  }
src/Product/ProductLicense.php CHANGED
@@ -1,110 +1,110 @@
1
- <?php
2
-
3
- class DLM_Product_License {
4
-
5
- /**
6
- * @var String
7
- */
8
- private $product_id;
9
-
10
- /**
11
- * @var String
12
- */
13
- private $key;
14
-
15
- /**
16
- * @var String
17
- */
18
- private $email;
19
-
20
- /**
21
- * @var String (active or inactive)
22
- */
23
- private $status;
24
-
25
- /**
26
- * Constructor
27
- *
28
- * @param String $product_id
29
- */
30
- public function __construct( $product_id ) {
31
-
32
- // Set Product ID
33
- $this->product_id = $product_id;
34
-
35
- // Load license data from DB
36
- $db_license = wp_parse_args( get_option( $this->product_id . '-license', array() ), array(
37
- 'key' => '',
38
- 'email' => get_option( 'admin_email', '' ),
39
- 'status' => 'inactive'
40
- ) );
41
-
42
- // Set properties
43
- $this->key = $db_license['key'];
44
- $this->email = $db_license['email'];
45
- $this->status = $db_license['status'];
46
- }
47
-
48
- /**
49
- * @return String
50
- */
51
- public function get_key() {
52
- return $this->key;
53
- }
54
-
55
- /**
56
- * @param String $key
57
- */
58
- public function set_key( $key ) {
59
- $this->key = $key;
60
- }
61
-
62
- /**
63
- * @return String
64
- */
65
- public function get_email() {
66
- return $this->email;
67
- }
68
-
69
- /**
70
- * @param String $email
71
- */
72
- public function set_email( $email ) {
73
- $this->email = $email;
74
- }
75
-
76
- /**
77
- * @return String
78
- */
79
- public function get_status() {
80
- return $this->status;
81
- }
82
-
83
- /**
84
- * @param String $status
85
- */
86
- public function set_status( $status ) {
87
- $this->status = $status;
88
- }
89
-
90
- /**
91
- * Return if license is active
92
- *
93
- * @return bool
94
- */
95
- public function is_active() {
96
- return ( 'active' === $this->status );
97
- }
98
-
99
- /**
100
- * Store license data in DB
101
- */
102
- public function store() {
103
- update_option( $this->product_id . '-license', array(
104
- 'key' => $this->get_key(),
105
- 'email' => $this->get_email(),
106
- 'status' => $this->get_status()
107
- ) );
108
- }
109
-
110
  }
1
+ <?php
2
+
3
+ class DLM_Product_License {
4
+
5
+ /**
6
+ * @var String
7
+ */
8
+ private $product_id;
9
+
10
+ /**
11
+ * @var String
12
+ */
13
+ private $key;
14
+
15
+ /**
16
+ * @var String
17
+ */
18
+ private $email;
19
+
20
+ /**
21
+ * @var String (active or inactive)
22
+ */
23
+ private $status;
24
+
25
+ /**
26
+ * Constructor
27
+ *
28
+ * @param String $product_id
29
+ */
30
+ public function __construct( $product_id ) {
31
+
32
+ // Set Product ID
33
+ $this->product_id = $product_id;
34
+
35
+ // Load license data from DB
36
+ $db_license = wp_parse_args( get_option( $this->product_id . '-license', array() ), array(
37
+ 'key' => '',
38
+ 'email' => get_option( 'admin_email', '' ),
39
+ 'status' => 'inactive'
40
+ ) );
41
+
42
+ // Set properties
43
+ $this->key = $db_license['key'];
44
+ $this->email = $db_license['email'];
45
+ $this->status = $db_license['status'];
46
+ }
47
+
48
+ /**
49
+ * @return String
50
+ */
51
+ public function get_key() {
52
+ return $this->key;
53
+ }
54
+
55
+ /**
56
+ * @param String $key
57
+ */
58
+ public function set_key( $key ) {
59
+ $this->key = $key;
60
+ }
61
+
62
+ /**
63
+ * @return String
64
+ */
65
+ public function get_email() {
66
+ return $this->email;
67
+ }
68
+
69
+ /**
70
+ * @param String $email
71
+ */
72
+ public function set_email( $email ) {
73
+ $this->email = $email;
74
+ }
75
+
76
+ /**
77
+ * @return String
78
+ */
79
+ public function get_status() {
80
+ return $this->status;
81
+ }
82
+
83
+ /**
84
+ * @param String $status
85
+ */
86
+ public function set_status( $status ) {
87
+ $this->status = $status;
88
+ }
89
+
90
+ /**
91
+ * Return if license is active
92
+ *
93
+ * @return bool
94
+ */
95
+ public function is_active() {
96
+ return ( 'active' === $this->status );
97
+ }
98
+
99
+ /**
100
+ * Store license data in DB
101
+ */
102
+ public function store() {
103
+ update_option( $this->product_id . '-license', array(
104
+ 'key' => $this->get_key(),
105
+ 'email' => $this->get_email(),
106
+ 'status' => $this->get_status()
107
+ ) );
108
+ }
109
+
110
  }
src/Product/ProductManager.php CHANGED
@@ -71,15 +71,9 @@ class DLM_Product_Manager {
71
  'dlm-email-lock' => array(
72
  'version' => '4.2.2',
73
  ),
74
- 'dlm-download-duplicator' => array(
75
- 'version' => '4.0.3',
76
- ),
77
  'dlm-csv-importer' => array(
78
  'version' => '4.1.3',
79
  ),
80
- 'dlm-email-notification' => array(
81
- 'version' => '4.1.7',
82
- ),
83
  'dlm-amazon-s3' => array(
84
  'version' => '4.0.3',
85
  ),
71
  'dlm-email-lock' => array(
72
  'version' => '4.2.2',
73
  ),
 
 
 
74
  'dlm-csv-importer' => array(
75
  'version' => '4.1.3',
76
  ),
 
 
 
77
  'dlm-amazon-s3' => array(
78
  'version' => '4.0.3',
79
  ),
src/Search.php CHANGED
@@ -1,51 +1,51 @@
1
- <?php
2
-
3
-
4
- /**
5
- * Class DLM_Search
6
- *
7
- * Add search support to Download Monitor downloads
8
- */
9
- class DLM_Search {
10
-
11
- /**
12
- * Setup the search
13
- */
14
- public function setup() {
15
-
16
- // frontend
17
- if ( ! is_admin() ) {
18
-
19
- if ( '1' == get_option( 'dlm_wp_search_enabled' ) ) {
20
- add_filter( 'post_type_link', array( $this, 'filter_download_permalink' ), 20, 2 );
21
- }
22
-
23
- }
24
-
25
- }
26
-
27
- /**
28
- * @param $post_link string
29
- * @param $post WP_Post
30
- *
31
- * @return string
32
- */
33
- public function filter_download_permalink( $post_link, $post ) {
34
- // check if we're filtering a dlm_download permalink in a search query
35
- if ( 'dlm_download' == $post->post_type && is_search() ) {
36
-
37
- // fetch download object
38
- try {
39
- /** @var DLM_Download $download */
40
- $download = download_monitor()->service( 'download_repository' )->retrieve_single( $post->ID );
41
-
42
- // allow this search download URL to be filtered
43
- return apply_filters( 'dlm_search_download_url', $download->get_the_download_link(), $download );
44
- } catch ( Exception $e ) {
45
- }
46
- }
47
-
48
- return $post_link;
49
- }
50
-
51
  }
1
+ <?php
2
+
3
+
4
+ /**
5
+ * Class DLM_Search
6
+ *
7
+ * Add search support to Download Monitor downloads
8
+ */
9
+ class DLM_Search {
10
+
11
+ /**
12
+ * Setup the search
13
+ */
14
+ public function setup() {
15
+
16
+ // frontend
17
+ if ( ! is_admin() ) {
18
+
19
+ if ( '1' == get_option( 'dlm_wp_search_enabled' ) ) {
20
+ add_filter( 'post_type_link', array( $this, 'filter_download_permalink' ), 20, 2 );
21
+ }
22
+
23
+ }
24
+
25
+ }
26
+
27
+ /**
28
+ * @param $post_link string
29
+ * @param $post WP_Post
30
+ *
31
+ * @return string
32
+ */
33
+ public function filter_download_permalink( $post_link, $post ) {
34
+ // check if we're filtering a dlm_download permalink in a search query
35
+ if ( 'dlm_download' == $post->post_type && is_search() ) {
36
+
37
+ // fetch download object
38
+ try {
39
+ /** @var DLM_Download $download */
40
+ $download = download_monitor()->service( 'download_repository' )->retrieve_single( $post->ID );
41
+
42
+ // allow this search download URL to be filtered
43
+ return apply_filters( 'dlm_search_download_url', $download->get_the_download_link(), $download );
44
+ } catch ( Exception $e ) {
45
+ }
46
+ }
47
+
48
+ return $post_link;
49
+ }
50
+
51
  }
src/TaxonomyManager.php CHANGED
@@ -1,98 +1,98 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit;
5
- } // Exit if accessed directly
6
-
7
- class DLM_Taxonomy_Manager {
8
-
9
- /**
10
- * Setup hooks
11
- */
12
- public function setup() {
13
- add_action( 'init', array( $this, 'register' ), 9 );
14
- }
15
-
16
- /**
17
- * Register Taxonomies
18
- */
19
- public function register() {
20
-
21
- // Register Download Category
22
- register_taxonomy(
23
- 'dlm_download_category',
24
- array( 'dlm_download' ),
25
- apply_filters(
26
- 'dlm_download_category_args',
27
- array(
28
- 'hierarchical' => true,
29
- 'update_count_callback' => '_update_post_term_count',
30
- 'label' => __( 'Categories', 'download-monitor' ),
31
- 'labels' => array(
32
- 'name' => __( 'Download Categories', 'download-monitor' ),
33
- 'menu_name' => __( 'Categories', 'download-monitor' ),
34
- 'singular_name' => __( 'Download Category', 'download-monitor' ),
35
- 'search_items' => __( 'Search Download Categories', 'download-monitor' ),
36
- 'all_items' => __( 'All Download Categories', 'download-monitor' ),
37
- 'parent_item' => __( 'Parent Download Category', 'download-monitor' ),
38
- 'parent_item_colon' => __( 'Parent Download Category', 'download-monitor' ),
39
- 'edit_item' => __( 'Edit Download Category', 'download-monitor' ),
40
- 'update_item' => __( 'Update Download Category', 'download-monitor' ),
41
- 'add_new_item' => __( 'Add New Download Category', 'download-monitor' ),
42
- 'new_item_name' => __( 'New Download Category Name', 'download-monitor' ),
43
- ),
44
- 'show_ui' => true,
45
- 'query_var' => true,
46
- 'public' => true,
47
- 'capabilities' => array(
48
- 'manage_terms' => 'manage_downloads',
49
- 'edit_terms' => 'manage_downloads',
50
- 'delete_terms' => 'manage_downloads',
51
- 'assign_terms' => 'manage_downloads',
52
- ),
53
- 'rewrite' => false,
54
- 'show_in_nav_menus' => false,
55
- 'show_in_rest' => true,
56
- )
57
- )
58
- );
59
-
60
- // Register Download Tag
61
- register_taxonomy(
62
- 'dlm_download_tag',
63
- array( 'dlm_download' ),
64
- apply_filters(
65
- 'dlm_download_tag_args',
66
- array(
67
- 'hierarchical' => false,
68
- 'label' => __( 'Tags', 'download-monitor' ),
69
- 'labels' => array(
70
- 'name' => __( 'Download Tags', 'download-monitor' ),
71
- 'menu_name' => __( 'Tags', 'download-monitor' ),
72
- 'singular_name' => __( 'Download Tag', 'download-monitor' ),
73
- 'search_items' => __( 'Search Download Tags', 'download-monitor' ),
74
- 'all_items' => __( 'All Download Tags', 'download-monitor' ),
75
- 'parent_item' => __( 'Parent Download Tag', 'download-monitor' ),
76
- 'parent_item_colon' => __( 'Parent Download Tag', 'download-monitor' ),
77
- 'edit_item' => __( 'Edit Download Tag', 'download-monitor' ),
78
- 'update_item' => __( 'Update Download Tag', 'download-monitor' ),
79
- 'add_new_item' => __( 'Add New Download Tag', 'download-monitor' ),
80
- 'new_item_name' => __( 'New Download Tag Name', 'download-monitor' ),
81
- ),
82
- 'show_ui' => true,
83
- 'query_var' => true,
84
- 'capabilities' => array(
85
- 'manage_terms' => 'manage_downloads',
86
- 'edit_terms' => 'manage_downloads',
87
- 'delete_terms' => 'manage_downloads',
88
- 'assign_terms' => 'manage_downloads',
89
- ),
90
- 'rewrite' => false,
91
- 'show_in_nav_menus' => false,
92
- 'show_in_rest' => true,
93
- )
94
- )
95
- );
96
- }
97
-
98
- }
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ } // Exit if accessed directly
6
+
7
+ class DLM_Taxonomy_Manager {
8
+
9
+ /**
10
+ * Setup hooks
11
+ */
12
+ public function setup() {
13
+ add_action( 'init', array( $this, 'register' ), 9 );
14
+ }
15
+
16
+ /**
17
+ * Register Taxonomies
18
+ */
19
+ public function register() {
20
+
21
+ // Register Download Category
22
+ register_taxonomy(
23
+ 'dlm_download_category',
24
+ array( 'dlm_download' ),
25
+ apply_filters(
26
+ 'dlm_download_category_args',
27
+ array(
28
+ 'hierarchical' => true,
29
+ 'update_count_callback' => '_update_post_term_count',
30
+ 'label' => __( 'Categories', 'download-monitor' ),
31
+ 'labels' => array(
32
+ 'name' => __( 'Download Categories', 'download-monitor' ),
33
+ 'menu_name' => __( 'Categories', 'download-monitor' ),
34
+ 'singular_name' => __( 'Download Category', 'download-monitor' ),
35
+ 'search_items' => __( 'Search Download Categories', 'download-monitor' ),
36
+ 'all_items' => __( 'All Download Categories', 'download-monitor' ),
37
+ 'parent_item' => __( 'Parent Download Category', 'download-monitor' ),
38
+ 'parent_item_colon' => __( 'Parent Download Category', 'download-monitor' ),
39
+ 'edit_item' => __( 'Edit Download Category', 'download-monitor' ),
40
+ 'update_item' => __( 'Update Download Category', 'download-monitor' ),
41
+ 'add_new_item' => __( 'Add New Download Category', 'download-monitor' ),
42
+ 'new_item_name' => __( 'New Download Category Name', 'download-monitor' ),
43
+ ),
44
+ 'show_ui' => true,
45
+ 'query_var' => true,
46
+ 'public' => true,
47
+ 'capabilities' => array(
48
+ 'manage_terms' => 'manage_downloads',
49
+ 'edit_terms' => 'manage_downloads',
50
+ 'delete_terms' => 'manage_downloads',
51
+ 'assign_terms' => 'manage_downloads',
52
+ ),
53
+ 'rewrite' => false,
54
+ 'show_in_nav_menus' => false,
55
+ 'show_in_rest' => true,
56
+ )
57
+ )
58
+ );
59
+
60
+ // Register Download Tag
61
+ register_taxonomy(
62
+ 'dlm_download_tag',
63
+ array( 'dlm_download' ),
64
+ apply_filters(
65
+ 'dlm_download_tag_args',
66
+ array(
67
+ 'hierarchical' => false,
68
+ 'label' => __( 'Tags', 'download-monitor' ),
69
+ 'labels' => array(
70
+ 'name' => __( 'Download Tags', 'download-monitor' ),
71
+ 'menu_name' => __( 'Tags', 'download-monitor' ),
72
+ 'singular_name' => __( 'Download Tag', 'download-monitor' ),
73
+ 'search_items' => __( 'Search Download Tags', 'download-monitor' ),
74
+ 'all_items' => __( 'All Download Tags', 'download-monitor' ),
75
+ 'parent_item' => __( 'Parent Download Tag', 'download-monitor' ),
76
+ 'parent_item_colon' => __( 'Parent Download Tag', 'download-monitor' ),
77
+ 'edit_item' => __( 'Edit Download Tag', 'download-monitor' ),
78
+ 'update_item' => __( 'Update Download Tag', 'download-monitor' ),
79
+ 'add_new_item' => __( 'Add New Download Tag', 'download-monitor' ),
80
+ 'new_item_name' => __( 'New Download Tag Name', 'download-monitor' ),
81
+ ),
82
+ 'show_ui' => true,
83
+ 'query_var' => true,
84
+ 'capabilities' => array(
85
+ 'manage_terms' => 'manage_downloads',
86
+ 'edit_terms' => 'manage_downloads',
87
+ 'delete_terms' => 'manage_downloads',
88
+ 'assign_terms' => 'manage_downloads',
89
+ ),
90
+ 'rewrite' => false,
91
+ 'show_in_nav_menus' => false,
92
+ 'show_in_rest' => true,
93
+ )
94
+ )
95
+ );
96
+ }
97
+
98
+ }
src/TransientManager.php CHANGED
@@ -1,33 +1,33 @@
1
- <?php
2
-
3
- class DLM_Transient_Manager {
4
-
5
- /**
6
- * Clear download version transient
7
- *
8
- * @param int $download_id
9
- *
10
- * @return bool
11
- */
12
- public function clear_versions_transient( $download_id ) {
13
-
14
- delete_transient( 'dlm_file_version_ids_' . $download_id );
15
-
16
- return true;
17
- }
18
-
19
- /**
20
- * Clear all download version transients
21
- *
22
- * @return bool
23
- */
24
- public function clear_all_version_transients() {
25
- global $wpdb;
26
-
27
- $wpdb->query( "DELETE FROM {$wpdb->options} WHERE `option_name` LIKE '_transient_timeout_dlm_file_version_%';" );
28
- $wpdb->query( "DELETE FROM {$wpdb->options} WHERE `option_name` LIKE '_transient_dlm_file_version_%';" );
29
-
30
- return true;
31
- }
32
-
33
  }
1
+ <?php
2
+
3
+ class DLM_Transient_Manager {
4
+
5
+ /**
6
+ * Clear download version transient
7
+ *
8
+ * @param int $download_id
9
+ *
10
+ * @return bool
11
+ */
12
+ public function clear_versions_transient( $download_id ) {
13
+
14
+ delete_transient( 'dlm_file_version_ids_' . $download_id );
15
+
16
+ return true;
17
+ }
18
+
19
+ /**
20
+ * Clear all download version transients
21
+ *
22
+ * @return bool
23
+ */
24
+ public function clear_all_version_transients() {
25
+ global $wpdb;
26
+
27
+ $wpdb->query( "DELETE FROM {$wpdb->options} WHERE `option_name` LIKE '_transient_timeout_dlm_file_version_%';" );
28
+ $wpdb->query( "DELETE FROM {$wpdb->options} WHERE `option_name` LIKE '_transient_dlm_file_version_%';" );
29
+
30
+ return true;
31
+ }
32
+
33
  }
src/Utils.php CHANGED
@@ -17,11 +17,11 @@ abstract class DLM_Utils {
17
  }
18
 
19
  if ( isset( $_SERVER["HTTP_X_REAL_IP"] ) ) {
20
- $ip = sanitize_text_field( wp_unslash( $ $_SERVER["HTTP_X_REAL_IP"] ) );
21
  }
22
 
23
  if ( isset( $_SERVER["HTTP_CF_CONNECTING_IP"] ) ) {
24
- $ip = sanitize_text_field( wp_unslash( $ $_SERVER["HTTP_CF_CONNECTING_IP"] ) );
25
  }
26
 
27
  if ( ( '1' == get_option( 'dlm_allow_x_forwarded_for', 0 ) ) && ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
17
  }
18
 
19
  if ( isset( $_SERVER["HTTP_X_REAL_IP"] ) ) {
20
+ $ip = sanitize_text_field( wp_unslash( $_SERVER["HTTP_X_REAL_IP"] ) );
21
  }
22
 
23
  if ( isset( $_SERVER["HTTP_CF_CONNECTING_IP"] ) ) {
24
+ $ip = sanitize_text_field( wp_unslash( $_SERVER["HTTP_CF_CONNECTING_IP"] ) );
25
  }
26
 
27
  if ( ( '1' == get_option( 'dlm_allow_x_forwarded_for', 0 ) ) && ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
src/Version/VersionRepository.php CHANGED
@@ -1,40 +1,40 @@
1
- <?php
2
-
3
- interface DLM_Version_Repository {
4
-
5
- /**
6
- * Retrieve versions
7
- *
8
- * @param array $filters
9
- * @param int $limit
10
- * @param int $offset
11
- *
12
- * @return array<DLM_Download_Version>
13
- */
14
- public function retrieve( $filters=array(), $limit=0, $offset=0 );
15
-
16
- /**
17
- * Retrieve single version
18
- *
19
- * @param int $id
20
- *
21
- * @return DLM_Download_Version
22
- */
23
- public function retrieve_single( $id );
24
-
25
- /**
26
- * Returns number of rows for given filters
27
- *
28
- * @param array $filters
29
- *
30
- * @return int
31
- */
32
- public function num_rows( $filters=array() );
33
-
34
- /**
35
- * @param DLM_Download_Version $version
36
- *
37
- * @return bool
38
- */
39
- public function persist( $version );
40
  }
1
+ <?php
2
+
3
+ interface DLM_Version_Repository {
4
+
5
+ /**
6
+ * Retrieve versions
7
+ *
8
+ * @param array $filters
9
+ * @param int $limit
10
+ * @param int $offset
11
+ *
12
+ * @return array<DLM_Download_Version>
13
+ */
14
+ public function retrieve( $filters=array(), $limit=0, $offset=0 );
15
+
16
+ /**
17
+ * Retrieve single version
18
+ *
19
+ * @param int $id
20
+ *
21
+ * @return DLM_Download_Version
22
+ */
23
+ public function retrieve_single( $id );
24
+
25
+ /**
26
+ * Returns number of rows for given filters
27
+ *
28
+ * @param array $filters
29
+ *
30
+ * @return int
31
+ */
32
+ public function num_rows( $filters=array() );
33
+
34
+ /**
35
+ * @param DLM_Download_Version $version
36
+ *
37
+ * @return bool
38
+ */
39
+ public function persist( $version );
40
  }
src/Widgets/Manager.php CHANGED
@@ -1,23 +1,23 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit;
5
- } // Exit if accessed directly
6
-
7
- class DLM_Widget_Manager {
8
-
9
- /**
10
- * Setup the actions
11
- */
12
- public function setup() {
13
- add_action( 'widgets_init', array( $this, 'register_widgets' ) );
14
- }
15
-
16
- /**
17
- * Register the widgets
18
- */
19
- public function register_widgets() {
20
- register_widget( 'DLM_Widget_Downloads' );
21
- }
22
-
23
  }
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ } // Exit if accessed directly
6
+
7
+ class DLM_Widget_Manager {
8
+
9
+ /**
10
+ * Setup the actions
11
+ */
12
+ public function setup() {
13
+ add_action( 'widgets_init', array( $this, 'register_widgets' ) );
14
+ }
15
+
16
+ /**
17
+ * Register the widgets
18
+ */
19
+ public function register_widgets() {
20
+ register_widget( 'DLM_Widget_Downloads' );
21
+ }
22
+
23
  }
templates/content-download-box.php CHANGED
@@ -1,35 +1,35 @@
1
- <?php
2
- /**
3
- * Detailed download output
4
- */
5
-
6
- if ( ! defined( 'ABSPATH' ) ) {
7
- exit;
8
- } // Exit if accessed directly
9
-
10
- ?>
11
-
12
- <aside class="download-box">
13
-
14
- <?php $dlm_download->the_image(); ?>
15
-
16
- <div
17
- class="download-count"><?php printf( esc_attr(_n( '1 download', '%d downloads', $dlm_download->get_download_count(), 'download-monitor' )), esc_html( $dlm_download->get_download_count() ) ) ?></div>
18
-
19
- <div class="download-box-content">
20
-
21
- <h1><?php $dlm_download->the_title(); ?></h1>
22
-
23
- <?php $dlm_download->the_excerpt(); ?>
24
-
25
- <a class="download-button" title="<?php if ( $dlm_download->get_version()->has_version_number() ) {
26
- printf( esc_html__( 'Version %s', 'download-monitor' ), esc_html( $dlm_download->get_version()->get_version_number() ) );
27
- } ?>" href="<?php $dlm_download->the_download_link(); ?>" rel="nofollow">
28
- <?php echo esc_html__( 'Download File', 'download-monitor' ); ?>
29
- <small><?php echo esc_html( $dlm_download->get_version()->get_filename() ); ?> &ndash; <?php echo esc_html( $dlm_download->get_version()->get_filesize_formatted() ); ?></small>
30
- </a>
31
-
32
- </div>
33
- </aside>
34
-
35
-
1
+ <?php
2
+ /**
3
+ * Detailed download output
4
+ */
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ } // Exit if accessed directly
9
+
10
+ ?>
11
+
12
+ <aside class="download-box">
13
+
14
+ <?php $dlm_download->the_image(); ?>
15
+
16
+ <div
17
+ class="download-count"><?php printf( esc_attr(_n( '1 download', '%d downloads', $dlm_download->get_download_count(), 'download-monitor' )), esc_html( $dlm_download->get_download_count() ) ) ?></div>
18
+
19
+ <div class="download-box-content">
20
+
21
+ <h1><?php $dlm_download->the_title(); ?></h1>
22
+
23
+ <?php $dlm_download->the_excerpt(); ?>
24
+
25
+ <a class="download-button" title="<?php if ( $dlm_download->get_version()->has_version_number() ) {
26
+ printf( esc_html__( 'Version %s', 'download-monitor' ), esc_html( $dlm_download->get_version()->get_version_number() ) );
27
+ } ?>" href="<?php $dlm_download->the_download_link(); ?>" rel="nofollow">
28
+ <?php echo esc_html__( 'Download File', 'download-monitor' ); ?>
29
+ <small><?php echo esc_html( $dlm_download->get_version()->get_filename() ); ?> &ndash; <?php echo esc_html( $dlm_download->get_version()->get_filesize_formatted() ); ?></small>
30
+ </a>
31
+
32
+ </div>
33
+ </aside>
34
+
35
+
templates/content-download-filename.php CHANGED
@@ -1,17 +1,17 @@
1
- <?php
2
- /**
3
- * Default output for a download via the [download] shortcode
4
- */
5
-
6
- if ( ! defined( 'ABSPATH' ) ) {
7
- exit;
8
- } // Exit if accessed directly
9
-
10
- ?>
11
- <a class="download-link filetype-icon <?php echo 'filetype-' . esc_html( $dlm_download->get_version()->get_filetype() ); ?>"
12
- title="<?php if ( $dlm_download->get_version()->has_version_number() ) {
13
- printf( esc_html__( 'Version %s', 'download-monitor' ), esc_html( $dlm_download->get_version()->get_version_number() ) );
14
- } ?>" href="<?php $dlm_download->the_download_link(); ?>" rel="nofollow">
15
- <?php echo esc_html( $dlm_download->get_version()->get_filename() ); ?>
16
- (<?php printf( esc_html( _n( '1 download', '%d downloads', $dlm_download->get_download_count(), 'download-monitor' ) ), esc_html( $dlm_download->get_download_count() ) ) ?>)
17
  </a>
1
+ <?php
2
+ /**
3
+ * Default output for a download via the [download] shortcode
4
+ */
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ } // Exit if accessed directly
9
+
10
+ ?>
11
+ <a class="download-link filetype-icon <?php echo 'filetype-' . esc_html( $dlm_download->get_version()->get_filetype() ); ?>"
12
+ title="<?php if ( $dlm_download->get_version()->has_version_number() ) {
13
+ printf( esc_html__( 'Version %s', 'download-monitor' ), esc_html( $dlm_download->get_version()->get_version_number() ) );
14
+ } ?>" href="<?php $dlm_download->the_download_link(); ?>" rel="nofollow">
15
+ <?php echo esc_html( $dlm_download->get_version()->get_filename() ); ?>
16
+ (<?php printf( esc_html( _n( '1 download', '%d downloads', $dlm_download->get_download_count(), 'download-monitor' ) ), esc_html( $dlm_download->get_download_count() ) ) ?>)
17
  </a>
templates/content-download-no-version.php CHANGED
@@ -1,13 +1,13 @@
1
- <?php
2
- /**
3
- * Default output for a download via the [download] shortcode
4
- */
5
-
6
- if ( ! defined( 'ABSPATH' ) ) {
7
- exit;
8
- } // Exit if accessed directly
9
-
10
- ?>
11
- <a class="download-link" title="<?php echo esc_attr__( 'Please set a version in your WordPress admin', 'download-monitor' ); ?>" href="#" rel="nofollow">
12
- "<?php $dlm_download->the_title(); ?>" <strong><?php echo esc_html__( 'has no version set!', 'download-monitor' ); ?></strong>
13
  </a>
1
+ <?php
2
+ /**
3
+ * Default output for a download via the [download] shortcode
4
+ */
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ } // Exit if accessed directly
9
+
10
+ ?>
11
+ <a class="download-link" title="<?php echo esc_attr__( 'Please set a version in your WordPress admin', 'download-monitor' ); ?>" href="#" rel="nofollow">
12
+ "<?php $dlm_download->the_title(); ?>" <strong><?php echo esc_html__( 'has no version set!', 'download-monitor' ); ?></strong>
13
  </a>
templates/content-download-title.php CHANGED
@@ -1,15 +1,15 @@
1
- <?php
2
- /**
3
- * Shows title only.
4
- */
5
-
6
- if ( ! defined( 'ABSPATH' ) ) {
7
- exit;
8
- } // Exit if accessed directly
9
-
10
- ?>
11
- <a class="download-link" title="<?php if ( $dlm_download->get_version()->has_version_number() ) {
12
- printf( esc_html__( 'Version %s', 'download-monitor' ), esc_html( $dlm_download->get_version()->get_version_number() ) );
13
- } ?>" href="<?php esc_url( $dlm_download->the_download_link() ); ?>" rel="nofollow">
14
- <?php $dlm_download->the_title(); ?>
15
  </a>
1
+ <?php
2
+ /**
3
+ * Shows title only.
4
+ */
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ } // Exit if accessed directly
9
+
10
+ ?>
11
+ <a class="download-link" title="<?php if ( $dlm_download->get_version()->has_version_number() ) {
12
+ printf( esc_html__( 'Version %s', 'download-monitor' ), esc_html( $dlm_download->get_version()->get_version_number() ) );
13
+ } ?>" href="<?php esc_url( $dlm_download->the_download_link() ); ?>" rel="nofollow">
14
+ <?php $dlm_download->the_title(); ?>
15
  </a>
templates/content-download-version-list.php CHANGED
@@ -1,32 +1,32 @@
1
- <?php
2
- /**
3
- * List of versions
4
- */
5
-
6
- if ( ! defined( 'ABSPATH' ) ) {
7
- exit;
8
- } // Exit if accessed directly
9
-
10
- $versions = $dlm_download->get_versions();
11
-
12
- if ( $versions ) : ?>
13
- <ul class="download-versions">
14
- <?php
15
- /** @var DLM_Download_Version $version */
16
- foreach ( $versions as $version ) {
17
-
18
- // set loop version as current version
19
- $dlm_download->set_version( $version );
20
- ?>
21
- <li><a class="download-link"
22
- title="<?php printf( esc_attr(_n( 'Downloaded 1 time', 'Downloaded %d times', $dlm_download->get_download_count(), 'download-monitor' )), esc_html( $dlm_download->get_download_count() ) ) ?>"
23
- href="<?php $dlm_download->the_download_link(); ?>" rel="nofollow">
24
- <?php echo esc_html( $version->get_filename() ); ?> <?php if ( $version->has_version_number() ) {
25
- echo '- ' . esc_html( $version->get_version_number() );
26
- } ?>
27
- </a></li>
28
- <?php
29
- }
30
- ?>
31
- </ul>
32
  <?php endif; ?>
1
+ <?php
2
+ /**
3
+ * List of versions
4
+ */
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ } // Exit if accessed directly
9
+
10
+ $versions = $dlm_download->get_versions();
11
+
12
+ if ( $versions ) : ?>
13
+ <ul class="download-versions">
14
+ <?php
15
+ /** @var DLM_Download_Version $version */
16
+ foreach ( $versions as $version ) {
17
+
18
+ // set loop version as current version
19
+ $dlm_download->set_version( $version );
20
+ ?>
21
+ <li><a class="download-link"
22
+ title="<?php printf( esc_attr(_n( 'Downloaded 1 time', 'Downloaded %d times', $dlm_download->get_download_count(), 'download-monitor' )), esc_html( $dlm_download->get_download_count() ) ) ?>"
23
+ href="<?php $dlm_download->the_download_link(); ?>" rel="nofollow">
24
+ <?php echo esc_html( $version->get_filename() ); ?> <?php if ( $version->has_version_number() ) {
25
+ echo '- ' . esc_html( $version->get_version_number() );
26
+ } ?>
27
+ </a></li>
28
+ <?php
29
+ }
30
+ ?>
31
+ </ul>
32
  <?php endif; ?>
templates/no-access.php CHANGED
@@ -1,20 +1,20 @@
1
- <?php
2
- /**
3
- * Download No Access
4
- */
5
-
6
- if ( ! defined( 'ABSPATH' ) ) {
7
- exit;
8
- } // Exit if accessed directly
9
-
10
- /** @var DLM_Download $download */
11
-
12
- ?>
13
-
14
- <?php do_action( 'dlm_no_access_before_message', $download ); ?>
15
- <?php if ( ! empty( $no_access_message ) ) : ?>
16
-
17
- <p><?php echo wp_kses_post( $no_access_message ); ?></p>
18
- <?php endif; ?>
19
-
20
- <?php do_action( 'dlm_no_access_after_message', $download ); ?>
1
+ <?php
2
+ /**
3
+ * Download No Access
4
+ */
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ } // Exit if accessed directly
9
+
10
+ /** @var DLM_Download $download */
11
+
12
+ ?>
13
+
14
+ <?php do_action( 'dlm_no_access_before_message', $download ); ?>
15
+ <?php if ( ! empty( $no_access_message ) ) : ?>
16
+
17
+ <p><?php echo wp_kses_post( $no_access_message ); ?></p>
18
+ <?php endif; ?>
19
+
20
+ <?php do_action( 'dlm_no_access_after_message', $download ); ?>
templates/pagination.php CHANGED
@@ -1,33 +1,33 @@
1
- <?php
2
- /**
3
- * Pagination - Show numbered pagination.
4
- */
5
-
6
- if ( ! defined( 'ABSPATH' ) ) {
7
- exit;
8
- } // Exit if accessed directly
9
-
10
- if ( $pages <= 1 ) {
11
- return;
12
- }
13
- ?>
14
- <nav class="download-monitor-pagination">
15
- <?php
16
- echo wp_kses_post( paginate_links(
17
- apply_filters(
18
- 'download_monitor_pagination_args',
19
- array(
20
- 'base' => str_replace( 999999999, '%#%', get_pagenum_link( 999999999 ) ),
21
- 'format' => '',
22
- 'current' => max( 1, get_query_var( 'paged' ) ),
23
- 'total' => $pages,
24
- 'prev_text' => '&larr;',
25
- 'next_text' => '&rarr;',
26
- 'type' => 'list',
27
- 'end_size' => 3,
28
- 'mid_size' => 3,
29
- )
30
- )
31
- ) );
32
- ?>
33
- </nav>
1
+ <?php
2
+ /**
3
+ * Pagination - Show numbered pagination.
4
+ */
5
+
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ } // Exit if accessed directly
9
+
10
+ if ( $pages <= 1 ) {
11
+ return;
12
+ }
13
+ ?>
14
+ <nav class="download-monitor-pagination">
15
+ <?php
16
+ echo wp_kses_post( paginate_links(
17
+ apply_filters(
18
+ 'download_monitor_pagination_args',
19
+ array(
20
+ 'base' => str_replace( 999999999, '%#%', get_pagenum_link( 999999999 ) ),
21
+ 'format' => '',
22
+ 'current' => max( 1, get_query_var( 'paged' ) ),
23
+ 'total' => $pages,
24
+ 'prev_text' => '&larr;',
25
+ 'next_text' => '&rarr;',
26
+ 'type' => 'list',
27
+ 'end_size' => 3,
28
+ 'mid_size' => 3,
29
+ )
30
+ )
31
+ ) );
32
+ ?>
33
+ </nav>
templates/shop/cart/empty.php CHANGED
@@ -1,6 +1,6 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
- } // Exit if accessed directly
5
- ?>
6
- <p><?php echo esc_html__( 'Your cart is empty.', 'download-monitor' ); ?></p>
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ } // Exit if accessed directly
5
+ ?>
6
+ <p><?php echo esc_html__( 'Your cart is empty.', 'download-monitor' ); ?></p>
templates/shop/checkout/empty.php CHANGED
@@ -1,6 +1,6 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
- } // Exit if accessed directly
5
- ?>
6
- <p><?php echo esc_html__( 'Your cart is empty.', 'download-monitor' ); ?></p>
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ } // Exit if accessed directly
5
+ ?>
6
+ <p><?php echo esc_html__( 'Your cart is empty.', 'download-monitor' ); ?></p>
templates/shop/checkout/error.php CHANGED
@@ -1,13 +1,13 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
- } // Exit if accessed directly
5
-
6
- /** @var string $error */
7
- ?>
8
-
9
- <div class="dlm-checkout-error">
10
- <img src="<?php echo esc_url( download_monitor()->get_plugin_url() ); ?>/assets/images/shop/icon-error.svg"
11
- alt="<?php echo esc_html__( 'Checkout error', 'download-monitor' ); ?>" class="dlm-checkout-error-icon">
12
- <p><?php echo esc_html( $error ); ?></p>
13
- </div>
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ } // Exit if accessed directly
5
+
6
+ /** @var string $error */
7
+ ?>
8
+
9
+ <div class="dlm-checkout-error">
10
+ <img src="<?php echo esc_url( download_monitor()->get_plugin_url() ); ?>/assets/images/shop/icon-error.svg"
11
+ alt="<?php echo esc_html__( 'Checkout error', 'download-monitor' ); ?>" class="dlm-checkout-error-icon">
12
+ <p><?php echo esc_html( $error ); ?></p>
13
+ </div>
templates/shop/checkout/no-access.php CHANGED
@@ -1,6 +1,6 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
- } // Exit if accessed directly
5
- ?>
6
- <p><?php echo esc_html__( 'You have no access to this order.', 'download-monitor' ); ?></p>
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ } // Exit if accessed directly
5
+ ?>
6
+ <p><?php echo esc_html__( 'You have no access to this order.', 'download-monitor' ); ?></p>
templates/shop/checkout/order-review-item.php CHANGED
@@ -1,11 +1,11 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
- } // Exit if accessed directly
5
-
6
- /** @var array $item */
7
- ?>
8
- <tr>
9
- <td><?php echo esc_html( $item['label'] ); ?></td>
10
- <td><?php echo esc_html( $item['subtotal'] ); ?></td>
11
  </tr>
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ } // Exit if accessed directly
5
+
6
+ /** @var array $item */
7
+ ?>
8
+ <tr>
9
+ <td><?php echo esc_html( $item['label'] ); ?></td>
10
+ <td><?php echo esc_html( $item['subtotal'] ); ?></td>
11
  </tr>
templates/shop/checkout/submit-button.php CHANGED
@@ -1,6 +1,6 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
- } // Exit if accessed directly
5
- ?>
6
  <input type="submit" name="dlm_checkout_submit" id="dlm_checkout_submit" value="<?php echo esc_html__( 'Complete order', 'download-monitor' ); ?>" />
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ } // Exit if accessed directly
5
+ ?>
6
  <input type="submit" name="dlm_checkout_submit" id="dlm_checkout_submit" value="<?php echo esc_html__( 'Complete order', 'download-monitor' ); ?>" />
templates/shop/email/elements/order-table-plain.php CHANGED
@@ -1,11 +1,11 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
- } // Exit if accessed directly
5
- ?>
6
-
7
- <?php if ( count( $items ) > 0 ) : ?>
8
- <?php foreach ( $items as $item ) : ?>
9
- <?php echo esc_html( $item['key'] ); ?>: <?php echo esc_html( $item['value'] ) . PHP_EOL; ?>
10
- <?php endforeach; ?>
11
  <?php endif; ?>
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ } // Exit if accessed directly
5
+ ?>
6
+
7
+ <?php if ( count( $items ) > 0 ) : ?>
8
+ <?php foreach ( $items as $item ) : ?>
9
+ <?php echo esc_html( $item['key'] ); ?>: <?php echo esc_html( $item['value'] ) . PHP_EOL; ?>
10
+ <?php endforeach; ?>
11
  <?php endif; ?>
templates/shop/email/elements/order-table.php CHANGED
@@ -1,17 +1,17 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
- } // Exit if accessed directly
5
- ?>
6
- <table cellpadding="0" cellspacing="0" border="0" class="dlm-order-table">
7
- <tbody>
8
- <?php if ( count( $items ) > 0 ) : ?>
9
- <?php foreach ( $items as $item ) : ?>
10
- <tr>
11
- <th><?php echo esc_html( $item['key'] ); ?></th>
12
- <td><?php echo esc_html( $item['value'] ); ?></td>
13
- </tr>
14
- <?php endforeach; ?>
15
- <?php endif; ?>
16
- </tbody>
17
  </table>
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ } // Exit if accessed directly
5
+ ?>
6
+ <table cellpadding="0" cellspacing="0" border="0" class="dlm-order-table">
7
+ <tbody>
8
+ <?php if ( count( $items ) > 0 ) : ?>
9
+ <?php foreach ( $items as $item ) : ?>
10
+ <tr>
11
+ <th><?php echo esc_html( $item['key'] ); ?></th>
12
+ <td><?php echo esc_html( $item['value'] ); ?></td>
13
+ </tr>
14
+ <?php endforeach; ?>
15
+ <?php endif; ?>
16
+ </tbody>
17
  </table>
templates/shop/email/new-order-admin-plain.php CHANGED
@@ -1,14 +1,14 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
- } // Exit if accessed directly
5
- ?>
6
- Great news! Your %WEBSITE_NAME% shop just received a new order!
7
-
8
- Here's an overview of the order:
9
-
10
- %ORDER_TABLE_PLAIN%
11
-
12
- Cheers,
13
-
14
- Your Download Monitor powered website
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ } // Exit if accessed directly
5
+ ?>
6
+ Great news! Your %WEBSITE_NAME% shop just received a new order!
7
+
8
+ Here's an overview of the order:
9
+
10
+ %ORDER_TABLE_PLAIN%
11
+
12
+ Cheers,
13
+
14
+ Your Download Monitor powered website
templates/shop/email/new-order-admin.php CHANGED
@@ -1,58 +1,58 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
- } // Exit if accessed directly
5
- ?>
6
- <!DOCTYPE html>
7
- <html>
8
- <head lang="en">
9
- <meta charset="UTF-8">
10
- <style type="text/css">
11
- html, body {
12
- padding: 0;
13
- margin: 0;
14
- background: #F5F5F5;
15
- }
16
-
17
- body {
18
- padding: 25px;
19
- }
20
-
21
- .dlm-order-table {
22
- width: 100%;
23
- }
24
-
25
- .dlm-order-table th, .dlm-order-table td {
26
- padding: 1em 0;
27
- border-bottom: 1px solid #c3c1bc;
28
- text-align: left;
29
- }
30
- .dlm-order-table th {
31
- width: 40%;
32
- }
33
- </style>
34
- </head>
35
- <body>
36
- <table cellpadding="0" cellspacing="0" border="0" align="center" width="500"
37
- style="font-family: Arial; font-size: 14px;">
38
- <tr>
39
- <td style="font-size: 16px; font-weight: bold; background-color: #459ac9; color: #fff; height: 50px; padding: 0 15px;-webkit-border-top-left-radius: 5px;-webkit-border-top-right-radius: 5px;-moz-border-radius-topleft: 5px;-moz-border-radius-topright: 5px;border-top-left-radius: 5px;border-top-right-radius: 5px;">
40
- New %WEBSITE_NAME% order!
41
- </td>
42
- </tr>
43
- <tr>
44
- <td style="padding: 25px 15px;background: #fff;-webkit-border-bottom-right-radius: 5px;-webkit-border-bottom-left-radius: 5px;-moz-border-radius-bottomright: 5px;-moz-border-radius-bottomleft: 5px;border-bottom-right-radius: 5px;border-bottom-left-radius: 5px;">
45
- Great news! Your %WEBSITE_NAME% shop just received a new order!<br/>
46
- <br/>
47
- Here's an overview of the order:<br/>
48
- <br/>
49
- %ORDER_TABLE%
50
- <br/>
51
- Cheers,<br/>
52
- </br>
53
- <em>Your Download Monitor powered website</em>
54
- </td>
55
- </tr>
56
- </table>
57
- </body>
58
  </html>
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ } // Exit if accessed directly
5
+ ?>
6
+ <!DOCTYPE html>
7
+ <html>
8
+ <head lang="en">
9
+ <meta charset="UTF-8">
10
+ <style type="text/css">
11
+ html, body {
12
+ padding: 0;
13
+ margin: 0;
14
+ background: #F5F5F5;
15
+ }
16
+
17
+ body {
18
+ padding: 25px;
19
+ }
20
+
21
+ .dlm-order-table {
22
+ width: 100%;
23
+ }
24
+
25
+ .dlm-order-table th, .dlm-order-table td {
26
+ padding: 1em 0;
27
+ border-bottom: 1px solid #c3c1bc;
28
+ text-align: left;
29
+ }
30
+ .dlm-order-table th {
31
+ width: 40%;
32
+ }
33
+ </style>
34
+ </head>
35
+ <body>
36
+ <table cellpadding="0" cellspacing="0" border="0" align="center" width="500"
37
+ style="font-family: Arial; font-size: 14px;">
38
+ <tr>
39
+ <td style="font-size: 16px; font-weight: bold; background-color: #459ac9; color: #fff; height: 50px; padding: 0 15px;-webkit-border-top-left-radius: 5px;-webkit-border-top-right-radius: 5px;-moz-border-radius-topleft: 5px;-moz-border-radius-topright: 5px;border-top-left-radius: 5px;border-top-right-radius: 5px;">
40
+ New %WEBSITE_NAME% order!
41
+ </td>
42
+ </tr>
43
+ <tr>
44
+ <td style="padding: 25px 15px;background: #fff;-webkit-border-bottom-right-radius: 5px;-webkit-border-bottom-left-radius: 5px;-moz-border-radius-bottomright: 5px;-moz-border-radius-bottomleft: 5px;border-bottom-right-radius: 5px;border-bottom-left-radius: 5px;">
45
+ Great news! Your %WEBSITE_NAME% shop just received a new order!<br/>
46
+ <br/>
47
+ Here's an overview of the order:<br/>
48
+ <br/>
49
+ %ORDER_TABLE%
50
+ <br/>
51
+ Cheers,<br/>
52
+ </br>
53
+ <em>Your Download Monitor powered website</em>
54
+ </td>
55
+ </tr>
56
+ </table>
57
+ </body>
58
  </html>
templates/shop/email/new-order-plain.php CHANGED
@@ -1,17 +1,17 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
- } // Exit if accessed directly
5
- ?>
6
-
7
- Hey %FIRST_NAME%,
8
-
9
- Thank you for your purchase, this email confirms your order.
10
-
11
- Here's an overview of your files:
12
-
13
- %DOWNLOADS_TABLE_PLAIN%
14
-
15
- Many thanks,
16
-
17
- Team %WEBSITE_NAME%
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ } // Exit if accessed directly
5
+ ?>
6
+
7
+ Hey %FIRST_NAME%,
8
+
9
+ Thank you for your purchase, this email confirms your order.
10
+
11
+ Here's an overview of your files:
12
+
13
+ %DOWNLOADS_TABLE_PLAIN%
14
+
15
+ Many thanks,
16
+
17
+ Team %WEBSITE_NAME%
templates/shop/email/new-order.php CHANGED
@@ -1,83 +1,83 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
- } // Exit if accessed directly
5
- ?>
6
- <!DOCTYPE html>
7
- <html>
8
- <head lang="en">
9
- <meta charset="UTF-8">
10
- <style type="text/css">
11
- html, body {
12
- padding: 0;
13
- margin: 0;
14
- background: #F5F5F5;
15
- }
16
-
17
- body {
18
- padding: 25px;
19
- }
20
-
21
- .dlm-downloads-table {
22
- width: 100%;
23
- }
24
-
25
- .dlm-downloads-table th, .dlm-downloads-table td {
26
- padding: 1.5em 0;
27
- text-align: left;
28
- }
29
-
30
- .dlm-downloads-table th {
31
- padding: .5em 0;
32
- border-bottom: 2px solid #c3c1bc;
33
- }
34
-
35
- .dlm-downloads-table td {
36
- border-bottom: 1px solid #c3c1bc;
37
- }
38
-
39
- .dlm-download-button {
40
- display: inline-block;
41
- padding: 1em 1.5em;
42
- background-color: #eee;
43
- border-color: #eee;
44
- color: #333;
45
- text-decoration: none;
46
- font-weight: bold;
47
- }
48
-
49
- .dlm-th-name {
50
- width: 45%;
51
- }
52
-
53
- .dlm-downloads-table td.dlm-td-download-button {
54
- text-align: center;
55
- }
56
- </style>
57
- </head>
58
- <body>
59
- <table cellpadding="0" cellspacing="0" border="0" align="center" width="500"
60
- style="font-family: Arial; font-size: 14px;">
61
- <tr>
62
- <td style="font-size: 16px; font-weight: bold; background-color: #459ac9; color: #fff; height: 50px; padding: 0 15px;-webkit-border-top-left-radius: 5px;-webkit-border-top-right-radius: 5px;-moz-border-radius-topleft: 5px;-moz-border-radius-topright: 5px;border-top-left-radius: 5px;border-top-right-radius: 5px;">
63
- Thanks for your order!
64
- </td>
65
- </tr>
66
- <tr>
67
- <td style="padding: 25px 15px;background: #fff;-webkit-border-bottom-right-radius: 5px;-webkit-border-bottom-left-radius: 5px;-moz-border-radius-bottomright: 5px;-moz-border-radius-bottomleft: 5px;border-bottom-right-radius: 5px;border-bottom-left-radius: 5px;">
68
- Hey %FIRST_NAME%,<br/>
69
- <br/>
70
- Thank you for your purchase, this email confirms your order.<br/>
71
- <br/>
72
- Here's an overview of your purchase:<br/>
73
- <br/>
74
- %DOWNLOADS_TABLE%
75
- <br/>
76
- Many thanks,<br/>
77
- </br>
78
- <em>Team %WEBSITE_NAME%</em>
79
- </td>
80
- </tr>
81
- </table>
82
- </body>
83
  </html>
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ } // Exit if accessed directly
5
+ ?>
6
+ <!DOCTYPE html>
7
+ <html>
8
+ <head lang="en">
9
+ <meta charset="UTF-8">
10
+ <style type="text/css">
11
+ html, body {
12
+ padding: 0;
13
+ margin: 0;
14
+ background: #F5F5F5;
15
+ }
16
+
17
+ body {
18
+ padding: 25px;
19
+ }
20
+
21
+ .dlm-downloads-table {
22
+ width: 100%;
23
+ }
24
+
25
+ .dlm-downloads-table th, .dlm-downloads-table td {
26
+ padding: 1.5em 0;
27
+ text-align: left;
28
+ }
29
+
30
+ .dlm-downloads-table th {
31
+ padding: .5em 0;
32
+ border-bottom: 2px solid #c3c1bc;
33
+ }
34
+
35
+ .dlm-downloads-table td {
36
+ border-bottom: 1px solid #c3c1bc;
37
+ }
38
+
39
+ .dlm-download-button {
40
+ display: inline-block;
41
+ padding: 1em 1.5em;
42
+ background-color: #eee;
43
+ border-color: #eee;
44
+ color: #333;
45
+ text-decoration: none;
46
+ font-weight: bold;
47
+ }
48
+
49
+ .dlm-th-name {
50
+ width: 45%;
51
+ }
52
+
53
+ .dlm-downloads-table td.dlm-td-download-button {
54
+ text-align: center;
55
+ }
56
+ </style>
57
+ </head>
58
+ <body>
59
+ <table cellpadding="0" cellspacing="0" border="0" align="center" width="500"
60
+ style="font-family: Arial; font-size: 14px;">
61
+ <tr>
62
+ <td style="font-size: 16px; font-weight: bold; background-color: #459ac9; color: #fff; height: 50px; padding: 0 15px;-webkit-border-top-left-radius: 5px;-webkit-border-top-right-radius: 5px;-moz-border-radius-topleft: 5px;-moz-border-radius-topright: 5px;border-top-left-radius: 5px;border-top-right-radius: 5px;">
63
+ Thanks for your order!
64
+ </td>
65
+ </tr>
66
+ <tr>
67
+ <td style="padding: 25px 15px;background: #fff;-webkit-border-bottom-right-radius: 5px;-webkit-border-bottom-left-radius: 5px;-moz-border-radius-bottomright: 5px;-moz-border-radius-bottomleft: 5px;border-bottom-right-radius: 5px;border-bottom-left-radius: 5px;">
68
+ Hey %FIRST_NAME%,<br/>
69
+ <br/>
70
+ Thank you for your purchase, this email confirms your order.<br/>
71
+ <br/>
72
+ Here's an overview of your purchase:<br/>
73
+ <br/>
74
+ %DOWNLOADS_TABLE%
75
+ <br/>
76
+ Many thanks,<br/>
77
+ </br>
78
+ <em>Team %WEBSITE_NAME%</em>
79
+ </td>
80
+ </tr>
81
+ </table>
82
+ </body>
83
  </html>