Version Description
- Complete new architecture for the download monitor plugin
- You can download the old version with old architecture here: http://wordpress.org/plugins/simple-download-monitor/developers/
=
Download this release
Release Info
Developer | mra13 |
Plugin | Simple Download Monitor |
Version | 2.0 |
Comparing to | |
See all releases |
Code changes from version 0.24 to 2.0
- css/images/Thumbs.db +0 -0
- css/images/ajax.gif +0 -0
- css/images/minus.png +0 -0
- css/images/plus.png +0 -0
- css/sdm_admin_styles.css +73 -0
- css/sdm_wp_styles.css +264 -0
- css/sdmon.css +0 -12
- download-example-js.php +0 -37
- download-example.php +0 -27
- js/sdm_admin_scripts.js +53 -0
- lang/be_BY.mo +0 -0
- lang/be_BY.po +0 -286
- lang/cs_CZ.mo +0 -0
- lang/cs_CZ.po +0 -388
- langs/SDM.mo +0 -0
- langs/SDM.po +342 -0
- main.php +982 -0
- readme.txt +92 -340
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- sdmon.css +0 -10
- simple-download-monitor.php +0 -1123
- tinymce/img/Thumbs.db +0 -0
- tinymce/img/sdm_downloads.png +0 -0
- tinymce/sdm_editor_plugin.js +137 -0
css/images/Thumbs.db
ADDED
Binary file
|
css/images/ajax.gif
ADDED
Binary file
|
css/images/minus.png
ADDED
Binary file
|
css/images/plus.png
ADDED
Binary file
|
css/sdm_admin_styles.css
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
** Used for sliding divs on admin settings page
|
3 |
+
*/
|
4 |
+
#plus_minus_email, #plus_minus_colors {
|
5 |
+
float:right;
|
6 |
+
margin-top:-3px;
|
7 |
+
margin-right:10px;
|
8 |
+
}
|
9 |
+
.slidingDiv {
|
10 |
+
width:60%;
|
11 |
+
background-color: #ECECEC;
|
12 |
+
padding:10px;
|
13 |
+
margin-top:1px;
|
14 |
+
border-bottom:3px solid #E1E1E1;
|
15 |
+
|
16 |
+
-webkit-border-radius: 0 0 10px 10px;
|
17 |
+
-moz-border-radius: 0 0 10px 10px;
|
18 |
+
border-radius: 0 0 10px 10px;
|
19 |
+
}
|
20 |
+
.sdm_sliding_div_title {
|
21 |
+
width:60%;
|
22 |
+
height:25px;
|
23 |
+
background-color:#E1E1E1;
|
24 |
+
padding:10px;
|
25 |
+
margin-top:10px;
|
26 |
+
|
27 |
+
-webkit-border-radius: 10px 10px 0 0;
|
28 |
+
-moz-border-radius: 10px 10px 0 0;
|
29 |
+
border-radius: 10px 10px 0 0;
|
30 |
+
}
|
31 |
+
.sdm_slider_title {
|
32 |
+
float:left;
|
33 |
+
width:20%;
|
34 |
+
font-size:22px;
|
35 |
+
margin-top:5px;
|
36 |
+
text-shadow: 2px 2px #FFF;
|
37 |
+
}
|
38 |
+
.sdm_desc {
|
39 |
+
float:left;
|
40 |
+
width:60%;
|
41 |
+
font-size:14px;
|
42 |
+
margin-top:7px;
|
43 |
+
text-shadow: 1px 1px #FFF;
|
44 |
+
}
|
45 |
+
.sdm_open_close {
|
46 |
+
float:left;
|
47 |
+
width:20%;
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
/*
|
53 |
+
** Used for AJAX Loading overlay
|
54 |
+
*/
|
55 |
+
.modal {
|
56 |
+
display: none;
|
57 |
+
position: fixed;
|
58 |
+
z-index: 1000;
|
59 |
+
top: 0;
|
60 |
+
left: 0;
|
61 |
+
height: 100%;
|
62 |
+
width: 100%;
|
63 |
+
background: rgba( 255, 255, 255, .8 )
|
64 |
+
url('images/ajax.gif')
|
65 |
+
50% 50%
|
66 |
+
no-repeat;
|
67 |
+
}
|
68 |
+
body.loading {
|
69 |
+
overflow: hidden;
|
70 |
+
}
|
71 |
+
body.loading .modal {
|
72 |
+
display: block;
|
73 |
+
}
|
css/sdm_wp_styles.css
ADDED
@@ -0,0 +1,264 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.sdm_download_item {
|
2 |
+
display: block;
|
3 |
+
border:1px solid #E7E9EB;
|
4 |
+
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
|
5 |
+
margin-top:10px;
|
6 |
+
margin-bottom:10px;
|
7 |
+
padding:15px;
|
8 |
+
}
|
9 |
+
.sdm_download_title {
|
10 |
+
float:left;
|
11 |
+
font-size: 24px;
|
12 |
+
font-weight: bold;
|
13 |
+
line-height: 75px;
|
14 |
+
}
|
15 |
+
.sdm_download_thumbnail {
|
16 |
+
float:left;
|
17 |
+
}
|
18 |
+
.sdm_download_thumbnail_image {
|
19 |
+
width:75px !important;
|
20 |
+
height:75px !important;
|
21 |
+
float:left !important;
|
22 |
+
margin-right:10px !important;
|
23 |
+
}
|
24 |
+
.sdm_download_description {
|
25 |
+
margin: 15px 0 15px 0;
|
26 |
+
padding-bottom: 10px;
|
27 |
+
border-bottom: 1px solid #EEEEEE;
|
28 |
+
}
|
29 |
+
.sdm_download {
|
30 |
+
display: inline-block;
|
31 |
+
text-decoration: none;
|
32 |
+
font: bold 12px/12px HelveticaNeue, Arial;
|
33 |
+
padding: 8px 11px;
|
34 |
+
color: #555;
|
35 |
+
border: 1px solid #dedede;
|
36 |
+
-webkit-border-radius: 3px;
|
37 |
+
-moz-border-radius: 3px;
|
38 |
+
border-radius: 3px;
|
39 |
+
}
|
40 |
+
.sdm_download.green{
|
41 |
+
background: #b7d770;
|
42 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#cae285', endColorstr='#9fcb57'); /* IE */
|
43 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#cae285), to(#9fcb57)); /* WebKit */
|
44 |
+
background: -moz-linear-gradient(top, #cae285, #9fcb57);
|
45 |
+
border-color: #adc671 #98b65b #87aa4a;
|
46 |
+
color: #5d7731;
|
47 |
+
text-shadow: 0 1px 0 #cfe5a4;
|
48 |
+
-webkit-box-shadow: 0 1px 1px #d3d3d3, inset 0 1px 0 #d7e9a4;
|
49 |
+
-moz-box-shadow: 0 1px 1px #d3d3d3, inset 0 1px 0 #d7e9a4;
|
50 |
+
box-shadow: 0 1px 1px #d3d3d3, inset 0 1px 0 #d7e9a4;
|
51 |
+
}
|
52 |
+
.sdm_download.green:hover{
|
53 |
+
background: #b9d972;
|
54 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#b8d872', endColorstr='#b9d972'); /* IE */
|
55 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#b8d872), to(#b9d972)); /* WebKit */
|
56 |
+
background: -moz-linear-gradient(top, #b8d872, #b9d972);
|
57 |
+
border-color: #8bb14d #83a648 #7d9e45;
|
58 |
+
text-shadow: 0 1px 0 #d5e8aa;
|
59 |
+
-webkit-box-shadow: 0 1px 1px #d5d5d5, inset 0 1px 0 #cae295;
|
60 |
+
-moz-box-shadow: 0 1px 1px #d5d5d5, inset 0 1px 0 #cae295;
|
61 |
+
box-shadow: 0 1px 1px #d5d5d5, inset 0 1px 0 #cae295;
|
62 |
+
}
|
63 |
+
|
64 |
+
.sdm_download.blue{
|
65 |
+
background: #92dbf6;
|
66 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#abe4f8', endColorstr='#6fcef3'); /* IE */
|
67 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#abe4f8), to(#6fcef3)); /* WebKit */
|
68 |
+
background: -moz-linear-gradient(top, #abe4f8, #6fcef3);
|
69 |
+
border-color: #8dc5da #76b7cf #63abc7;
|
70 |
+
color: #42788e;
|
71 |
+
text-shadow: 0 1px 0 #b6e6f9;
|
72 |
+
-webkit-box-shadow: 0 1px 1px #d6d6d6, inset 0 1px 0 #c0ebfa;
|
73 |
+
-moz-box-shadow: 0 1px 1px #d6d6d6, inset 0 1px 0 #c0ebfa;
|
74 |
+
box-shadow: 0 1px 1px #d6d6d6, inset 0 1px 0 #c0ebfa;
|
75 |
+
}
|
76 |
+
.sdm_download.blue:hover{
|
77 |
+
background: #92dbf6;
|
78 |
+
border-color: #7caec0 #68a3ba #5a9cb5;
|
79 |
+
text-shadow: 0 1px 0 #bee9fa;
|
80 |
+
-webkit-box-shadow: 0 1px 1px #d6d6d6, inset 0 1px 0 #ade4f8;
|
81 |
+
-moz-box-shadow: 0 1px 1px #d6d6d6, inset 0 1px 0 #ade4f8;
|
82 |
+
box-shadow: 0 1px 1px #d6d6d6, inset 0 1px 0 #ade4f8;
|
83 |
+
}
|
84 |
+
|
85 |
+
.sdm_download.purple{
|
86 |
+
background: #dfaeda;
|
87 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e8c4e4', endColorstr='#d494ce'); /* IE */
|
88 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#e8c4e4), to(#d494ce)); /* WebKit */
|
89 |
+
background: -moz-linear-gradient(top, #e8c4e4, #d494ce);
|
90 |
+
border-color: #bc9db9 #ad89aa #a1799d;
|
91 |
+
color: #7b5777;
|
92 |
+
text-shadow: 0 1px 0 #eacae6;
|
93 |
+
-webkit-box-shadow: 0 1px 1px #d5d5d5, inset 0 1px 0 #eed3eb;
|
94 |
+
-moz-box-shadow: 0 1px 1px #d5d5d5, inset 0 1px 0 #eed3eb;
|
95 |
+
box-shadow: 0 1px 1px #d5d5d5, inset 0 1px 0 #eed3eb;
|
96 |
+
}
|
97 |
+
.sdm_download.purple:hover{
|
98 |
+
background: #e0b1db;
|
99 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#deabd9', endColorstr='#e0b1db'); /* IE */
|
100 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#deabd9), to(#e0b1db)); /* WebKit */
|
101 |
+
background: -moz-linear-gradient(top, #deabd9, #e0b1db);
|
102 |
+
border-color: #a482a0 #9b7897 #947090;
|
103 |
+
text-shadow: 0 1px 0 #ecd0e9;
|
104 |
+
-webkit-box-shadow: 0 1px 1px #cdcdcd, inset 0 1px 0 #ccc;
|
105 |
+
-moz-box-shadow: 0 1px 1px #cdcdcd, inset 0 1px 0 #ccc;
|
106 |
+
box-shadow: 0 1px 1px #cdcdcd, inset 0 1px 0 #ccc;
|
107 |
+
}
|
108 |
+
|
109 |
+
.sdm_download.teal{
|
110 |
+
background: #9cedef;
|
111 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#b7f2f4', endColorstr='#7ce7ea'); /* IE */
|
112 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#b7f2f4), to(#7ce7ea)); /* WebKit */
|
113 |
+
background: -moz-linear-gradient(top, #b7f2f4, #7ce7ea);
|
114 |
+
border-color: #90c6c8 #78bdc0 #65b6ba;
|
115 |
+
color: #437b7d;
|
116 |
+
text-shadow: 0 1px 0 #bef3f5;
|
117 |
+
-webkit-box-shadow: 0 1px 1px #d5d5d5, inset 0 1px 0 #c9f5f7;
|
118 |
+
-moz-box-shadow: 0 1px 1px #d5d5d5, inset 0 1px 0 #c9f5f7;
|
119 |
+
box-shadow: 0 1px 1px #d5d5d5, inset 0 1px 0 #c9f5f7;
|
120 |
+
}
|
121 |
+
.sdm_download.teal:hover{
|
122 |
+
background: #9fedf0;
|
123 |
+
border-color: #7db9bb #6bb2b5 #5dacaf;
|
124 |
+
text-shadow: 0 1px 0 #c5f4f6;
|
125 |
+
-webkit-box-shadow: 0 1px 1px #d5d5d5, inset 0 1px 0 #b7f2f4;
|
126 |
+
-moz-box-shadow: 0 1px 1px #d5d5d5, inset 0 1px 0 #b7f2f4;
|
127 |
+
box-shadow: 0 1px 1px #d5d5d5, inset 0 1px 0 #b7f2f4;
|
128 |
+
}
|
129 |
+
|
130 |
+
.sdm_download.darkblue{
|
131 |
+
background: #a5b8c6;
|
132 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#becbd6', endColorstr='#88a1b4'); /* IE */
|
133 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#becbd6), to(#88a1b4)); /* WebKit */
|
134 |
+
background: -moz-linear-gradient(top, #becbd6, #88a1b4);
|
135 |
+
border-color: #a2afb8 #8696a1 #6f818f;
|
136 |
+
color: #515f6a;
|
137 |
+
text-shadow: 0 1px 0 #c4d0d9;
|
138 |
+
-webkit-box-shadow: 0 1px 1px #d3d3d3, inset 0 1px 0 #ced8e0;
|
139 |
+
-moz-box-shadow: 0 1px 1px #d3d3d3, inset 0 1px 0 #ced8e0;
|
140 |
+
box-shadow: 0 1px 1px #d3d3d3, inset 0 1px 0 #ced8e0;
|
141 |
+
}
|
142 |
+
.sdm_download.darkblue:hover{
|
143 |
+
background: #adbfcb;
|
144 |
+
border-color: #8996a0 #798791 #6c7a85;
|
145 |
+
text-shadow: 0 1px 0 #ced9e0;
|
146 |
+
-webkit-box-shadow: 0 1px 1px #d3d3d3, inset 0 1px 0 #c2cfd8;
|
147 |
+
-moz-box-shadow: 0 1px 1px #d3d3d3, inset 0 1px 0 #c2cfd8;
|
148 |
+
box-shadow: 0 1px 1px #d3d3d3, inset 0 1px 0 #c2cfd8;
|
149 |
+
}
|
150 |
+
|
151 |
+
.sdm_download.black{
|
152 |
+
background: #525252;
|
153 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5e5e5e', endColorstr='#434343'); /* IE */
|
154 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#5e5e5e), to(#434343)); /* WebKit */
|
155 |
+
background: -moz-linear-gradient(top, #5e5e5e, #434343);
|
156 |
+
border-color: #4c4c4c #313131 #1f1f1f;
|
157 |
+
color: #fff;
|
158 |
+
text-shadow: 0 1px 0 #2e2e2e;
|
159 |
+
-webkit-box-shadow: 0 1px 1px #afafaf, inset 0 1px 0 #868686;
|
160 |
+
-moz-box-shadow: 0 1px 1px #afafaf, inset 0 1px 0 #868686;
|
161 |
+
box-shadow: 0 1px 1px #afafaf, inset 0 1px 0 #868686;
|
162 |
+
}
|
163 |
+
.sdm_download.black:hover{
|
164 |
+
background: #5a5a5a;
|
165 |
+
border-color: #2c2c2c #1c1c1c #101010;
|
166 |
+
text-shadow: 0 1px 0 #363636;
|
167 |
+
-webkit-box-shadow: 0 1px 1px #b1b1b1, inset 0 1px 0 #838383;
|
168 |
+
-moz-box-shadow: 0 1px 1px #b1b1b1, inset 0 1px 0 #838383;
|
169 |
+
box-shadow: 0 1px 1px #b1b1b1, inset 0 1px 0 #838383;
|
170 |
+
}
|
171 |
+
.sdm_download.grey{
|
172 |
+
background: #bdbdbd;
|
173 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#cacaca', endColorstr='#aeaeae'); /* IE */
|
174 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#cacaca), to(#aeaeae)); /* WebKit */
|
175 |
+
background: -moz-linear-gradient(top, #cacaca, #aeaeae);
|
176 |
+
border-color: #b5b5b5 #a1a1a1 #8f8f8f;
|
177 |
+
color: #555;
|
178 |
+
text-shadow: 0 1px 0 #d4d4d4;
|
179 |
+
-webkit-box-shadow: 0 1px 1px #c9c9c9, inset 0 1px 0 #d7d7d7;
|
180 |
+
-moz-box-shadow: 0 1px 1px #c9c9c9, inset 0 1px 0 #d7d7d7;
|
181 |
+
box-shadow: 0 1px 1px #c9c9c9, inset 0 1px 0 #d7d7d7;
|
182 |
+
}
|
183 |
+
.sdm_download.grey:hover{
|
184 |
+
background: #c2c2c2;
|
185 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#bcbcbc', endColorstr='#c2c2c2'); /* IE */
|
186 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#bcbcbc), to(#c2c2c2)); /* WebKit */
|
187 |
+
background: -moz-linear-gradient(top, #bcbcbc, #c2c2c2);
|
188 |
+
border-color: #989898 #8e8e8e #878787;
|
189 |
+
text-shadow: 0 1px 0 #dadada;
|
190 |
+
-webkit-box-shadow: 0 1px 1px #cdcdcd, inset 0 1px 0 #ccc;
|
191 |
+
-moz-box-shadow: 0 1px 1px #cdcdcd, inset 0 1px 0 #ccc;
|
192 |
+
box-shadow: 0 1px 1px #cdcdcd, inset 0 1px 0 #ccc;
|
193 |
+
}
|
194 |
+
|
195 |
+
.sdm_download.pink{
|
196 |
+
background: #f67689;
|
197 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f78297', endColorstr='#f56778'); /* IE */
|
198 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#f78297), to(#f56778)); /* WebKit */
|
199 |
+
background: -moz-linear-gradient(top, #f78297, #f56778);
|
200 |
+
border-color: #df6f8b #da5f75 #d55061;
|
201 |
+
color: #913944;
|
202 |
+
text-shadow: 0 1px 0 #f89ca9;
|
203 |
+
-webkit-box-shadow: 0 1px 1px #c1c1c1, inset 0 1px 0 #f9a1b1;
|
204 |
+
-moz-box-shadow: 0 1px 1px #c1c1c1, inset 0 1px 0 #f9a1b1;
|
205 |
+
box-shadow: 0 1px 1px #c1c1c1, inset 0 1px 0 #f9a1b1;
|
206 |
+
}
|
207 |
+
.sdm_download.pink:hover{
|
208 |
+
background: #f67c90;
|
209 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f56c7e', endColorstr='#f78297'); /* IE */
|
210 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#f56c7e), to(#f78297)); /* WebKit */
|
211 |
+
background: -moz-linear-gradient(top, #f56c7e, #f78297);
|
212 |
+
border-color: #c36079 #c25669 #c14e5c;
|
213 |
+
text-shadow: 0 1px 0 #f9a6b4;
|
214 |
+
-webkit-box-shadow: 0 1px 1px #c3c3c3, inset 0 1px 0 #f8909e;
|
215 |
+
-moz-box-shadow: 0 1px 1px #c3c3c3, inset 0 1px 0 #f8909e;
|
216 |
+
box-shadow: 0 1px 1px #c3c3c3, inset 0 1px 0 #f8909e;
|
217 |
+
}
|
218 |
+
|
219 |
+
.sdm_download.orange{
|
220 |
+
background: #fecc5f;
|
221 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#feda71', endColorstr='#febb4a'); /* IE */
|
222 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#feda71), to(#febb4a)); /* WebKit */
|
223 |
+
background: -moz-linear-gradient(top, #feda71, #febb4a);
|
224 |
+
border-color: #f5b74e #e5a73e #d6982f;
|
225 |
+
color: #996633;
|
226 |
+
text-shadow: 0 1px 0 #fedd9b;
|
227 |
+
-webkit-box-shadow: 0 1px 1px #d3d3d3, inset 0 1px 0 #fee395;
|
228 |
+
-moz-box-shadow: 0 1px 1px #d3d3d3, inset 0 1px 0 #fee395;
|
229 |
+
box-shadow: 0 1px 1px #d3d3d3, inset 0 1px 0 #fee395;
|
230 |
+
}
|
231 |
+
.sdm_download.orange:hover{
|
232 |
+
background: #fecb5e;
|
233 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fec354', endColorstr='#fecd61'); /* IE */
|
234 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#fec354), to(#fecd61)); /* WebKit */
|
235 |
+
background: -moz-linear-gradient(top, #fec354, #fecd61);
|
236 |
+
border-color: #d29a3a #cc9436 #c89133;
|
237 |
+
text-shadow: 0 1px 0 #fee1a0;
|
238 |
+
-webkit-box-shadow: 0 1px 1px #d4d4d4, inset 0 1px 0 #fed17e;
|
239 |
+
-moz-box-shadow: 0 1px 1px #d4d4d4, inset 0 1px 0 #fed17e;
|
240 |
+
box-shadow: 0 1px 1px #d4d4d4, inset 0 1px 0 #fed17e;
|
241 |
+
}
|
242 |
+
.sdm_download.white{
|
243 |
+
background: #f5f5f5;
|
244 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f9f9f9', endColorstr='#f0f0f0'); /* IE */
|
245 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#f9f9f9), to(#f0f0f0)); /* WebKit */
|
246 |
+
background: -moz-linear-gradient(top, #f9f9f9, #f0f0f0);
|
247 |
+
border-color: #dedede #d8d8d8 #d3d3d3;
|
248 |
+
color: #555;
|
249 |
+
text-shadow: 0 1px 0 #fff;
|
250 |
+
-webkit-box-shadow: 0 1px 1px #eaeaea, inset 0 1px 0 #fbfbfb;
|
251 |
+
-moz-box-shadow: 0 1px 1px #eaeaea, inset 0 1px 0 #fbfbfb;
|
252 |
+
box-shadow: 0 1px 1px #eaeaea, inset 0 1px 0 #fbfbfb;
|
253 |
+
}
|
254 |
+
.sdm_download.white:hover{
|
255 |
+
background: #f4f4f4;
|
256 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#efefef', endColorstr='#f8f8f8'); /* IE */
|
257 |
+
background: -webkit-gradient(linear, left top, left bottom, from(#efefef), to(#f8f8f8)); /* WebKit */
|
258 |
+
background: -moz-linear-gradient(top, #efefef, #f8f8f8);
|
259 |
+
border-color: #c7c7c7 #c3c3c3 #bebebe;
|
260 |
+
text-shadow: 0 1px 0 #fdfdfd;
|
261 |
+
-webkit-box-shadow: 0 1px 1px #ebebeb, inset 0 1px 0 #f3f3f3;
|
262 |
+
-moz-box-shadow: 0 1px 1px #ebebeb, inset 0 1px 0 #f3f3f3;
|
263 |
+
box-shadow: 0 1px 1px #ebebeb, inset 0 1px 0 #f3f3f3;
|
264 |
+
}
|
css/sdmon.css
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
#sdmon .sdmon-rownum { width: 3ex; text-align: right; }
|
2 |
-
#sdmon .sdmon-filename { }
|
3 |
-
#sdmon .sdmon-count { text-align: right; }
|
4 |
-
#sdmon .sdmon-date { width: 24ex; text-align: center; }
|
5 |
-
#sdmon .sdmon-nonex { width: 5ex; text-align: center; }
|
6 |
-
#sdmon .sdmon-hidden { width: 15ex; }
|
7 |
-
#sdmon .sdmon-delete { width: 15ex; }
|
8 |
-
#sdmon .sdmon-ipaddr { }
|
9 |
-
#sdmon .sdmon-referer { }
|
10 |
-
#sdmon .sdmon-username { }
|
11 |
-
#sdmon th {text-align: center; }
|
12 |
-
#sdmon th, #sdmon td { padding-left: 1ex; padding-right: 1ex; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
download-example-js.php
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
<?php get_header(); ?>
|
2 |
-
|
3 |
-
|
4 |
-
<div id="content">
|
5 |
-
<div id="content-inner">
|
6 |
-
|
7 |
-
<div id="main">
|
8 |
-
|
9 |
-
|
10 |
-
<div align="center">
|
11 |
-
<br /><br />
|
12 |
-
Your download will begin in 5 seconds! <br /> If it does not, <a href="/<?php echo $filename; ?>?download=true" rel="nofollow">click here</a>.
|
13 |
-
<br /><br />
|
14 |
-
</div>
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
</div>
|
20 |
-
<script>
|
21 |
-
setTimeout("updateIframe()",5000);
|
22 |
-
|
23 |
-
var exec = true;
|
24 |
-
|
25 |
-
function updateIframe() {
|
26 |
-
if(exec == true) {
|
27 |
-
exec = false;
|
28 |
-
var ifrm = document.getElementById("frame1");
|
29 |
-
ifrm.src = "/<?php echo $filename; ?>?download=true";
|
30 |
-
}
|
31 |
-
}
|
32 |
-
</script>
|
33 |
-
<?php get_sidebar(); ?>
|
34 |
-
<iframe id="frame1" rel="nofollow" style="display:none"></iframe>
|
35 |
-
<?php get_footer(); ?>
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
download-example.php
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$GLOBALS['sdmon_filename'] = $filename;
|
4 |
-
add_action('wp_head', 'sdmon_redirect');
|
5 |
-
get_header();
|
6 |
-
|
7 |
-
function sdmon_redirect() {
|
8 |
-
global $sdmon_filename;
|
9 |
-
echo "<meta http-equiv=\"refresh\" content=\"5;/${sdmon_filename}?download=true\" />\n";
|
10 |
-
}
|
11 |
-
|
12 |
-
?>
|
13 |
-
<div id="content">
|
14 |
-
<div id="content-inner">
|
15 |
-
|
16 |
-
<div id="main">
|
17 |
-
|
18 |
-
<div align="center">
|
19 |
-
<br /><br />
|
20 |
-
<p>Your download will begin in 5 seconds!</p>
|
21 |
-
<p>If it does not, <a href="/<?php echo $filename; ?>?download=true" rel="nofollow">click here</a>.</p>
|
22 |
-
<br /><br />
|
23 |
-
</div>
|
24 |
-
|
25 |
-
</div>
|
26 |
-
<?php get_sidebar(); ?>
|
27 |
-
<?php get_footer(); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/sdm_admin_scripts.js
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($){
|
2 |
+
|
3 |
+
// Run media uploader for file upload
|
4 |
+
$('#upload_image_button').click(function() {
|
5 |
+
|
6 |
+
tb_show( '', 'media-upload.php?type=image&TB_iframe=true' );
|
7 |
+
|
8 |
+
window.send_to_editor = function(html) {
|
9 |
+
|
10 |
+
imgurl = $(html).attr('href');
|
11 |
+
$('#sdm_upload').val(imgurl);
|
12 |
+
tb_remove();
|
13 |
+
}
|
14 |
+
});
|
15 |
+
|
16 |
+
// Run media uploader for thumbnail upload
|
17 |
+
$('#upload_thumbnail_button').click(function() {
|
18 |
+
|
19 |
+
tb_show( '', 'media-upload.php?type=image&TB_iframe=true' );
|
20 |
+
|
21 |
+
window.send_to_editor = function(html) {
|
22 |
+
|
23 |
+
imgurl = $(html).attr('href');
|
24 |
+
$('#sdm_thumbnail_image').remove();
|
25 |
+
$('#sdm_get_thumb').append('<img id="sdm_thumbnail_image" src="'+imgurl+'" />');
|
26 |
+
|
27 |
+
$('#sdm_upload_thumbnail').val(imgurl);
|
28 |
+
tb_remove();
|
29 |
+
}
|
30 |
+
});
|
31 |
+
|
32 |
+
// Remove thumbnail image from CPT
|
33 |
+
$('#remove_thumbnail_button').click(function() {
|
34 |
+
$.post(
|
35 |
+
sdm_admin_ajax_url.sdm_admin_ajax_url,
|
36 |
+
{
|
37 |
+
action: 'sdm_remove_thumbnail_image',
|
38 |
+
post_id_del: sdm_del_thumb_postid
|
39 |
+
},
|
40 |
+
function(response) {
|
41 |
+
if(response) { // ** If response was successful
|
42 |
+
$('#sdm_thumbnail_image').remove();
|
43 |
+
$('#sdm_upload_thumbnail').val('');
|
44 |
+
alert('Image Successfully Removed');
|
45 |
+
}
|
46 |
+
else { // ** Else response was unsuccessful
|
47 |
+
alert('Error with AJAX');
|
48 |
+
}
|
49 |
+
}
|
50 |
+
);
|
51 |
+
});
|
52 |
+
|
53 |
+
});
|
lang/be_BY.mo
DELETED
Binary file
|
lang/be_BY.po
DELETED
@@ -1,286 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: Simple Download Monitor\n"
|
4 |
-
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2009-11-29 18:10+0100\n"
|
6 |
-
"PO-Revision-Date: \n"
|
7 |
-
"Last-Translator: Fat Cow <zhr@tut.by>\n"
|
8 |
-
"Language-Team: FatCow <zhr@tut.by>\n"
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Poedit-Language: Belarusian\n"
|
13 |
-
"X-Poedit-Country: BELARUS\n"
|
14 |
-
"X-Poedit-SourceCharset: utf-8\n"
|
15 |
-
"X-Poedit-KeywordsList: _e;__\n"
|
16 |
-
"X-Poedit-Basepath: ..\n"
|
17 |
-
"X-Poedit-SearchPath-0: ..\n"
|
18 |
-
|
19 |
-
#: ../tags/0.05/simple-download-monitor.php:226
|
20 |
-
#: ../tags/0.05/simple-download-monitor.php:496
|
21 |
-
#: ../tags/0.06/simple-download-monitor.php:226
|
22 |
-
#: ../tags/0.06/simple-download-monitor.php:498
|
23 |
-
#: ../tags/0.07/simple-download-monitor.php:236
|
24 |
-
#: ../tags/0.07/simple-download-monitor.php:513
|
25 |
-
#: ../trunk/simple-download-monitor.php:237
|
26 |
-
#: ../trunk/simple-download-monitor.php:636
|
27 |
-
msgid "Simple Download Monitor options"
|
28 |
-
msgstr "Simple Download Monitor - nastavení"
|
29 |
-
|
30 |
-
#: ../tags/0.05/simple-download-monitor.php:227
|
31 |
-
#: ../tags/0.06/simple-download-monitor.php:227
|
32 |
-
#: ../tags/0.07/simple-download-monitor.php:237
|
33 |
-
#: ../trunk/simple-download-monitor.php:238
|
34 |
-
msgid "Allowed directories"
|
35 |
-
msgstr "Разрешенные директории"
|
36 |
-
|
37 |
-
#: ../tags/0.05/simple-download-monitor.php:228
|
38 |
-
#: ../tags/0.06/simple-download-monitor.php:228
|
39 |
-
#: ../tags/0.07/simple-download-monitor.php:238
|
40 |
-
#: ../trunk/simple-download-monitor.php:239
|
41 |
-
msgid "Only requested files whose full names (relative to document root) start with this regular expression will be processed. It is strongly recommended to place all downloadable files (and ONLY downloadable files) into a designated directory and then placing that directory's name followed by a slash here. It is possible to use the power of PREG to allow multiple directories, but make sure there are ONLY files which you are comfortable with malicious users downloading. Do not EVER allow directories which contain PHP files here! That could lead to disclosure of sensitive data, including username and password used to connect to WordPress database."
|
42 |
-
msgstr "Только просил файлы, чьи полные имена (по отношению к документу корень) начинать с этого регулярного выражения будет обработана. Настоятельно рекомендуется поместить все загружаемые файлы (и только загружаемые файлы) в указанный каталог и затем размещения, что имя каталога после косой черты здесь. Можно использовать силу PREG чтобы позволить нескольким каталогам, но убедитесь, что есть только файлы, которые вы не имеете опыта злоумышленников скачивания. Никогда не позволить каталогов, в которых содержатся PHP файлам здесь! Это могло бы привести к раскрытию конфиденциальной информации, включая имя пользователя и пароль, используемые для подключения к базе данных WordPress."
|
43 |
-
|
44 |
-
#: ../tags/0.05/simple-download-monitor.php:229
|
45 |
-
#: ../tags/0.06/simple-download-monitor.php:229
|
46 |
-
#: ../tags/0.07/simple-download-monitor.php:239
|
47 |
-
#: ../trunk/simple-download-monitor.php:240
|
48 |
-
msgid "Default value is <code>files/</code>, which only allows download from /files directory (the leading <code>/</code> is implicit)."
|
49 |
-
msgstr "Значение по умолчанию <code>files/</code> который обеспечивает только загрузить с / файлов каталогов (ведущий <code>/</code> подразумевается)."
|
50 |
-
|
51 |
-
#: ../tags/0.05/simple-download-monitor.php:231
|
52 |
-
#: ../tags/0.06/simple-download-monitor.php:231
|
53 |
-
#: ../tags/0.07/simple-download-monitor.php:241
|
54 |
-
#: ../trunk/simple-download-monitor.php:242
|
55 |
-
msgid "Allowed extensions"
|
56 |
-
msgstr "Разрешенные расширения"
|
57 |
-
|
58 |
-
#: ../tags/0.05/simple-download-monitor.php:232
|
59 |
-
#: ../tags/0.06/simple-download-monitor.php:232
|
60 |
-
#: ../tags/0.07/simple-download-monitor.php:242
|
61 |
-
#: ../trunk/simple-download-monitor.php:243
|
62 |
-
msgid "Only files with extensions matching this regular expressions will be processed. This is another important security value. Make sure you only add extensions which are safe for malicious users to have, e.g. archives and possibly images. Do NOT use any expression that could allow a user to download PHP files, even if you think it safe given the Allowed Directories option above."
|
63 |
-
msgstr "Только файлы с расширениями, соответствующие этому регулярных выражений будут обработаны. Это еще одно важное значение безопасности. Убедитесь, что вы только добавить, расширений, которые являются безопасными для злоумышленников иметь, например, архивы и, возможно, изображения. Не используйте выражения, которые могут позволить пользователям загружать файлы PHP, даже если вы считаете, что данный безопасной номера варианта Справочники выше."
|
64 |
-
|
65 |
-
#: ../tags/0.05/simple-download-monitor.php:233
|
66 |
-
#: ../tags/0.06/simple-download-monitor.php:233
|
67 |
-
#: ../tags/0.07/simple-download-monitor.php:243
|
68 |
-
#: ../trunk/simple-download-monitor.php:244
|
69 |
-
msgid "Default value is <code>zip|rar|7z</code> which only allows download of files ending with <code>.zip</code>, <code>.rar</code> and <code>.7z</code> (the leading <code>.</code> is implicit)."
|
70 |
-
msgstr "Стандартное значение <code>zip|rar|7z</code> которое только позволяет загружать файлы с расширением <code>.zip</code>, <code>.rar</code> and <code>.7z</code> (лид. код <code>.</code> подразумевается)."
|
71 |
-
|
72 |
-
#: ../tags/0.05/simple-download-monitor.php:235
|
73 |
-
#: ../tags/0.06/simple-download-monitor.php:235
|
74 |
-
#: ../tags/0.07/simple-download-monitor.php:250
|
75 |
-
#: ../trunk/simple-download-monitor.php:251
|
76 |
-
msgid "Store detailed logs?"
|
77 |
-
msgstr "Сохранять подробные логи?"
|
78 |
-
|
79 |
-
#: ../tags/0.05/simple-download-monitor.php:236
|
80 |
-
#: ../tags/0.06/simple-download-monitor.php:236
|
81 |
-
#: ../tags/0.07/simple-download-monitor.php:251
|
82 |
-
#: ../trunk/simple-download-monitor.php:252
|
83 |
-
msgid "If detailed logs are allowed, various information (including exact time of download, user's IP address, referrer etc.) is stored. This can fill your database quickly if you have only a little space or a lot of popular downloads. Otherwise just the total numbers of downloads are stored, consuming significantly less space."
|
84 |
-
msgstr "Если разрешено подробные журналы различной информации (в том числе точное время загрузки, IP адрес пользователя, ссылающаяся т.д.) сохраняется. Это может заполнить вашей базе данных, если у вас есть только пространство мало или много популярных загрузки. В противном случае хранятся только общее число загрузок, потребляющих значительно меньше пространства."
|
85 |
-
|
86 |
-
#: ../tags/0.05/simple-download-monitor.php:237
|
87 |
-
#: ../tags/0.06/simple-download-monitor.php:237
|
88 |
-
#: ../tags/0.07/simple-download-monitor.php:252
|
89 |
-
#: ../trunk/simple-download-monitor.php:253
|
90 |
-
msgid "Use detailed statistics."
|
91 |
-
msgstr "Показать подробную статистику"
|
92 |
-
|
93 |
-
#: ../tags/0.05/simple-download-monitor.php:238
|
94 |
-
#: ../tags/0.06/simple-download-monitor.php:238
|
95 |
-
#: ../tags/0.07/simple-download-monitor.php:253
|
96 |
-
#: ../trunk/simple-download-monitor.php:254
|
97 |
-
msgid "Update settings"
|
98 |
-
msgstr "Обновить настройки"
|
99 |
-
|
100 |
-
#: ../tags/0.05/simple-download-monitor.php:343
|
101 |
-
#: ../tags/0.06/simple-download-monitor.php:343
|
102 |
-
#: ../tags/0.07/simple-download-monitor.php:358
|
103 |
-
#: ../trunk/simple-download-monitor.php:374
|
104 |
-
msgid "First"
|
105 |
-
msgstr "Первый"
|
106 |
-
|
107 |
-
#: ../tags/0.05/simple-download-monitor.php:344
|
108 |
-
#: ../tags/0.06/simple-download-monitor.php:344
|
109 |
-
#: ../tags/0.07/simple-download-monitor.php:359
|
110 |
-
#: ../trunk/simple-download-monitor.php:375
|
111 |
-
msgid "Previous"
|
112 |
-
msgstr "Пред."
|
113 |
-
|
114 |
-
#: ../tags/0.05/simple-download-monitor.php:349
|
115 |
-
#: ../tags/0.06/simple-download-monitor.php:349
|
116 |
-
#: ../tags/0.07/simple-download-monitor.php:364
|
117 |
-
#: ../trunk/simple-download-monitor.php:380
|
118 |
-
msgid "Next"
|
119 |
-
msgstr "След."
|
120 |
-
|
121 |
-
#: ../tags/0.05/simple-download-monitor.php:350
|
122 |
-
#: ../tags/0.06/simple-download-monitor.php:350
|
123 |
-
#: ../tags/0.07/simple-download-monitor.php:365
|
124 |
-
#: ../trunk/simple-download-monitor.php:381
|
125 |
-
msgid "Last"
|
126 |
-
msgstr "Пред."
|
127 |
-
|
128 |
-
#: ../tags/0.05/simple-download-monitor.php:365
|
129 |
-
#: ../tags/0.05/simple-download-monitor.php:428
|
130 |
-
#: ../tags/0.05/simple-download-monitor.php:496
|
131 |
-
#: ../tags/0.05/simple-download-monitor.php:497
|
132 |
-
#: ../tags/0.06/simple-download-monitor.php:365
|
133 |
-
#: ../tags/0.06/simple-download-monitor.php:430
|
134 |
-
#: ../tags/0.06/simple-download-monitor.php:498
|
135 |
-
#: ../tags/0.06/simple-download-monitor.php:499
|
136 |
-
#: ../tags/0.07/simple-download-monitor.php:380
|
137 |
-
#: ../tags/0.07/simple-download-monitor.php:445
|
138 |
-
#: ../tags/0.07/simple-download-monitor.php:513
|
139 |
-
#: ../tags/0.07/simple-download-monitor.php:514
|
140 |
-
#: ../trunk/simple-download-monitor.php:478
|
141 |
-
#: ../trunk/simple-download-monitor.php:555
|
142 |
-
#: ../trunk/simple-download-monitor.php:636
|
143 |
-
#: ../trunk/simple-download-monitor.php:637
|
144 |
-
msgid "Simple Download Monitor"
|
145 |
-
msgstr "Simple Download Monitor"
|
146 |
-
|
147 |
-
#: ../tags/0.05/simple-download-monitor.php:366
|
148 |
-
#: ../tags/0.06/simple-download-monitor.php:366
|
149 |
-
#: ../tags/0.07/simple-download-monitor.php:381
|
150 |
-
#: ../trunk/simple-download-monitor.php:479
|
151 |
-
msgid "Nonexistent downloads"
|
152 |
-
msgstr "Несуществующие загрузки"
|
153 |
-
|
154 |
-
#: ../tags/0.05/simple-download-monitor.php:366
|
155 |
-
#: ../tags/0.06/simple-download-monitor.php:366
|
156 |
-
#: ../tags/0.07/simple-download-monitor.php:381
|
157 |
-
#: ../trunk/simple-download-monitor.php:479
|
158 |
-
msgid "All downloads"
|
159 |
-
msgstr "Все загрузки"
|
160 |
-
|
161 |
-
#: ../tags/0.05/simple-download-monitor.php:367
|
162 |
-
#: ../tags/0.06/simple-download-monitor.php:367
|
163 |
-
#: ../tags/0.07/simple-download-monitor.php:382
|
164 |
-
#: ../trunk/simple-download-monitor.php:480
|
165 |
-
msgid "Show all downloads"
|
166 |
-
msgstr "Показать все загрузки"
|
167 |
-
|
168 |
-
#: ../tags/0.05/simple-download-monitor.php:367
|
169 |
-
#: ../tags/0.06/simple-download-monitor.php:367
|
170 |
-
#: ../tags/0.07/simple-download-monitor.php:382
|
171 |
-
#: ../trunk/simple-download-monitor.php:480
|
172 |
-
msgid "Show nonexistent downloads"
|
173 |
-
msgstr "Показать несуществующие загрузки"
|
174 |
-
|
175 |
-
#: ../tags/0.05/simple-download-monitor.php:378
|
176 |
-
#: ../tags/0.06/simple-download-monitor.php:378
|
177 |
-
#: ../tags/0.07/simple-download-monitor.php:393
|
178 |
-
#: ../trunk/simple-download-monitor.php:495
|
179 |
-
msgid "Filename"
|
180 |
-
msgstr "Имя файла"
|
181 |
-
|
182 |
-
#: ../tags/0.05/simple-download-monitor.php:379
|
183 |
-
#: ../tags/0.06/simple-download-monitor.php:379
|
184 |
-
#: ../tags/0.07/simple-download-monitor.php:394
|
185 |
-
#: ../trunk/simple-download-monitor.php:496
|
186 |
-
msgid "Download count"
|
187 |
-
msgstr "Счет загрузок"
|
188 |
-
|
189 |
-
#: ../tags/0.05/simple-download-monitor.php:380
|
190 |
-
#: ../tags/0.06/simple-download-monitor.php:380
|
191 |
-
#: ../tags/0.07/simple-download-monitor.php:395
|
192 |
-
#: ../trunk/simple-download-monitor.php:497
|
193 |
-
msgid "Last date"
|
194 |
-
msgstr "Последняя дата"
|
195 |
-
|
196 |
-
#: ../tags/0.05/simple-download-monitor.php:429
|
197 |
-
#: ../tags/0.06/simple-download-monitor.php:431
|
198 |
-
#: ../tags/0.07/simple-download-monitor.php:446
|
199 |
-
#: ../trunk/simple-download-monitor.php:556
|
200 |
-
#, php-format
|
201 |
-
msgid "Detailed data for <strong>%s</strong>:"
|
202 |
-
msgstr "Подробные данные для <strong>%s</strong>:"
|
203 |
-
|
204 |
-
#: ../tags/0.05/simple-download-monitor.php:430
|
205 |
-
#: ../tags/0.06/simple-download-monitor.php:432
|
206 |
-
#: ../tags/0.07/simple-download-monitor.php:447
|
207 |
-
#: ../trunk/simple-download-monitor.php:557
|
208 |
-
#, php-format
|
209 |
-
msgid "Total number of downloads: <strong>%d</strong>."
|
210 |
-
msgstr "Общее число загрузок: <strong>%d</strong>."
|
211 |
-
|
212 |
-
#: ../tags/0.05/simple-download-monitor.php:442
|
213 |
-
#: ../tags/0.06/simple-download-monitor.php:444
|
214 |
-
#: ../tags/0.07/simple-download-monitor.php:459
|
215 |
-
#: ../trunk/simple-download-monitor.php:573
|
216 |
-
msgid "Date"
|
217 |
-
msgstr "Данные"
|
218 |
-
|
219 |
-
#: ../tags/0.05/simple-download-monitor.php:443
|
220 |
-
#: ../tags/0.06/simple-download-monitor.php:445
|
221 |
-
#: ../tags/0.07/simple-download-monitor.php:460
|
222 |
-
#: ../trunk/simple-download-monitor.php:574
|
223 |
-
msgid "IP address"
|
224 |
-
msgstr "IP адрес"
|
225 |
-
|
226 |
-
#: ../tags/0.05/simple-download-monitor.php:444
|
227 |
-
#: ../tags/0.06/simple-download-monitor.php:446
|
228 |
-
#: ../tags/0.07/simple-download-monitor.php:461
|
229 |
-
#: ../trunk/simple-download-monitor.php:575
|
230 |
-
msgid "Referer"
|
231 |
-
msgstr "Переход"
|
232 |
-
|
233 |
-
#: ../tags/0.05/simple-download-monitor.php:445
|
234 |
-
#: ../tags/0.06/simple-download-monitor.php:447
|
235 |
-
#: ../tags/0.07/simple-download-monitor.php:462
|
236 |
-
#: ../trunk/simple-download-monitor.php:576
|
237 |
-
msgid "Username"
|
238 |
-
msgstr "Имя пользователя"
|
239 |
-
|
240 |
-
#: ../tags/0.05/simple-download-monitor.php:474
|
241 |
-
#: ../tags/0.06/simple-download-monitor.php:476
|
242 |
-
#: ../tags/0.07/simple-download-monitor.php:491
|
243 |
-
#: ../trunk/simple-download-monitor.php:614
|
244 |
-
msgid "Return to full list."
|
245 |
-
msgstr "Вернуться ко всему списку"
|
246 |
-
|
247 |
-
#: ../tags/0.07/simple-download-monitor.php:245
|
248 |
-
#: ../trunk/simple-download-monitor.php:246
|
249 |
-
msgid "Inline files"
|
250 |
-
msgstr "Список в строку"
|
251 |
-
|
252 |
-
#: ../tags/0.07/simple-download-monitor.php:246
|
253 |
-
#: ../trunk/simple-download-monitor.php:247
|
254 |
-
msgid "Files whose names match this regular expression will be displayed inline (within a HTML page) rather than downloaded."
|
255 |
-
msgstr "Файлы, чьи имена соответствуют этому регулярное выражение будет отображаться Inline (в пределах страницы HTML), а не загружен."
|
256 |
-
|
257 |
-
#: ../tags/0.07/simple-download-monitor.php:247
|
258 |
-
#: ../trunk/simple-download-monitor.php:248
|
259 |
-
msgid "By default, this value is empty - no files will appear inline, all will be downloaded. You may want to place something like <code>\\.(jpe?g|gif|png|swf)$</code> here to make images and Flash videos appear inline."
|
260 |
-
msgstr "По умолчанию, это значение пусто - файлы не появятся Inline, все будет загружен. Вы можете поставить что-то вроде <code>\\.(jpe?g|gif|png|swf)$</code> Здесь, чтобы изображения и флэш-ролики появятся в линию."
|
261 |
-
|
262 |
-
#: ../tags/0.07/simple-download-monitor.php:248
|
263 |
-
#: ../trunk/simple-download-monitor.php:249
|
264 |
-
msgid "Note: Unlike the options above, nothing is implied in this regular expression. You <em>must</em> use an explicit <code>\\.</code> to denote \"start of extension\", you <em>must</em> use an explicit <code>$</code> to mark \"end of filename\", etc."
|
265 |
-
msgstr "Примечание: В отличие от приведенных выше вариантов, ничего в данном случае подразумевают регулярное выражение. Вы<em>must</em> use an explicit <code>\\.</code> to denote \"start of extension\", you <em>must</em> use an explicit <code>$</code> to mark \"end of filename\", etc."
|
266 |
-
|
267 |
-
#: ../trunk/simple-download-monitor.php:520
|
268 |
-
#: ../trunk/simple-download-monitor.php:599
|
269 |
-
msgid "Delete"
|
270 |
-
msgstr "Удалить"
|
271 |
-
|
272 |
-
#: ../trunk/simple-download-monitor.php:528
|
273 |
-
#: ../trunk/simple-download-monitor.php:607
|
274 |
-
msgid "Delete Checked"
|
275 |
-
msgstr "Удалить отмеченное"
|
276 |
-
|
277 |
-
#: ../trunk/simple-download-monitor.php:529
|
278 |
-
#: ../trunk/simple-download-monitor.php:610
|
279 |
-
msgid "Delete All"
|
280 |
-
msgstr "Удалить все"
|
281 |
-
|
282 |
-
#: ../trunk/simple-download-monitor.php:529
|
283 |
-
#: ../trunk/simple-download-monitor.php:610
|
284 |
-
msgid "Yes, I am sure"
|
285 |
-
msgstr "Да, я уверен"
|
286 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lang/cs_CZ.mo
DELETED
Binary file
|
lang/cs_CZ.po
DELETED
@@ -1,388 +0,0 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: Simple Download Monitor v0.19\n"
|
4 |
-
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2012-08-25 13:27+0100\n"
|
6 |
-
"PO-Revision-Date: \n"
|
7 |
-
"Last-Translator: \n"
|
8 |
-
"Language-Team: Pepak <pepak@pepak.net>\n"
|
9 |
-
"MIME-Version: 1.0\n"
|
10 |
-
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
-
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"X-Poedit-Language: Czech\n"
|
13 |
-
"X-Poedit-Country: CZECH REPUBLIC\n"
|
14 |
-
"X-Poedit-SourceCharset: utf-8\n"
|
15 |
-
"X-Poedit-KeywordsList: _e;__\n"
|
16 |
-
"X-Poedit-Basepath: .\n"
|
17 |
-
"X-Poedit-SearchPath-0: ..\n"
|
18 |
-
|
19 |
-
#: ../simple-download-monitor.php:290
|
20 |
-
msgid "Simple Download Monitor error"
|
21 |
-
msgstr "Simple Download Monitor: chyba"
|
22 |
-
|
23 |
-
#: ../simple-download-monitor.php:334
|
24 |
-
#, php-format
|
25 |
-
msgid "You have exceeded your download quota today. Please try again in %d hours and %d minutes."
|
26 |
-
msgstr "Překročil jste svůj dnešní povolený počet downloadů. Zkuste to prosím znovu za %d hodin a %d minut."
|
27 |
-
|
28 |
-
#: ../simple-download-monitor.php:374
|
29 |
-
#: ../simple-download-monitor.php:383
|
30 |
-
#, php-format
|
31 |
-
msgid "Requested file <strong>%s</strong> not found."
|
32 |
-
msgstr "Požadovaný soubor <strong>%s</strong> nebyl nalezen."
|
33 |
-
|
34 |
-
#: ../simple-download-monitor.php:378
|
35 |
-
#, php-format
|
36 |
-
msgid "Requested file <strong>%s</strong> has an invalid path."
|
37 |
-
msgstr "Požadovaný soubor <strong>%s</strong> má neplatný adresář."
|
38 |
-
|
39 |
-
#: ../simple-download-monitor.php:380
|
40 |
-
#, php-format
|
41 |
-
msgid "Requested file <strong>%s</strong> has an invalid extension."
|
42 |
-
msgstr "Požadovaný soubor <strong>%s</strong> má neplatnou příponu."
|
43 |
-
|
44 |
-
#: ../simple-download-monitor.php:533
|
45 |
-
#: ../simple-download-monitor.php:1032
|
46 |
-
msgid "Simple Download Monitor options"
|
47 |
-
msgstr "Simple Download Monitor - nastavení"
|
48 |
-
|
49 |
-
#: ../simple-download-monitor.php:534
|
50 |
-
msgid "Access rights"
|
51 |
-
msgstr "Přístupová práva"
|
52 |
-
|
53 |
-
#: ../simple-download-monitor.php:535
|
54 |
-
msgid "You can set up user rights required to access various functions of Simple Download Monitor. Rights are assigned through capabilities (see <a href=\"http://codex.wordpress.org/Roles_and_Capabilities#Roles\">Roles and Capabilities</a> in WordPress Codex). Predefined values are <strong>read</strong> (\"any registered user\") for displaying stats, <strong>delete_users</strong> (\"administrator\") for reseting stats and <strong>manage_options</strong> (\"administrator\") for changing options."
|
55 |
-
msgstr "Zde můžete nastavit uživatelská práva potřebná pro přístup k jednotlivým funkcím Simple Download Monitoru. Práva jsou definována prostřednictvím schopností (capabilities, viz <a href=\"http://codex.wordpress.org/Roles_and_Capabilities#Roles\">Roles and Capabilities</a> ve WordPress Codex). Výchozí hodnoty jsou <strong>read</strong> (\"každý registrovaný uživatel) pro zobrazení statistik, <strong>delete_users</strong> (\"administrátor\") pro mazání statistik a <strong>manage_options</strong> (\"administrátor\") pro změnu nastavení."
|
56 |
-
|
57 |
-
#: ../simple-download-monitor.php:536
|
58 |
-
msgid "Capability required for viewing download stats:"
|
59 |
-
msgstr "Schopnost (capability) pro zobrazení statistik:"
|
60 |
-
|
61 |
-
#: ../simple-download-monitor.php:538
|
62 |
-
msgid "Capability required for reseting download stats:"
|
63 |
-
msgstr "Schopnost (capability) pro smazání statistik:"
|
64 |
-
|
65 |
-
#: ../simple-download-monitor.php:540
|
66 |
-
msgid "Capability required for setting SDMON options:"
|
67 |
-
msgstr "Schopnost (capability) pro nastavení:"
|
68 |
-
|
69 |
-
#: ../simple-download-monitor.php:542
|
70 |
-
msgid "Allowed directories"
|
71 |
-
msgstr "Povolené adresáře"
|
72 |
-
|
73 |
-
#: ../simple-download-monitor.php:543
|
74 |
-
msgid "Only requested files whose full names (relative to document root) start with this regular expression will be processed. It is strongly recommended to place all downloadable files (and ONLY downloadable files) into a designated directory and then placing that directory's name followed by a slash here. It is possible to use the power of PREG to allow multiple directories, but make sure there are ONLY files which you are comfortable with malicious users downloading. Do not EVER allow directories which contain PHP files here! That could lead to disclosure of sensitive data, including username and password used to connect to WordPress database."
|
75 |
-
msgstr "Zpracovávány budou pouze soubory, jejichž plná jména (relativní vůči kořenovému adresáři webu) začínají tímto regulárním výrazem. Silně doporučuji umístit všechny stažitelné soubory (a JENOM stažitelné soubory) do jednoho určeného adresáře a vepsat sem název tohoto adresáře zakončený lomítkem. Lze také využít všech možností, které dává PREG, pro povolení více adresářů, ale dejte si pozor, ať v nich jsou JEDINĚ soubory, u kterých vám nevadí, když si je stáhne útočník. NIKDY do těchto adresářů neukládejte žádné PHP soubory! To by mohlo vést k zveřejnění citlivých dat, včetně uživatelského jména a hesla pro připojení k databázi."
|
76 |
-
|
77 |
-
#: ../simple-download-monitor.php:544
|
78 |
-
msgid "Default value is <code>files/</code>, which only allows download from /files directory (the leading <code>/</code> is implicit)."
|
79 |
-
msgstr "Výchozí hodnota je <code>files/</code>, která dovolí stahovat pouze soubory z adresáře /files (úvodní <code>/</code> je dosazeno automaticky)."
|
80 |
-
|
81 |
-
#: ../simple-download-monitor.php:546
|
82 |
-
msgid "Allowed extensions"
|
83 |
-
msgstr "Povolené přípony"
|
84 |
-
|
85 |
-
#: ../simple-download-monitor.php:547
|
86 |
-
msgid "Only files with extensions matching this regular expressions will be processed. This is another important security value. Make sure you only add extensions which are safe for malicious users to have, e.g. archives and possibly images. Do NOT use any expression that could allow a user to download PHP files, even if you think it safe given the Allowed Directories option above."
|
87 |
-
msgstr "Zpracovávány budou pouze soubory, jejichž přípony odpovídají tomuto regulárnímu výrazu. Jde o další důležitý bezpečnostní prvek. Dejte si pozor, ať jsou zde uvedeny pouze takové přípony, které nemohou být zneužity útočníky, tzn. komprimované archívy a případně obrázky. NEPOUŽÍVEJTE výrazy, které by mohly uživateli dovolit download PHP souborů, ani kdyby tyto soubory vylučovalo nastavení \"Povolené adresáře\" výše."
|
88 |
-
|
89 |
-
#: ../simple-download-monitor.php:548
|
90 |
-
msgid "Default value is <code>zip|rar|7z</code> which only allows download of files ending with <code>.zip</code>, <code>.rar</code> and <code>.7z</code> (the leading <code>.</code> is implicit)."
|
91 |
-
msgstr "Výchozí hodnota je <code>zip|rar|7z</code>, která povolí pouze stahování souborů s příponou <code>.zip</code>, <code>.rar</code> a <code>.7z</code> (úvodní <code>.</code> je dosazena automaticky)."
|
92 |
-
|
93 |
-
#: ../simple-download-monitor.php:550
|
94 |
-
msgid "Inline files"
|
95 |
-
msgstr "Soubory pro inline zobrazení"
|
96 |
-
|
97 |
-
#: ../simple-download-monitor.php:551
|
98 |
-
msgid "Files whose names match this regular expression will be displayed inline (within a HTML page) rather than downloaded."
|
99 |
-
msgstr "Soubory, které vyhovují tomuto regulárnímu výrazu, budou zobrazeny inline (jako objekt - např. obrázek nebo video - uvnitř HTML stránky) místo aby se stahovaly."
|
100 |
-
|
101 |
-
#: ../simple-download-monitor.php:552
|
102 |
-
msgid "By default, this value is empty - no files will appear inline, all will be downloaded. You may want to place something like <code>\\.(jpe?g|gif|png|swf)$</code> here to make images and Flash videos appear inline."
|
103 |
-
msgstr "Výchozí hodnotou je prázdný řetězec - všechny soubory se budou stahovat, žádný nebude zobrazen inline. Vepište sem něco jako <code>\\.(jpe?g|gif|png|swf)$</code> pro zobrazování obrázků a Flashů inline."
|
104 |
-
|
105 |
-
#: ../simple-download-monitor.php:553
|
106 |
-
msgid "Note: Unlike the options above, nothing is implied in this regular expression. You <em>must</em> use an explicit <code>\\.</code> to denote \"start of extension\", you <em>must</em> use an explicit <code>$</code> to mark \"end of filename\", etc."
|
107 |
-
msgstr "Pozn.: Narozdíl od nastavení uvedených výše se do tohoto regulárního výrazu nic nedoplňuje. Pokud chcete vyznačit \"začátek přípony\", <em>musíte</em> sem napsat <code>\\.</code>; pokud chcete vyznačit \"konec názvu souboru\", <em>musíte</em> sem napsat <code>$</code>, a podobně."
|
108 |
-
|
109 |
-
#: ../simple-download-monitor.php:554
|
110 |
-
msgid "Also note that this plugin uses PCRE-compatible regular expressions, NOT the better-known POSIX-compatible regular expressions. As a result, a valid regular expression must be at least three characters long - separator twice, and at least one character for a meaningful r.e."
|
111 |
-
msgstr "Dále upozorňuji, že plugin používá PCRE-kompatibilní regulární výrazy a ne známější POSIX-kompatibilní. Z tohoto důvodu je vyžadováno, aby regulární výraz byl aspoň tři znaky dlouhý - dva znaky na dva výskyty oddělovače a aspoň jeden znak pro smysluplný r.e."
|
112 |
-
|
113 |
-
#: ../simple-download-monitor.php:556
|
114 |
-
msgid "Store detailed logs?"
|
115 |
-
msgstr "Ukládat detailní záznamy?"
|
116 |
-
|
117 |
-
#: ../simple-download-monitor.php:557
|
118 |
-
msgid "If detailed logs are allowed, various information (including exact time of download, user's IP address, referrer etc.) is stored. This can fill your database quickly if you have only a little space or a lot of popular downloads. Otherwise just the total numbers of downloads are stored, consuming significantly less space."
|
119 |
-
msgstr "Pokud je tato volba zapnuta, ukládají se detailní informace (jako přesný čas, IP adresa uživatele nebo referer) o každém downloadu. To může rychle zahltit databázi, pokud máte jen málo prostoru nebo populární downloady. Normálně se ukládá jen celkový počet stažení, který zabírá podstatně méně místa."
|
120 |
-
|
121 |
-
#: ../simple-download-monitor.php:558
|
122 |
-
msgid "Use detailed statistics."
|
123 |
-
msgstr "Používat detailní statistiky"
|
124 |
-
|
125 |
-
#: ../simple-download-monitor.php:559
|
126 |
-
msgid "Ignored users"
|
127 |
-
msgstr "Ignorovaní uživatelé"
|
128 |
-
|
129 |
-
#: ../simple-download-monitor.php:560
|
130 |
-
msgid "List of users whose downloads are not monitored. Separate multiple users with pipe character <code>|</code>. It is useful to prevent administrator damaging the statistics by testing that downloads work."
|
131 |
-
msgstr "Seznam uživatelů, jejichž downloady nejsou sledovány. Uživatelská jména oddělujte znakem roury <code>|</code>. Funkce se hodí pro administrátory, kteří chtějí ověřovat funkčnost odkazů, ale nepřejí si, aby se jejich testy zaznamenávaly do statistik."
|
132 |
-
|
133 |
-
#: ../simple-download-monitor.php:562
|
134 |
-
msgid "Ignore quick re-downloads"
|
135 |
-
msgstr "Ignorovat rychlé opakované downloady"
|
136 |
-
|
137 |
-
#: ../simple-download-monitor.php:563
|
138 |
-
msgid "If one IP address requests the same download several times within a given time interval, only the first time will be recorded. If a zero or a negative value is entered, all downloads will get recorded regardless of how quickly they occur after each other."
|
139 |
-
msgstr "Pokud se jedna IP adresa pokusí stáhnout jeden soubor několikrát po sobě v daném časovém intervalu, zaznamená se do statistik jen první pokus. Pokud je rozpětí stanoveno na nula nebo záporné číslo, budou se zaznamenávat všechny downloady, bez ohledu na to, jak rychle po sobě následují."
|
140 |
-
|
141 |
-
#: ../simple-download-monitor.php:564
|
142 |
-
msgid "seconds"
|
143 |
-
msgstr "sekund"
|
144 |
-
|
145 |
-
#: ../simple-download-monitor.php:565
|
146 |
-
msgid "Limit number of downloads per IP address"
|
147 |
-
msgstr "Omezit počet downloadů z jedné IP adresy"
|
148 |
-
|
149 |
-
#: ../simple-download-monitor.php:566
|
150 |
-
msgid "Limit the number of files an IP address can download per day. The default value of zero means 'no limits' - an IP address can download as many files as it likes. Note that various download managers can initiate several downloads for each file, so make sure the limit is high enough not to interfere with the normal usage of your site. Also, please understand that this is NOT a perfect solution: One IP address can be shared by multiple users, and one user can easily use more than one IP address."
|
151 |
-
msgstr "Omezit počet souborů, které může jedna IP adresa stáhnout za jeden den. Výchozí hodnota nula značí \"bez omezení\" - IP adresa může stáhnout libovolné množství souborů. Pozor, různé download managery mohou spustit pro jeden soubor několik stahování najednou; ujistěte se, že je limit dost velký na to, aby bránil v běžném používání vašich stránek. Také si prosím uvědomte, že toto NENÍ dokonalé řešení: Jednu IP adresu může sdílet mnoho uživatelů, a naopak jeden uživatel může mít mnoho IP adres."
|
152 |
-
|
153 |
-
#: ../simple-download-monitor.php:567
|
154 |
-
msgid "Users listed in the <strong>Ignored users</strong> section above can always download an unlimited number of files."
|
155 |
-
msgstr "Uživatelé uvedení v sekci <strong>Ignorovaní uživatelé</strong> výše mohou stahovat neomezený počet souborů."
|
156 |
-
|
157 |
-
#: ../simple-download-monitor.php:568
|
158 |
-
msgid "Visitors:"
|
159 |
-
msgstr "Návštěvníci:"
|
160 |
-
|
161 |
-
#: ../simple-download-monitor.php:569
|
162 |
-
msgid "Registered users:"
|
163 |
-
msgstr "Registrovaní uživatelé"
|
164 |
-
|
165 |
-
#: ../simple-download-monitor.php:570
|
166 |
-
msgid "Error message:"
|
167 |
-
msgstr "Chybová zpráva:"
|
168 |
-
|
169 |
-
#: ../simple-download-monitor.php:572
|
170 |
-
#, php-format
|
171 |
-
msgid "(The first <code>%d</code> will be replaced by number of hours, the second one by number of minutes.)"
|
172 |
-
msgstr "(První <code>%d</code> bude nahrazeno počtem hodin, druhé počtem minut.)"
|
173 |
-
|
174 |
-
#: ../simple-download-monitor.php:573
|
175 |
-
msgid "Use more detailed error messages"
|
176 |
-
msgstr "Detailní chybové zprávy"
|
177 |
-
|
178 |
-
#: ../simple-download-monitor.php:574
|
179 |
-
msgid "In case a link doesn't pass the security checks, display a more detailed error message than just \"file not found\". This is useful for the initial setting up, but can be used to exploit the security of your site (e.g. discovering whether a file exists). I recommend unchecking this option as soon as you get SDMon working."
|
180 |
-
msgstr "Pokud odkaz neprojde bezpečnostními kontrolami, zobrazí se detailnější chybová zpráva než jen \"soubor nenalezen\". To se může hodit v průběhu prvotního nastavování pluginu, ale může být zneužito útočníkem k získání citlivých informací (např. jestli soubor existuje nebo neexistuje). Doporučuji tuto volbu odškrtnout hned poté, co se vám podaří SDMon úspěšně rozběhnout."
|
181 |
-
|
182 |
-
#: ../simple-download-monitor.php:575
|
183 |
-
msgid "Use more detailed error messages."
|
184 |
-
msgstr "Používat detailní chybové zprávy."
|
185 |
-
|
186 |
-
#: ../simple-download-monitor.php:576
|
187 |
-
msgid "Use an intermediate Download page"
|
188 |
-
msgstr "Zobrazovat uživateli stránku informující o downloadu"
|
189 |
-
|
190 |
-
#: ../simple-download-monitor.php:577
|
191 |
-
msgid "Before sending the actual requested file, display an intermediate download page which tells the user that the download is about to start."
|
192 |
-
msgstr "Před odesláním vyžádaného souboru bude zobrazena stránka, která uživatele informuje o tom, že jeho download co nevidět začne."
|
193 |
-
|
194 |
-
#: ../simple-download-monitor.php:578
|
195 |
-
msgid "Use the intermediate download page."
|
196 |
-
msgstr "Zobrazovat informační stránku."
|
197 |
-
|
198 |
-
#: ../simple-download-monitor.php:579
|
199 |
-
msgid "Path to your download page:"
|
200 |
-
msgstr "Cesta k informační stránce:"
|
201 |
-
|
202 |
-
#: ../simple-download-monitor.php:580
|
203 |
-
#, php-format
|
204 |
-
msgid "You can use <strong>%s</strong> to use a demo page provided with the plugin."
|
205 |
-
msgstr "Můžete zde vyplnit <strong>%s</strong> - tím použijete demonstrační stránku dodávanou s pluginem."
|
206 |
-
|
207 |
-
#: ../simple-download-monitor.php:581
|
208 |
-
msgid "This functionality was suggested and for the most part programmed by <a href=\"http://matbra.com\">Matheus Bratfisch</a>, I (Pepak) just cleaned it up and added it to the plugin's distribution."
|
209 |
-
msgstr "Tuto funkci navrhl a z větší části naprogramoval <a href=\"http://matbra.com\">Matheus Bratfisch</a>, já (Pepak) jsem ji pouze učesal a přidal do distribučního archívu pluginu."
|
210 |
-
|
211 |
-
#: ../simple-download-monitor.php:582
|
212 |
-
msgid "Basepath modifier"
|
213 |
-
msgstr "Modifikátor k základní cestě"
|
214 |
-
|
215 |
-
#: ../simple-download-monitor.php:583
|
216 |
-
msgid "Note: Keep this option empty unless you know what you are doing. DO NOT ASK! The use of this option is not supported."
|
217 |
-
msgstr "Pozn.: Nechte toto nastavení prázdné, pokud nevíte, co děláte. NEPTEJTE SE MĚ! Toto nastavení není podporované."
|
218 |
-
|
219 |
-
#: ../simple-download-monitor.php:584
|
220 |
-
msgid "You can provide a modifier which, applied to WordPress' ABSPATH, gets you to the base directory from which relative links to files start. This way you can store files outside of the WordPress directory tree, by using something like <code>../private_dir/</code> (the ending slash is required). Note that this option is incompatible with some functionality and is not supported - if you want to use it, search the plugin's source code for <code>basepath_modifier</code>, understand how it is used and then act accordingly."
|
221 |
-
msgstr "Zde můžete uvést modifikátor, který, připojený za ABSPATH, vás dostane do výchozího adresáře, ke kterému se vztahují relativní cesty ke stahovaným souborům. Takto můžete ukládat soubory mimo adresářový strom WordPressu - použijte něco jako <code>../private_dir/</code> (závěrečné lomítko je povinné). Upozorňuji, že toto nastavení není kompatibilní s některými jinými a není podporované - pokud ho chcete použít, najděte si ve zdrojovém kódu pluginu všechny výskyty <code>basepath_modifier</code>, porozumějte jim a teprve pak něco nastavujte."
|
222 |
-
|
223 |
-
#: ../simple-download-monitor.php:587
|
224 |
-
#: ../simple-download-monitor.php:903
|
225 |
-
msgid "Update settings"
|
226 |
-
msgstr "Uložit nastavení"
|
227 |
-
|
228 |
-
#: ../simple-download-monitor.php:712
|
229 |
-
msgid "First"
|
230 |
-
msgstr "První"
|
231 |
-
|
232 |
-
#: ../simple-download-monitor.php:713
|
233 |
-
msgid "Previous"
|
234 |
-
msgstr "Předchozí"
|
235 |
-
|
236 |
-
#: ../simple-download-monitor.php:720
|
237 |
-
msgid "Next"
|
238 |
-
msgstr "Další"
|
239 |
-
|
240 |
-
#: ../simple-download-monitor.php:721
|
241 |
-
msgid "Last"
|
242 |
-
msgstr "Poslední"
|
243 |
-
|
244 |
-
#: ../simple-download-monitor.php:841
|
245 |
-
#: ../simple-download-monitor.php:931
|
246 |
-
#: ../simple-download-monitor.php:1032
|
247 |
-
#: ../simple-download-monitor.php:1033
|
248 |
-
msgid "Simple Download Monitor"
|
249 |
-
msgstr "Simple Download Monitor"
|
250 |
-
|
251 |
-
#: ../simple-download-monitor.php:842
|
252 |
-
msgid "Nonexistent downloads"
|
253 |
-
msgstr "Neexistující soubory"
|
254 |
-
|
255 |
-
#: ../simple-download-monitor.php:842
|
256 |
-
msgid "All downloads"
|
257 |
-
msgstr "Všechny downloady"
|
258 |
-
|
259 |
-
#: ../simple-download-monitor.php:843
|
260 |
-
msgid "Show all downloads"
|
261 |
-
msgstr "Zobrazit všechny soubory"
|
262 |
-
|
263 |
-
#: ../simple-download-monitor.php:843
|
264 |
-
msgid "Show nonexistent downloads"
|
265 |
-
msgstr "Zobrazit neexistující soubory"
|
266 |
-
|
267 |
-
#: ../simple-download-monitor.php:859
|
268 |
-
msgid "Filename"
|
269 |
-
msgstr "Název souboru"
|
270 |
-
|
271 |
-
#: ../simple-download-monitor.php:860
|
272 |
-
msgid "Download count"
|
273 |
-
msgstr "Počet stažení"
|
274 |
-
|
275 |
-
#: ../simple-download-monitor.php:861
|
276 |
-
msgid "Last date"
|
277 |
-
msgstr "Poslední datum"
|
278 |
-
|
279 |
-
#: ../simple-download-monitor.php:862
|
280 |
-
msgid "Hide from sidebar"
|
281 |
-
msgstr "Skrýt z postranního panelu"
|
282 |
-
|
283 |
-
#: ../simple-download-monitor.php:863
|
284 |
-
msgid "Reset to zero"
|
285 |
-
msgstr "Vynulovat"
|
286 |
-
|
287 |
-
#: ../simple-download-monitor.php:888
|
288 |
-
msgid "Hidden"
|
289 |
-
msgstr "Skrytý"
|
290 |
-
|
291 |
-
#: ../simple-download-monitor.php:893
|
292 |
-
msgid "Reset"
|
293 |
-
msgstr "Vynulovat"
|
294 |
-
|
295 |
-
#: ../simple-download-monitor.php:904
|
296 |
-
msgid "Reset checked statistics"
|
297 |
-
msgstr "Vymazat označené statistiky"
|
298 |
-
|
299 |
-
#: ../simple-download-monitor.php:905
|
300 |
-
msgid "Reset all statistics"
|
301 |
-
msgstr "Vymazat všechny statistiky"
|
302 |
-
|
303 |
-
#: ../simple-download-monitor.php:905
|
304 |
-
#: ../simple-download-monitor.php:1002
|
305 |
-
msgid "Yes, I am sure"
|
306 |
-
msgstr "Ano, chci to udělat"
|
307 |
-
|
308 |
-
#: ../simple-download-monitor.php:932
|
309 |
-
#, php-format
|
310 |
-
msgid "Detailed data for <strong>%s</strong>:"
|
311 |
-
msgstr "Detailní data pro <strong>%s</strong>:"
|
312 |
-
|
313 |
-
#: ../simple-download-monitor.php:933
|
314 |
-
#, php-format
|
315 |
-
msgid "Total number of downloads: <strong>%d</strong>."
|
316 |
-
msgstr "Celkový počet stažení: <strong>%d</strong>."
|
317 |
-
|
318 |
-
#: ../simple-download-monitor.php:950
|
319 |
-
msgid "Date"
|
320 |
-
msgstr "Datum"
|
321 |
-
|
322 |
-
#: ../simple-download-monitor.php:951
|
323 |
-
msgid "Country"
|
324 |
-
msgstr "Země"
|
325 |
-
|
326 |
-
#: ../simple-download-monitor.php:952
|
327 |
-
msgid "IP address"
|
328 |
-
msgstr "IP adresa"
|
329 |
-
|
330 |
-
#: ../simple-download-monitor.php:953
|
331 |
-
msgid "Referer"
|
332 |
-
msgstr "Referer"
|
333 |
-
|
334 |
-
#: ../simple-download-monitor.php:954
|
335 |
-
msgid "Username"
|
336 |
-
msgstr "Uživatel"
|
337 |
-
|
338 |
-
#: ../simple-download-monitor.php:991
|
339 |
-
msgid "Delete this statistic"
|
340 |
-
msgstr "Vymazat tuto statistiku"
|
341 |
-
|
342 |
-
#: ../simple-download-monitor.php:999
|
343 |
-
msgid "Delete checked statistics"
|
344 |
-
msgstr "Vymazat označené statistiky"
|
345 |
-
|
346 |
-
#: ../simple-download-monitor.php:1002
|
347 |
-
msgid "Delete all statistics"
|
348 |
-
msgstr "Vymazat všechny statistiky"
|
349 |
-
|
350 |
-
#: ../simple-download-monitor.php:1006
|
351 |
-
msgid "Return to full list."
|
352 |
-
msgstr "Návrat do úplného seznamu"
|
353 |
-
|
354 |
-
#: ../simple-download-monitor.php:1047
|
355 |
-
msgid "Allows you to display the most popular downloads in the sidebar."
|
356 |
-
msgstr "Dovoluje zobrazit v postranním panelu seznam nejoblíbenějších souborů."
|
357 |
-
|
358 |
-
#: ../simple-download-monitor.php:1092
|
359 |
-
msgid "Popular files"
|
360 |
-
msgstr "Oblíbené soubory"
|
361 |
-
|
362 |
-
#: ../simple-download-monitor.php:1098
|
363 |
-
msgid "Title:"
|
364 |
-
msgstr "Zobrazovaný název:"
|
365 |
-
|
366 |
-
#: ../simple-download-monitor.php:1102
|
367 |
-
msgid "Number of files to show:"
|
368 |
-
msgstr "Počet zobrazených souborů:"
|
369 |
-
|
370 |
-
#: ../simple-download-monitor.php:1105
|
371 |
-
msgid "Only show filenames which match this LIKE condition:"
|
372 |
-
msgstr "Zobrazovat pouze soubory, které vyhovují této LIKE podmínce:"
|
373 |
-
|
374 |
-
#: ../simple-download-monitor.php:1107
|
375 |
-
msgid "Empty string matches all filenames and is useful for most usage scenarios. You would only use a non-empty value if you wanted to create multiple SDMon widgets, each showing a different list of files: only filenames which match the given string in a LIKE condition of a SQL query will be shown. The most common values would be something like <code>files/documents/%</code> (meaning \"The filename must begin with <code>files/documents/</code>\") or <code>%.mp3</code> (meaning \"The filename must end with <code>.mp3</code>\") - the percentage symbol <code>%</code> means \"anything\", the underscore symbol <code>_</code> means \"Any one character\"."
|
376 |
-
msgstr "Prázdný řetězec neomezuje seznam souborů a je vhodný pro nejběžnější typy použití. Neprázdnou hodnotu použijte, pokud chcete zobrazit několik nezávislých widgetů, kde každý bude zobrazovat jiný seznam souborů - pak budou zobrazeny jen ty soubory, jejichž názvy vyhoví podmínce. Typické hodnoty vypadají jako <code>files/dokumenty/%</code> (\"Jméno souboru musí začínat <code>files/dokumenty/</code>\") nebo <code>%.mp3</code> (\"Jméno souboru musí končit <code>.mp3</code>\") - symbol procenta <code>%</code> značí \"cokoliv\", symbol podtržítka <code>_</code> značí \"právě jeden libovolný znak\"."
|
377 |
-
|
378 |
-
#~ msgid "Requested file <strong>%s</strong> is not valid."
|
379 |
-
#~ msgstr "Požadovaný soubor <strong>%s</strong> není platný."
|
380 |
-
#~ msgid "<h2>Simple Download Monitor error</h2>"
|
381 |
-
#~ msgstr "<h2>Simple Download Monitor - chyba</h2>"
|
382 |
-
#~ msgid "Reset this statistic"
|
383 |
-
#~ msgstr "Vymazat tuto statistiku"
|
384 |
-
#~ msgid "Delete"
|
385 |
-
#~ msgstr "Smazat"
|
386 |
-
#~ msgid "Delete All"
|
387 |
-
#~ msgstr "Smazat všechny"
|
388 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
langs/SDM.mo
ADDED
Binary file
|
langs/SDM.po
ADDED
@@ -0,0 +1,342 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: simple_download_monitor\n"
|
4 |
+
"POT-Creation-Date: 2013-11-01 01:22-0500\n"
|
5 |
+
"PO-Revision-Date: 2013-11-01 01:24-0500\n"
|
6 |
+
"Last-Translator: \n"
|
7 |
+
"Language-Team: \n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"X-Generator: Poedit 1.5.5\n"
|
12 |
+
"X-Poedit-KeywordsList: __;_e;_x\n"
|
13 |
+
"X-Poedit-Basepath: .\n"
|
14 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
15 |
+
"X-Poedit-SearchPath-0: .\n"
|
16 |
+
"X-Poedit-SearchPath-1: ..\n"
|
17 |
+
|
18 |
+
#: ../main.php:63 ../main.php:262
|
19 |
+
msgid "Settings"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: ../main.php:134 ../main.php:135 ../main.php:140 ../main.php:146
|
23 |
+
#: ../main.php:974
|
24 |
+
msgid "Downloads"
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: ../main.php:136 ../main.php:137
|
28 |
+
msgid "Add New"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: ../main.php:138
|
32 |
+
msgid "Edit Download"
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: ../main.php:139
|
36 |
+
msgid "New Download"
|
37 |
+
msgstr ""
|
38 |
+
|
39 |
+
#: ../main.php:141
|
40 |
+
msgid "View Download"
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
#: ../main.php:142
|
44 |
+
msgid "Search Downloads"
|
45 |
+
msgstr ""
|
46 |
+
|
47 |
+
#: ../main.php:143
|
48 |
+
msgid "No Downloads found"
|
49 |
+
msgstr ""
|
50 |
+
|
51 |
+
#: ../main.php:144
|
52 |
+
msgid "No Downloads found in Trash"
|
53 |
+
msgstr ""
|
54 |
+
|
55 |
+
#: ../main.php:170 ../main.php:180 ../main.php:972
|
56 |
+
msgid "Categories"
|
57 |
+
msgstr ""
|
58 |
+
|
59 |
+
#: ../main.php:171
|
60 |
+
msgid "Category"
|
61 |
+
msgstr ""
|
62 |
+
|
63 |
+
#: ../main.php:172
|
64 |
+
msgid "Search Categories"
|
65 |
+
msgstr ""
|
66 |
+
|
67 |
+
#: ../main.php:173
|
68 |
+
msgid "All Categories"
|
69 |
+
msgstr ""
|
70 |
+
|
71 |
+
#: ../main.php:174
|
72 |
+
msgid "Categories Genre"
|
73 |
+
msgstr ""
|
74 |
+
|
75 |
+
#: ../main.php:175
|
76 |
+
msgid "Categories Genre:"
|
77 |
+
msgstr ""
|
78 |
+
|
79 |
+
#: ../main.php:176
|
80 |
+
msgid "Edit Category"
|
81 |
+
msgstr ""
|
82 |
+
|
83 |
+
#: ../main.php:177
|
84 |
+
msgid "Update Category"
|
85 |
+
msgstr ""
|
86 |
+
|
87 |
+
#: ../main.php:178
|
88 |
+
msgid "Add New Category"
|
89 |
+
msgstr ""
|
90 |
+
|
91 |
+
#: ../main.php:179
|
92 |
+
msgid "New Category"
|
93 |
+
msgstr ""
|
94 |
+
|
95 |
+
#: ../main.php:195 ../main.php:205 ../main.php:973
|
96 |
+
msgid "Tags"
|
97 |
+
msgstr ""
|
98 |
+
|
99 |
+
#: ../main.php:196
|
100 |
+
msgid "Tag"
|
101 |
+
msgstr ""
|
102 |
+
|
103 |
+
#: ../main.php:197
|
104 |
+
msgid "Search Tags"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#: ../main.php:198
|
108 |
+
msgid "All Tags"
|
109 |
+
msgstr ""
|
110 |
+
|
111 |
+
#: ../main.php:199
|
112 |
+
msgid "Tags Genre"
|
113 |
+
msgstr ""
|
114 |
+
|
115 |
+
#: ../main.php:200
|
116 |
+
msgid "Tags Genre:"
|
117 |
+
msgstr ""
|
118 |
+
|
119 |
+
#: ../main.php:201
|
120 |
+
msgid "Edit Tag"
|
121 |
+
msgstr ""
|
122 |
+
|
123 |
+
#: ../main.php:202
|
124 |
+
msgid "Update Tag"
|
125 |
+
msgstr ""
|
126 |
+
|
127 |
+
#: ../main.php:203
|
128 |
+
msgid "Add New Tag"
|
129 |
+
msgstr ""
|
130 |
+
|
131 |
+
#: ../main.php:204
|
132 |
+
msgid "New Tag"
|
133 |
+
msgstr ""
|
134 |
+
|
135 |
+
#: ../main.php:261
|
136 |
+
msgid "Logs"
|
137 |
+
msgstr ""
|
138 |
+
|
139 |
+
#: ../main.php:270
|
140 |
+
msgid "Simple Download Monitor Settings Page"
|
141 |
+
msgstr ""
|
142 |
+
|
143 |
+
#: ../main.php:278 ../main.php:514
|
144 |
+
msgid "Admin Options"
|
145 |
+
msgstr ""
|
146 |
+
|
147 |
+
#: ../main.php:281
|
148 |
+
msgid "Control various plugin features."
|
149 |
+
msgstr ""
|
150 |
+
|
151 |
+
#: ../main.php:284 ../main.php:307
|
152 |
+
msgid "Expand Option Panel"
|
153 |
+
msgstr ""
|
154 |
+
|
155 |
+
#: ../main.php:301
|
156 |
+
msgid "Color Options"
|
157 |
+
msgstr ""
|
158 |
+
|
159 |
+
#: ../main.php:304
|
160 |
+
msgid "Adjust color options"
|
161 |
+
msgstr ""
|
162 |
+
|
163 |
+
#: ../main.php:376
|
164 |
+
msgid "Description"
|
165 |
+
msgstr ""
|
166 |
+
|
167 |
+
#: ../main.php:381
|
168 |
+
msgid "Upload File"
|
169 |
+
msgstr ""
|
170 |
+
|
171 |
+
#: ../main.php:386
|
172 |
+
msgid "File Thumbnail"
|
173 |
+
msgstr ""
|
174 |
+
|
175 |
+
#: ../main.php:391
|
176 |
+
msgid "Shortcode"
|
177 |
+
msgstr ""
|
178 |
+
|
179 |
+
#: ../main.php:396
|
180 |
+
msgid "Statistics"
|
181 |
+
msgstr ""
|
182 |
+
|
183 |
+
#: ../main.php:404
|
184 |
+
msgid "Add a description for this download item."
|
185 |
+
msgstr ""
|
186 |
+
|
187 |
+
#: ../main.php:418
|
188 |
+
msgid "Click \"Select File\" to upload (or choose) the file."
|
189 |
+
msgstr ""
|
190 |
+
|
191 |
+
#: ../main.php:423
|
192 |
+
msgid "File:"
|
193 |
+
msgstr ""
|
194 |
+
|
195 |
+
#: ../main.php:432
|
196 |
+
msgid "Click \"Select Image\" to upload (or choose) the file thumbnail image."
|
197 |
+
msgstr ""
|
198 |
+
|
199 |
+
#: ../main.php:434
|
200 |
+
msgid "Recommended image size is 75px by 75px."
|
201 |
+
msgstr ""
|
202 |
+
|
203 |
+
#: ../main.php:437
|
204 |
+
msgid "Select Image"
|
205 |
+
msgstr ""
|
206 |
+
|
207 |
+
#: ../main.php:438
|
208 |
+
msgid "Remove Image"
|
209 |
+
msgstr ""
|
210 |
+
|
211 |
+
#: ../main.php:453
|
212 |
+
msgid ""
|
213 |
+
"This is the shortcode which can used on posts or pages for this download."
|
214 |
+
msgstr ""
|
215 |
+
|
216 |
+
#: ../main.php:460
|
217 |
+
msgid "These are the statistics for this download item."
|
218 |
+
msgstr ""
|
219 |
+
|
220 |
+
#: ../main.php:465
|
221 |
+
msgid "Number of Downloads:"
|
222 |
+
msgstr ""
|
223 |
+
|
224 |
+
#: ../main.php:515
|
225 |
+
msgid "Colors"
|
226 |
+
msgstr ""
|
227 |
+
|
228 |
+
#: ../main.php:517
|
229 |
+
msgid "Remove Tinymce Button"
|
230 |
+
msgstr ""
|
231 |
+
|
232 |
+
#: ../main.php:518
|
233 |
+
msgid "Download Button Color"
|
234 |
+
msgstr ""
|
235 |
+
|
236 |
+
#: ../main.php:521
|
237 |
+
msgid "Admin options settings"
|
238 |
+
msgstr ""
|
239 |
+
|
240 |
+
#: ../main.php:524
|
241 |
+
msgid "Front End colors settings"
|
242 |
+
msgstr ""
|
243 |
+
|
244 |
+
#: ../main.php:529
|
245 |
+
msgid "Removes the SDM Downloads button from the WP content editor."
|
246 |
+
msgstr ""
|
247 |
+
|
248 |
+
#: ../main.php:534
|
249 |
+
msgid "Green"
|
250 |
+
msgstr ""
|
251 |
+
|
252 |
+
#: ../main.php:534
|
253 |
+
msgid "Blue"
|
254 |
+
msgstr ""
|
255 |
+
|
256 |
+
#: ../main.php:534
|
257 |
+
msgid "Purple"
|
258 |
+
msgstr ""
|
259 |
+
|
260 |
+
#: ../main.php:534
|
261 |
+
msgid "Teal"
|
262 |
+
msgstr ""
|
263 |
+
|
264 |
+
#: ../main.php:534
|
265 |
+
msgid "Dark Blue"
|
266 |
+
msgstr ""
|
267 |
+
|
268 |
+
#: ../main.php:534
|
269 |
+
msgid "Black"
|
270 |
+
msgstr ""
|
271 |
+
|
272 |
+
#: ../main.php:534
|
273 |
+
msgid "Grey"
|
274 |
+
msgstr ""
|
275 |
+
|
276 |
+
#: ../main.php:534
|
277 |
+
msgid "Pink"
|
278 |
+
msgstr ""
|
279 |
+
|
280 |
+
#: ../main.php:534
|
281 |
+
msgid "Orange"
|
282 |
+
msgstr ""
|
283 |
+
|
284 |
+
#: ../main.php:534
|
285 |
+
msgid "White"
|
286 |
+
msgstr ""
|
287 |
+
|
288 |
+
#: ../main.php:543
|
289 |
+
msgid "Adjusts the color of the \"Download Now\" button."
|
290 |
+
msgstr ""
|
291 |
+
|
292 |
+
#: ../main.php:622 ../main.php:969
|
293 |
+
msgid "Title"
|
294 |
+
msgstr ""
|
295 |
+
|
296 |
+
#: ../main.php:623 ../main.php:971
|
297 |
+
msgid "File"
|
298 |
+
msgstr ""
|
299 |
+
|
300 |
+
#: ../main.php:624
|
301 |
+
msgid "Visitor IP"
|
302 |
+
msgstr ""
|
303 |
+
|
304 |
+
#: ../main.php:625
|
305 |
+
msgid "Date"
|
306 |
+
msgstr ""
|
307 |
+
|
308 |
+
#: ../main.php:644
|
309 |
+
msgid "Delete Permanently"
|
310 |
+
msgstr ""
|
311 |
+
|
312 |
+
#: ../main.php:645
|
313 |
+
msgid "Export All as Excel"
|
314 |
+
msgstr ""
|
315 |
+
|
316 |
+
#: ../main.php:773
|
317 |
+
msgid "Download Logs"
|
318 |
+
msgstr ""
|
319 |
+
|
320 |
+
#: ../main.php:776
|
321 |
+
msgid "This page lists all tracked downloads."
|
322 |
+
msgstr ""
|
323 |
+
|
324 |
+
#: ../main.php:836
|
325 |
+
msgid "green"
|
326 |
+
msgstr ""
|
327 |
+
|
328 |
+
#: ../main.php:841 ../main.php:853
|
329 |
+
msgid "Download Now!"
|
330 |
+
msgstr ""
|
331 |
+
|
332 |
+
#: ../main.php:968
|
333 |
+
msgid "Image"
|
334 |
+
msgstr ""
|
335 |
+
|
336 |
+
#: ../main.php:970
|
337 |
+
msgid "ID"
|
338 |
+
msgstr ""
|
339 |
+
|
340 |
+
#: ../main.php:975
|
341 |
+
msgid "Date Posted"
|
342 |
+
msgstr ""
|
main.php
ADDED
@@ -0,0 +1,982 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: Simple Download Monitor
|
4 |
+
* Plugin URI: http://www.tipsandtricks-hq.com/development-center
|
5 |
+
* Description: Easily manage downloadable files and monitor downloads of your digital files from your WordPress site.
|
6 |
+
* Version: 2.0
|
7 |
+
* Author: Tips and Tricks HQ, Ruhul Amin, Josh
|
8 |
+
* Author URI: http://www.tipsandtricks-hq.com/development-center
|
9 |
+
* License: GPL2
|
10 |
+
*/
|
11 |
+
|
12 |
+
global $sdm_db_version;
|
13 |
+
$sdm_db_version = '1.0';
|
14 |
+
|
15 |
+
register_activation_hook(__FILE__, 'sdm_install_db_table' );
|
16 |
+
function sdm_install_db_table() {
|
17 |
+
|
18 |
+
global $wpdb;
|
19 |
+
global $sdm_db_version;
|
20 |
+
|
21 |
+
$table_name = $wpdb->prefix . 'sdm_downloads';
|
22 |
+
|
23 |
+
if($wpdb->get_var("show tables like '".$table_name."'") != $table_name) {
|
24 |
+
|
25 |
+
$sql = 'CREATE TABLE '.$table_name.' (
|
26 |
+
id mediumint(9) NOT NULL AUTO_INCREMENT,
|
27 |
+
post_id mediumint(9) NOT NULL,
|
28 |
+
post_title mediumtext NOT NULL,
|
29 |
+
file_url mediumtext NOT NULL,
|
30 |
+
visitor_ip mediumtext NOT NULL,
|
31 |
+
date_time datetime DEFAULT "0000-00-00 00:00:00" NOT NULL,
|
32 |
+
UNIQUE KEY id (id)
|
33 |
+
);';
|
34 |
+
|
35 |
+
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
36 |
+
dbDelta( $sql );
|
37 |
+
|
38 |
+
add_option( 'sdm_db_version', $sdm_db_version );
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
/*
|
43 |
+
** Handle Language Localization
|
44 |
+
*/
|
45 |
+
add_action('plugins_loaded', 'sdm_plugins_loaded_tasks');
|
46 |
+
function sdm_plugins_loaded_tasks() {
|
47 |
+
//Load language
|
48 |
+
load_plugin_textdomain( 'sdm_lang', false, dirname( plugin_basename( __FILE__ ) ) . '/langs/' );
|
49 |
+
|
50 |
+
//Handle download request if any
|
51 |
+
handle_sdm_download_via_direct_post();
|
52 |
+
}
|
53 |
+
|
54 |
+
/*
|
55 |
+
** Add a 'Settings' link to plugins list page
|
56 |
+
*/
|
57 |
+
add_filter('plugin_action_links', 'sdm_settings_link', 10, 2 );
|
58 |
+
function sdm_settings_link($links, $file) {
|
59 |
+
static $this_plugin;
|
60 |
+
if (!$this_plugin) $this_plugin = plugin_basename(__FILE__);
|
61 |
+
if ($file == $this_plugin){
|
62 |
+
$settings_link = '<a href="edit.php?post_type=sdm_downloads&page=settings" title="SDM Settings Page">'.__("Settings",'sdm_lang').'</a>';
|
63 |
+
array_unshift($links, $settings_link);
|
64 |
+
}
|
65 |
+
return $links;
|
66 |
+
}
|
67 |
+
|
68 |
+
// Houston... we have lift-off!!
|
69 |
+
class simpleDownloadManager {
|
70 |
+
|
71 |
+
public function __construct() {
|
72 |
+
|
73 |
+
if( is_admin()) {
|
74 |
+
add_action( 'init', array( &$this, 'sdm_register_post_type' )); // Create 'sdm_downloads' custom post type
|
75 |
+
add_action( 'init', array( &$this, 'sdm_create_taxonomies' )); // Register 'tags' and 'categories' taxonomies
|
76 |
+
add_action( 'admin_menu', array( &$this, 'sdm_create_menu_pages' )); // Create admin pages
|
77 |
+
add_action( 'add_meta_boxes', array( &$this, 'sdm_create_upload_metabox' )); // Create metaboxes
|
78 |
+
|
79 |
+
add_action( 'save_post', array( &$this, 'sdm_save_description_meta_data' )); // Save 'description' metabox
|
80 |
+
add_action( 'save_post', array( &$this, 'sdm_save_upload_meta_data' )); // Save 'upload file' metabox
|
81 |
+
add_action( 'save_post', array( &$this, 'sdm_save_thumbnail_meta_data' )); // Save 'thumbnail' metabox
|
82 |
+
|
83 |
+
add_action( 'admin_enqueue_scripts', array( &$this, 'sdm_admin_scripts' )); // Register admin scripts
|
84 |
+
add_action( 'admin_print_styles', array( &$this, 'sdm_admin_styles' )); // Register admin styles
|
85 |
+
|
86 |
+
add_action( 'admin_init', array( &$this, 'sdm_register_options' )); // Register admin options
|
87 |
+
|
88 |
+
add_filter( 'post_row_actions',array( &$this, 'sdm_remove_view_link_cpt' )); // Remove 'View' link in CPT view
|
89 |
+
}
|
90 |
+
}
|
91 |
+
|
92 |
+
public function sdm_admin_scripts() {
|
93 |
+
|
94 |
+
global $current_screen, $post;
|
95 |
+
|
96 |
+
if (is_admin() && $current_screen->post_type == 'sdm_downloads' && $current_screen->base == 'post') {
|
97 |
+
|
98 |
+
// These scripts are needed for the media upload thickbox
|
99 |
+
wp_enqueue_script('media-upload');
|
100 |
+
wp_enqueue_script('thickbox');
|
101 |
+
wp_register_script('sdm-upload', WP_PLUGIN_URL.'/simple_download_monitor/js/sdm_admin_scripts.js', array('jquery','media-upload','thickbox'));
|
102 |
+
wp_enqueue_script('sdm-upload');
|
103 |
+
|
104 |
+
// Pass postID for thumbnail deletion
|
105 |
+
?>
|
106 |
+
<script type="text/javascript">
|
107 |
+
var sdm_del_thumb_postid = '<?php echo $post->ID; ?>';
|
108 |
+
</script>
|
109 |
+
<?php
|
110 |
+
}
|
111 |
+
|
112 |
+
// Pass admin ajax url
|
113 |
+
?>
|
114 |
+
<script type="text/javascript">
|
115 |
+
var sdm_admin_ajax_url = { sdm_admin_ajax_url: '<?php echo admin_url('admin-ajax.php?action=ajax'); ?>' };
|
116 |
+
var sdm_plugin_url = '<?php echo plugins_url(); ?>';
|
117 |
+
</script>
|
118 |
+
<?php
|
119 |
+
}
|
120 |
+
|
121 |
+
public function sdm_admin_styles() {
|
122 |
+
|
123 |
+
wp_enqueue_style('thickbox'); // Needed for media upload thickbox
|
124 |
+
wp_enqueue_style('sdm_admin_styles', WP_PLUGIN_URL.'/simple_download_monitor/css/sdm_admin_styles.css'); // Needed for media upload thickbox
|
125 |
+
}
|
126 |
+
|
127 |
+
public function sdm_register_post_type() {
|
128 |
+
|
129 |
+
//*****
|
130 |
+
//***** Create 'sdm_downloads' Custom Post Type
|
131 |
+
$labels = array(
|
132 |
+
'name' => __('Downloads','sdm_lang'),
|
133 |
+
'singular_name' => __('Downloads','sdm_lang'),
|
134 |
+
'add_new' => __('Add New','sdm_lang'),
|
135 |
+
'add_new_item' => __('Add New','sdm_lang'),
|
136 |
+
'edit_item' => __('Edit Download','sdm_lang'),
|
137 |
+
'new_item' => __('New Download','sdm_lang'),
|
138 |
+
'all_items' => __('Downloads','sdm_lang'),
|
139 |
+
'view_item' => __('View Download','sdm_lang'),
|
140 |
+
'search_items' => __('Search Downloads','sdm_lang'),
|
141 |
+
'not_found' => __('No Downloads found','sdm_lang'),
|
142 |
+
'not_found_in_trash' => __('No Downloads found in Trash','sdm_lang'),
|
143 |
+
'parent_item_colon' => __('','sdm_lang'),
|
144 |
+
'menu_name' => __('Downloads','sdm_lang')
|
145 |
+
);
|
146 |
+
$args = array(
|
147 |
+
'labels' => $labels,
|
148 |
+
'public' => true,
|
149 |
+
'publicly_queryable' => true,
|
150 |
+
'show_ui' => true,
|
151 |
+
'show_in_menu' => true,
|
152 |
+
'query_var' => true,
|
153 |
+
'rewrite' => array( 'slug' => 'sdm_downloads' ),
|
154 |
+
'capability_type' => 'post',
|
155 |
+
'has_archive' => true,
|
156 |
+
'hierarchical' => false,
|
157 |
+
'menu_position' => null,
|
158 |
+
'supports' => array( 'title' )
|
159 |
+
);
|
160 |
+
register_post_type( 'sdm_downloads', $args );
|
161 |
+
}
|
162 |
+
|
163 |
+
public function sdm_create_taxonomies() {
|
164 |
+
|
165 |
+
//*****
|
166 |
+
//***** Create CATEGORIES Taxonomy
|
167 |
+
$labels_tags = array(
|
168 |
+
'name' => _x( 'Categories', 'sdm_lang' ),
|
169 |
+
'singular_name' => _x( 'Category', 'sdm_lang' ),
|
170 |
+
'search_items' => __( 'Search Categories', 'sdm_lang' ),
|
171 |
+
'all_items' => __( 'All Categories', 'sdm_lang' ),
|
172 |
+
'parent_item' => __( 'Categories Genre', 'sdm_lang' ),
|
173 |
+
'parent_item_colon' => __( 'Categories Genre:', 'sdm_lang' ),
|
174 |
+
'edit_item' => __( 'Edit Category', 'sdm_lang' ),
|
175 |
+
'update_item' => __( 'Update Category', 'sdm_lang' ),
|
176 |
+
'add_new_item' => __( 'Add New Category', 'sdm_lang' ),
|
177 |
+
'new_item_name' => __( 'New Category', 'sdm_lang' ),
|
178 |
+
'menu_name' => __( 'Categories', 'sdm_lang' )
|
179 |
+
);
|
180 |
+
$args_tags = array(
|
181 |
+
'hierarchical' => true,
|
182 |
+
'labels' => $labels_tags,
|
183 |
+
'show_ui' => true,
|
184 |
+
'query_var' => true,
|
185 |
+
'rewrite' => array( 'slug' => 'sdm_categories' ),
|
186 |
+
'show_admin_column' => true
|
187 |
+
);
|
188 |
+
register_taxonomy( 'sdm_categories', array( 'sdm_downloads' ), $args_tags );
|
189 |
+
|
190 |
+
//*****
|
191 |
+
//***** Create TAGS Taxonomy
|
192 |
+
$labels_tags = array(
|
193 |
+
'name' => _x( 'Tags', 'sdm_lang' ),
|
194 |
+
'singular_name' => _x( 'Tag', 'sdm_lang' ),
|
195 |
+
'search_items' => __( 'Search Tags', 'sdm_lang' ),
|
196 |
+
'all_items' => __( 'All Tags', 'sdm_lang' ),
|
197 |
+
'parent_item' => __( 'Tags Genre', 'sdm_lang' ),
|
198 |
+
'parent_item_colon' => __( 'Tags Genre:', 'sdm_lang' ),
|
199 |
+
'edit_item' => __( 'Edit Tag', 'sdm_lang' ),
|
200 |
+
'update_item' => __( 'Update Tag', 'sdm_lang' ),
|
201 |
+
'add_new_item' => __( 'Add New Tag', 'sdm_lang' ),
|
202 |
+
'new_item_name' => __( 'New Tag', 'sdm_lang' ),
|
203 |
+
'menu_name' => __( 'Tags', 'sdm_lang' )
|
204 |
+
);
|
205 |
+
$args_tags = array(
|
206 |
+
'hierarchical' => false,
|
207 |
+
'labels' => $labels_tags,
|
208 |
+
'show_ui' => true,
|
209 |
+
'query_var' => true,
|
210 |
+
'rewrite' => array( 'slug' => 'sdm_tags' ),
|
211 |
+
'show_admin_column' => true
|
212 |
+
);
|
213 |
+
register_taxonomy( 'sdm_tags', array( 'sdm_downloads' ), $args_tags );
|
214 |
+
}
|
215 |
+
|
216 |
+
public function sdm_create_menu_pages() {
|
217 |
+
|
218 |
+
//*****
|
219 |
+
//***** If user clicked to download the bulk export log
|
220 |
+
if(isset($_GET['download_log']))
|
221 |
+
{
|
222 |
+
global $wpdb;
|
223 |
+
$csv_output = '';
|
224 |
+
$table = $wpdb->prefix.'sdm_downloads';
|
225 |
+
|
226 |
+
$result = mysql_query("SHOW COLUMNS FROM ".$table."");
|
227 |
+
|
228 |
+
$i = 0;
|
229 |
+
if (mysql_num_rows($result) > 0) {
|
230 |
+
while ($row = mysql_fetch_assoc($result)) {
|
231 |
+
$csv_output = $csv_output . $row['Field'].",";
|
232 |
+
$i++;
|
233 |
+
}
|
234 |
+
}
|
235 |
+
$csv_output .= "\n";
|
236 |
+
|
237 |
+
$values = mysql_query("SELECT * FROM ".$table."");
|
238 |
+
while ($rowr = mysql_fetch_row($values)) {
|
239 |
+
for ($j=0; $j<$i; $j++) {
|
240 |
+
$csv_output .= $rowr[$j].",";
|
241 |
+
}
|
242 |
+
$csv_output .= "\n";
|
243 |
+
}
|
244 |
+
|
245 |
+
header("Pragma: public");
|
246 |
+
header("Expires: 0");
|
247 |
+
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
248 |
+
header("Cache-Control: private", false);
|
249 |
+
header("Content-Type: application/octet-stream");
|
250 |
+
header("Content-Disposition: attachment; filename=\"report.csv\";" );
|
251 |
+
header("Content-Transfer-Encoding: binary");
|
252 |
+
|
253 |
+
echo $csv_output;
|
254 |
+
exit;
|
255 |
+
}
|
256 |
+
|
257 |
+
//*****
|
258 |
+
//***** Create the 'logs' and 'settings' submenu pages
|
259 |
+
$sdm_logs_page = add_submenu_page( 'edit.php?post_type=sdm_downloads', __('Logs', 'sdm_lang'), __('Logs', 'sdm_lang'), 'manage_options', 'logs', 'sdm_create_logs_page' );
|
260 |
+
$sdm_settings_page = add_submenu_page( 'edit.php?post_type=sdm_downloads', __('Settings', 'sdm_lang'), __('Settings', 'sdm_lang'), 'manage_options', 'settings', array( &$this, 'sdm_create_settings_page' ));
|
261 |
+
}
|
262 |
+
|
263 |
+
public function sdm_create_settings_page()
|
264 |
+
{
|
265 |
+
echo '<div class="wrap">';
|
266 |
+
echo '<div id="poststuff"><div id="post-body">';
|
267 |
+
?>
|
268 |
+
<h2><?php _e('Simple Download Monitor Settings Page', 'sdm_lang') ?></h2>
|
269 |
+
|
270 |
+
<div style="background: #FFF6D5; border: 1px solid #D1B655; color: #3F2502; padding: 15px 10px">
|
271 |
+
<a href="http://www.tipsandtricks-hq.com/development-center" target="_blank">Follow us</a> on Twitter, Google+ or via Email to stay upto date about the new features of this plugin.
|
272 |
+
</div>
|
273 |
+
|
274 |
+
<!-- settings page form -->
|
275 |
+
<form method="post" action="options.php">
|
276 |
+
|
277 |
+
<!-- BEGIN ADMIN OPTIONS DIV -->
|
278 |
+
<div id="sdm_admin_opts_div" class="sdm_sliding_div_title">
|
279 |
+
<div class="sdm_slider_title">
|
280 |
+
<?php _e('Admin Options', 'sdm_lang') ?>
|
281 |
+
</div>
|
282 |
+
<div class="sdm_desc">
|
283 |
+
<?php _e("Control various plugin features.", 'sdm_lang') ?>
|
284 |
+
</div>
|
285 |
+
</div>
|
286 |
+
<div id="sliding_div1" class="slidingDiv">
|
287 |
+
<?php
|
288 |
+
// This prints out all hidden setting fields
|
289 |
+
do_settings_sections( 'admin_options_section' );
|
290 |
+
settings_fields( 'sdm_downloads_options' );
|
291 |
+
|
292 |
+
submit_button();
|
293 |
+
?>
|
294 |
+
</div>
|
295 |
+
<!-- END ADMIN OPTIONS DIV -->
|
296 |
+
|
297 |
+
<!-- BEGIN COLORS DIV -->
|
298 |
+
<div id="sdm_color_opts_div" class="sdm_sliding_div_title">
|
299 |
+
<div class="sdm_slider_title">
|
300 |
+
<?php _e('Color Options', 'sdm_lang') ?>
|
301 |
+
</div>
|
302 |
+
<div class="sdm_desc">
|
303 |
+
<?php _e("Adjust color options", 'sdm_lang') ?>
|
304 |
+
</div>
|
305 |
+
</div>
|
306 |
+
<div id="sliding_div2" class="slidingDiv">
|
307 |
+
<?php
|
308 |
+
// This prints out all hidden setting fields
|
309 |
+
do_settings_sections( 'sdm_colors_section' );
|
310 |
+
settings_fields( 'sdm_downloads_options' );
|
311 |
+
|
312 |
+
submit_button();
|
313 |
+
?>
|
314 |
+
</div>
|
315 |
+
<!-- END COLORS OPTIONS DIV -->
|
316 |
+
|
317 |
+
<!-- End of settings page form -->
|
318 |
+
</form>
|
319 |
+
|
320 |
+
<?php
|
321 |
+
echo '</div></div>';//end of post-stuff
|
322 |
+
echo '</div>';//end of wrap
|
323 |
+
}
|
324 |
+
|
325 |
+
public function sdm_create_upload_metabox() {
|
326 |
+
|
327 |
+
//*****
|
328 |
+
//***** Create metaboxes for the custom post type
|
329 |
+
add_meta_box('sdm_description_meta_box',
|
330 |
+
__('Description', 'sdm_lang'),
|
331 |
+
array( &$this, 'display_sdm_description_meta_box'),
|
332 |
+
'sdm_downloads', 'normal', 'default'
|
333 |
+
);
|
334 |
+
add_meta_box('sdm_upload_meta_box',
|
335 |
+
__('Upload File', 'sdm_lang'),
|
336 |
+
array( &$this, 'display_sdm_upload_meta_box'),
|
337 |
+
'sdm_downloads', 'normal', 'default'
|
338 |
+
);
|
339 |
+
add_meta_box('sdm_thumbnail_meta_box',
|
340 |
+
__('File Thumbnail (Optional)', 'sdm_lang'),
|
341 |
+
array( &$this, 'display_sdm_thumbnail_meta_box'),
|
342 |
+
'sdm_downloads', 'normal', 'default'
|
343 |
+
);
|
344 |
+
add_meta_box('sdm_shortcode_meta_box',
|
345 |
+
__('Shortcode', 'sdm_lang'),
|
346 |
+
array( &$this, 'display_sdm_shortcode_meta_box'),
|
347 |
+
'sdm_downloads', 'normal', 'default'
|
348 |
+
);
|
349 |
+
add_meta_box('sdm_stats_meta_box',
|
350 |
+
__('Statistics', 'sdm_lang'),
|
351 |
+
array( &$this, 'display_sdm_stats_meta_box'),
|
352 |
+
'sdm_downloads', 'normal', 'default'
|
353 |
+
);
|
354 |
+
}
|
355 |
+
|
356 |
+
public function display_sdm_description_meta_box( $post ) { // Description metabox
|
357 |
+
|
358 |
+
_e('Add a description for this download item.','sdm_lang');
|
359 |
+
echo '<br /><br />';
|
360 |
+
|
361 |
+
$old_description = get_post_meta( $post->ID, 'sdm_description', true );
|
362 |
+
?>
|
363 |
+
<textarea id="sdm_description" name="sdm_description" style="width:60%;height:40px;"><?php echo $old_description; ?></textarea>
|
364 |
+
<?php
|
365 |
+
wp_nonce_field( 'sdm_description_box_nonce', 'sdm_description_box_nonce_check' );
|
366 |
+
}
|
367 |
+
|
368 |
+
public function display_sdm_upload_meta_box( $post ) { // File Upload metabox
|
369 |
+
|
370 |
+
$old_upload = get_post_meta( $post->ID, 'sdm_upload', true );
|
371 |
+
$old_value = isset($old_upload) ? $old_upload : '';
|
372 |
+
_e('Click "Select File" to upload (or choose) the file.', 'sdm_lang');
|
373 |
+
?>
|
374 |
+
<br /><br />
|
375 |
+
<input id="upload_image_button" type="button" class="button-primary" value="Select File" />
|
376 |
+
<span style="margin-left:40px;"></span>
|
377 |
+
<?php _e('File URL:', 'sdm_lang') ?> <input id="sdm_upload" type="text" size="150" name="sdm_upload" value="<?php echo $old_value; ?>" />
|
378 |
+
<?php
|
379 |
+
wp_nonce_field( 'sdm_upload_box_nonce', 'sdm_upload_box_nonce_check' );
|
380 |
+
}
|
381 |
+
|
382 |
+
public function display_sdm_thumbnail_meta_box( $post ) { // Thumbnail upload metabox
|
383 |
+
|
384 |
+
$old_thumbnail = get_post_meta( $post->ID, 'sdm_upload_thumbnail', true );
|
385 |
+
$old_value = isset($old_thumbnail) ? $old_thumbnail : '';
|
386 |
+
_e('Click "Select Image" to upload (or choose) the file thumbnail image. This thumbnail image will be used to create a fancy file download box if you want to use it.', 'sdm_lang');
|
387 |
+
echo '<br />';
|
388 |
+
_e('Recommended image size is 75px by 75px.', 'sdm_lang');
|
389 |
+
?>
|
390 |
+
<br /><br />
|
391 |
+
<input id="upload_thumbnail_button" type="button" class="button-primary" value="<?php _e('Select Image', 'sdm_lang'); ?>" />
|
392 |
+
<input id="remove_thumbnail_button" type="button" class="button" value="<?php _e('Remove Image', 'sdm_lang'); ?>" />
|
393 |
+
<span style="margin-left:40px;"></span>
|
394 |
+
<input id="sdm_upload_thumbnail" type="hidden" size="150" name="sdm_upload_thumbnail" value="<?php echo $old_value; ?>" />
|
395 |
+
<span id="sdm_get_thumb">
|
396 |
+
<?php
|
397 |
+
if($old_value != '') {
|
398 |
+
?><img id="sdm_thumbnail_image" src="<?php echo $old_value; ?>" />
|
399 |
+
<?php
|
400 |
+
}
|
401 |
+
?></span><?php
|
402 |
+
wp_nonce_field( 'sdm_thumbnail_box_nonce', 'sdm_thumbnail_box_nonce_check' );
|
403 |
+
}
|
404 |
+
|
405 |
+
public function display_sdm_shortcode_meta_box( $post ) { // Shortcode metabox
|
406 |
+
|
407 |
+
_e('This is the shortcode which can used on posts or pages to embed a download now button for this file. You can also use the shortcode inserter to add this shortcode to a post or page.','sdm_lang');
|
408 |
+
echo '<br /><br />';
|
409 |
+
echo '[sdm-download id="'.$post->ID.'" fancy="0"]';
|
410 |
+
}
|
411 |
+
|
412 |
+
public function display_sdm_stats_meta_box( $post ) { // Stats metabox
|
413 |
+
|
414 |
+
_e('These are the statistics for this download item.','sdm_lang');
|
415 |
+
echo '<br /><br />';
|
416 |
+
|
417 |
+
global $wpdb;
|
418 |
+
$wpdb->get_results($wpdb->prepare('SELECT * FROM '.$wpdb->prefix.'sdm_downloads WHERE post_id=%s', $post->ID));
|
419 |
+
_e('Number of Downloads:', 'sdm_lang'); echo ' '.$wpdb->num_rows;
|
420 |
+
}
|
421 |
+
|
422 |
+
public function sdm_save_description_meta_data($post_id) { // Save Description metabox
|
423 |
+
|
424 |
+
if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
425 |
+
return;
|
426 |
+
if( !isset( $_POST['sdm_description_box_nonce_check'] ) || !wp_verify_nonce( $_POST['sdm_description_box_nonce_check'], 'sdm_description_box_nonce' ) )
|
427 |
+
return;
|
428 |
+
|
429 |
+
if( isset( $_POST['sdm_description'] ) ) {
|
430 |
+
update_post_meta( $post_id, 'sdm_description', $_POST['sdm_description'] );
|
431 |
+
}
|
432 |
+
|
433 |
+
}
|
434 |
+
|
435 |
+
public function sdm_save_upload_meta_data($post_id) { // Save File Upload metabox
|
436 |
+
|
437 |
+
if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
438 |
+
return;
|
439 |
+
if( !isset( $_POST['sdm_upload_box_nonce_check'] ) || !wp_verify_nonce( $_POST['sdm_upload_box_nonce_check'], 'sdm_upload_box_nonce' ) )
|
440 |
+
return;
|
441 |
+
|
442 |
+
if( isset( $_POST['sdm_upload'] ) ) {
|
443 |
+
update_post_meta( $post_id, 'sdm_upload', $_POST['sdm_upload'] );
|
444 |
+
}
|
445 |
+
}
|
446 |
+
|
447 |
+
public function sdm_save_thumbnail_meta_data($post_id) { // Save Thumbnail Upload metabox
|
448 |
+
|
449 |
+
if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|
450 |
+
return;
|
451 |
+
if( !isset( $_POST['sdm_thumbnail_box_nonce_check'] ) || !wp_verify_nonce( $_POST['sdm_thumbnail_box_nonce_check'], 'sdm_thumbnail_box_nonce' ) )
|
452 |
+
return;
|
453 |
+
|
454 |
+
if( isset( $_POST['sdm_upload_thumbnail'] ) ) {
|
455 |
+
update_post_meta( $post_id, 'sdm_upload_thumbnail', $_POST['sdm_upload_thumbnail'] );
|
456 |
+
}
|
457 |
+
}
|
458 |
+
|
459 |
+
public function sdm_remove_view_link_cpt( $action ) {
|
460 |
+
|
461 |
+
unset ($action['view']);
|
462 |
+
return $action;
|
463 |
+
}
|
464 |
+
|
465 |
+
public function sdm_register_options() {
|
466 |
+
|
467 |
+
register_setting( 'sdm_downloads_options', 'sdm_downloads_options' );
|
468 |
+
add_settings_section( 'admin_options', __('Admin Options', 'sdm_lang'), array( $this, 'admin_options_cb' ), 'admin_options_section' );
|
469 |
+
add_settings_section( 'sdm_colors', __('Colors', 'sdm_lang'), array( $this, 'sdm_colors_cb' ), 'sdm_colors_section' );
|
470 |
+
|
471 |
+
add_settings_field( 'admin_tinymce_button', __('Remove Tinymce Button', 'sdm_lang'), array( $this, 'admin_tinymce_button_cb' ), 'admin_options_section', 'admin_options' );
|
472 |
+
add_settings_field( 'download_button_color', __('Download Button Color', 'sdm_lang'), array( $this, 'download_button_color_cb' ), 'sdm_colors_section', 'sdm_colors' );
|
473 |
+
}
|
474 |
+
public function admin_options_cb() {
|
475 |
+
_e('Admin options settings', 'sdm_lang');
|
476 |
+
}
|
477 |
+
public function sdm_colors_cb() {
|
478 |
+
_e('Front End colors settings', 'sdm_lang');
|
479 |
+
}
|
480 |
+
public function admin_tinymce_button_cb() {
|
481 |
+
$main_opts = get_option('sdm_downloads_options');
|
482 |
+
echo '<input name="sdm_downloads_options[admin_tinymce_button]" id="admin_tinymce_button" type="checkbox" class="sdm_opts_ajax_checkboxes" ' . checked( 1, isset($main_opts['admin_tinymce_button']), false ) . ' /> ';
|
483 |
+
_e('Removes the SDM Downloads button from the WP content editor.', 'sdm_lang');
|
484 |
+
}
|
485 |
+
public function download_button_color_cb() {
|
486 |
+
$main_opts = get_option('sdm_downloads_options');
|
487 |
+
$color_opt = $main_opts['download_button_color'];
|
488 |
+
$color_opts = array( __('Green','sdm_lang'), __('Blue','sdm_lang'),__('Purple','sdm_lang'),__('Teal','sdm_lang'),__('Dark Blue','sdm_lang'),__('Black','sdm_lang'),__('Grey','sdm_lang'),__('Pink','sdm_lang'),__('Orange','sdm_lang'),__('White','sdm_lang') );
|
489 |
+
echo '<select name="sdm_downloads_options[download_button_color]" id="download_button_color" class="sdm_opts_ajax_dropdowns">';
|
490 |
+
if(isset($color_opt)) {
|
491 |
+
echo '<option value="'.$color_opt.'" selected="selected">'.$color_opt.' (current)</option>';
|
492 |
+
}
|
493 |
+
foreach ($color_opts as $color) {
|
494 |
+
echo '<option value="'.$color.'" '.$sel_color.'>'.$color.'</option>';
|
495 |
+
}
|
496 |
+
echo '</select> ';
|
497 |
+
_e('Adjusts the color of the "Download Now" button.', 'sdm_lang');
|
498 |
+
}
|
499 |
+
|
500 |
+
}
|
501 |
+
$simpleDownloadManager = new simpleDownloadManager();
|
502 |
+
|
503 |
+
/*
|
504 |
+
**
|
505 |
+
** Logs Page
|
506 |
+
**
|
507 |
+
*/
|
508 |
+
//*****
|
509 |
+
//***** Check WP_List_Table exists
|
510 |
+
if(!class_exists('WP_List_Table')){
|
511 |
+
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
|
512 |
+
}
|
513 |
+
|
514 |
+
//*****
|
515 |
+
//***** Define our new Table
|
516 |
+
class sdm_List_Table extends WP_List_Table {
|
517 |
+
|
518 |
+
|
519 |
+
function __construct(){
|
520 |
+
|
521 |
+
global $status, $page;
|
522 |
+
|
523 |
+
//Set parent defaults
|
524 |
+
parent::__construct( array(
|
525 |
+
'singular' => 'Download', //singular name of the listed records
|
526 |
+
'plural' => 'Downloads', //plural name of the listed records
|
527 |
+
'ajax' => false //does this table support ajax?
|
528 |
+
) );
|
529 |
+
|
530 |
+
}
|
531 |
+
|
532 |
+
function column_default($item, $column_name){
|
533 |
+
|
534 |
+
switch($column_name){
|
535 |
+
case 'URL':
|
536 |
+
case 'visitor_ip':
|
537 |
+
case 'date':
|
538 |
+
return $item[$column_name];
|
539 |
+
default:
|
540 |
+
return print_r($item,true); //Show the whole array for troubleshooting purposes
|
541 |
+
}
|
542 |
+
}
|
543 |
+
|
544 |
+
function column_title($item){
|
545 |
+
|
546 |
+
//Build row actions
|
547 |
+
$actions = array(
|
548 |
+
'edit' => sprintf('<a href="'.admin_url( 'post.php?post='.$item['ID'].'&action=edit' ).'">Edit</a>'),
|
549 |
+
'delete' => sprintf('<a href="?post_type=sdm_downloads&page=%s&action=%s&download=%s&datetime=%s">Delete</a>',$_REQUEST['page'],'delete',$item['ID'],$item['date'])
|
550 |
+
);
|
551 |
+
|
552 |
+
//Return the title contents
|
553 |
+
return sprintf('%1$s <span style="color:silver">(id:%2$s)</span>%3$s',
|
554 |
+
/*$1%s*/ $item['title'],
|
555 |
+
/*$2%s*/ $item['ID'],
|
556 |
+
/*$3%s*/ $this->row_actions($actions)
|
557 |
+
);
|
558 |
+
}
|
559 |
+
|
560 |
+
function column_cb($item){
|
561 |
+
|
562 |
+
return sprintf(
|
563 |
+
'<input type="checkbox" name="%1$s[]" value="%2$s" />',
|
564 |
+
/*$1%s*/ $this->_args['singular'], //Let's simply repurpose the table's singular label ("Download")
|
565 |
+
/*$2%s*/ $item['ID'].'|'.$item['date'] //The value of the checkbox should be the record's id
|
566 |
+
);
|
567 |
+
}
|
568 |
+
|
569 |
+
function get_columns(){
|
570 |
+
|
571 |
+
$columns = array(
|
572 |
+
'cb' => '<input type="checkbox" />', //Render a checkbox instead of text
|
573 |
+
'title' => __('Title','sdm_lang'),
|
574 |
+
'URL' => __('File','sdm_lang'),
|
575 |
+
'visitor_ip' => __('Visitor IP','sdm_lang'),
|
576 |
+
'date' => __('Date','sdm_lang')
|
577 |
+
);
|
578 |
+
return $columns;
|
579 |
+
}
|
580 |
+
|
581 |
+
function get_sortable_columns() {
|
582 |
+
|
583 |
+
$sortable_columns = array(
|
584 |
+
'title' => array('title',false), //true means it's already sorted
|
585 |
+
'URL' => array('URL',false),
|
586 |
+
'visitor_ip' => array('visitor_ip',false),
|
587 |
+
'date' => array('date',false)
|
588 |
+
);
|
589 |
+
return $sortable_columns;
|
590 |
+
}
|
591 |
+
|
592 |
+
function get_bulk_actions() {
|
593 |
+
|
594 |
+
$actions = array();
|
595 |
+
$actions['delete2'] = __( 'Delete Permanently', 'sdm_lang' );
|
596 |
+
$actions['export_all'] = __( 'Export All as Excel', 'sdm_lang' );
|
597 |
+
//$actions['export-selected'] = __( 'Export Selected', 'sdm_lang' );
|
598 |
+
|
599 |
+
return $actions;
|
600 |
+
}
|
601 |
+
|
602 |
+
function process_bulk_action() {
|
603 |
+
|
604 |
+
// security check!
|
605 |
+
if ( isset( $_POST['_wpnonce'] ) && ! empty( $_POST['_wpnonce'] ) ) {
|
606 |
+
|
607 |
+
$nonce = filter_input( INPUT_POST, '_wpnonce', FILTER_SANITIZE_STRING );
|
608 |
+
$action = 'bulk-' . $this->_args['plural'];
|
609 |
+
|
610 |
+
if ( ! wp_verify_nonce( $nonce, $action ) )
|
611 |
+
wp_die( 'Nope! Security check failed!' );
|
612 |
+
|
613 |
+
}
|
614 |
+
|
615 |
+
$action = $this->current_action();
|
616 |
+
|
617 |
+
// If bulk 'Export All' was clicked
|
618 |
+
if( 'export_all' === $this->current_action() ) {
|
619 |
+
|
620 |
+
echo '<div id="message" class="updated"><p><strong><a id="sdm_download_export" href="?post_type=sdm_downloads&page=logs&download_log">Download Export File</a></strong></p></div>';
|
621 |
+
}
|
622 |
+
|
623 |
+
// if bulk 'Delete Permanently' was clicked
|
624 |
+
if( 'delete2' === $this->current_action() ) {
|
625 |
+
|
626 |
+
if( !isset($_POST['download']) || $_POST['download'] == null) {
|
627 |
+
echo '<div id="message" class="updated fade"><p><strong>No entries were selected.</strong></p><p><em>Click to Dismiss</em></p></div>';
|
628 |
+
return;
|
629 |
+
}
|
630 |
+
|
631 |
+
foreach($_POST['download'] as $item) {
|
632 |
+
$str_tok_id = substr($item, 0, strpos($item, '|'));
|
633 |
+
$str_tok_datetime = substr($item,strpos($item,'|')+1);
|
634 |
+
|
635 |
+
global $wpdb;
|
636 |
+
$del_row = $wpdb->query(
|
637 |
+
'DELETE FROM '.$wpdb->prefix.'sdm_downloads
|
638 |
+
WHERE post_id = "'.$str_tok_id.'"
|
639 |
+
AND date_time = "'.$str_tok_datetime.'"'
|
640 |
+
);
|
641 |
+
}
|
642 |
+
if($del_row) {
|
643 |
+
echo '<div id="message" class="updated fade"><p><strong>Entries Deleted!</strong></p><p><em>Click to Dismiss</em></p></div>';
|
644 |
+
}
|
645 |
+
else {
|
646 |
+
echo '<div id="message" class="updated fade"><p><strong>Error</strong></p><p><em>Click to Dismiss</em></p></div>';
|
647 |
+
}
|
648 |
+
}
|
649 |
+
|
650 |
+
// If single entry 'Delete' was clicked
|
651 |
+
if( 'delete'===$this->current_action() ) {
|
652 |
+
|
653 |
+
$item_id = isset($_GET['download']) ? strtok($_GET['download'], '|') : '';
|
654 |
+
$item_datetime = isset($_GET['datetime']) ? $_GET['datetime'] : '';
|
655 |
+
|
656 |
+
global $wpdb;
|
657 |
+
$del_row = $wpdb->query(
|
658 |
+
'DELETE FROM '.$wpdb->prefix.'sdm_downloads
|
659 |
+
WHERE post_id = "'.$item_id.'"
|
660 |
+
AND date_time = "'.$item_datetime.'"'
|
661 |
+
);
|
662 |
+
if($del_row) {
|
663 |
+
echo '<div id="message" class="updated fade"><p><strong>Entry Deleted!</strong></p><p><em>Click to Dismiss</em></p></div>';
|
664 |
+
}
|
665 |
+
else {
|
666 |
+
echo '<div id="message" class="updated fade"><p><strong>Error</strong></p><p><em>Click to Dismiss</em></p></div>';
|
667 |
+
}
|
668 |
+
}
|
669 |
+
|
670 |
+
}
|
671 |
+
|
672 |
+
function prepare_items() {
|
673 |
+
|
674 |
+
global $wpdb; //This is used only if making any database queries
|
675 |
+
$per_page = 10;
|
676 |
+
$columns = $this->get_columns();
|
677 |
+
$hidden = array();
|
678 |
+
$sortable = $this->get_sortable_columns();
|
679 |
+
|
680 |
+
|
681 |
+
$this->_column_headers = array($columns, $hidden, $sortable);
|
682 |
+
$this->process_bulk_action();
|
683 |
+
//$data = $this->example_data;
|
684 |
+
|
685 |
+
function usort_reorder($a,$b){
|
686 |
+
$orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'title'; //If no sort, default to title
|
687 |
+
$order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc'; //If no order, default to asc
|
688 |
+
$result = strcmp($a[$orderby], $b[$orderby]); //Determine sort order
|
689 |
+
return ($order==='asc') ? $result : -$result; //Send final sort direction to usort
|
690 |
+
}
|
691 |
+
|
692 |
+
$data_results = $wpdb->get_results($wpdb->prepare('SELECT * FROM '.$wpdb->prefix.'sdm_downloads', null ));
|
693 |
+
$data = array();
|
694 |
+
foreach ($data_results as $data_result) {
|
695 |
+
$data[] = array( 'ID' => $data_result->post_id, 'title' => $data_result->post_title, 'URL' => $data_result->file_url, 'visitor_ip' => $data_result->visitor_ip, 'date' => $data_result->date_time );
|
696 |
+
}
|
697 |
+
|
698 |
+
|
699 |
+
usort($data, 'usort_reorder');
|
700 |
+
$current_page = $this->get_pagenum();
|
701 |
+
$total_items = count($data);
|
702 |
+
$data = array_slice($data,(($current_page-1)*$per_page),$per_page);
|
703 |
+
|
704 |
+
$this->items = $data;
|
705 |
+
$this->set_pagination_args( array(
|
706 |
+
'total_items' => $total_items, //WE have to calculate the total number of items
|
707 |
+
'per_page' => $per_page, //WE have to determine how many items to show on a page
|
708 |
+
'total_pages' => ceil($total_items/$per_page) //WE have to calculate the total number of pages
|
709 |
+
) );
|
710 |
+
}
|
711 |
+
|
712 |
+
}
|
713 |
+
function sdm_create_logs_page(){
|
714 |
+
|
715 |
+
//Create an instance of our package class...
|
716 |
+
$sdmListTable = new sdm_List_Table();
|
717 |
+
//Fetch, prepare, sort, and filter our data...
|
718 |
+
$sdmListTable->prepare_items();
|
719 |
+
|
720 |
+
?>
|
721 |
+
<div class="wrap">
|
722 |
+
|
723 |
+
<div id="icon-users" class="icon32"><br/></div>
|
724 |
+
<h2><?php _e('Download Logs', 'sdm_lang'); ?></h2>
|
725 |
+
|
726 |
+
<div style="background:#ECECEC;border:1px solid #CCC;padding:0 10px;margin-top:5px;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px;">
|
727 |
+
<p><?php _e('This page lists all tracked downloads.', 'sdm_lang'); ?></p>
|
728 |
+
</div>
|
729 |
+
|
730 |
+
<!-- Forms are NOT created automatically, so you need to wrap the table in one to use features like bulk actions -->
|
731 |
+
<form id="sdm_downloads-filter" method="post">
|
732 |
+
<input type="hidden" name="page" value="<?php echo $_REQUEST['page'] ?>" />
|
733 |
+
<!-- Now we can render the completed list table -->
|
734 |
+
<?php $sdmListTable->display() ?>
|
735 |
+
</form>
|
736 |
+
|
737 |
+
</div>
|
738 |
+
<script type="text/javascript">
|
739 |
+
jQuery(document).ready(function($){
|
740 |
+
$('.fade').click(function(){$(this).fadeOut('slow');});
|
741 |
+
});
|
742 |
+
</script>
|
743 |
+
<?php
|
744 |
+
}
|
745 |
+
|
746 |
+
/*
|
747 |
+
** Register Shortcode
|
748 |
+
*/
|
749 |
+
add_action( 'init', 'sdm_register_shortcode' );
|
750 |
+
function sdm_register_shortcode() {
|
751 |
+
|
752 |
+
add_shortcode('sdm-download', 'sdm_create_shortcode' );
|
753 |
+
}
|
754 |
+
// Create Shortcode
|
755 |
+
function sdm_create_shortcode( $atts ) {
|
756 |
+
|
757 |
+
extract( shortcode_atts( array(
|
758 |
+
'id' => 'id',
|
759 |
+
'fancy' => '0'
|
760 |
+
), $atts ) );
|
761 |
+
|
762 |
+
// Get CPT thumbnail
|
763 |
+
$item_download_thumbnail = get_post_meta( $id, 'sdm_upload_thumbnail', true );
|
764 |
+
$isset_download_thumbnail = isset($item_download_thumbnail) && !empty($item_download_thumbnail) ? '<img class="sdm_download_thumbnail_image" src="'.$item_download_thumbnail.'" />' : '';
|
765 |
+
|
766 |
+
// Get CPT title
|
767 |
+
$item_title = get_the_title( $id );
|
768 |
+
$isset_item_title = isset($item_title) && !empty($item_title) ? $item_title : '';
|
769 |
+
|
770 |
+
// Get CPT description
|
771 |
+
$item_description = get_post_meta( $id, 'sdm_description', true );
|
772 |
+
$isset_item_description = isset($item_description) && !empty($item_description) ? $item_description : '';
|
773 |
+
|
774 |
+
// Get CPT download link
|
775 |
+
$item_link = get_post_meta( $id, 'sdm_upload', true );
|
776 |
+
$isset_item_link = isset($item_link) && !empty($item_link) ? $item_link : '';
|
777 |
+
|
778 |
+
// See if user color option is selected
|
779 |
+
$main_opts = get_option('sdm_downloads_options');
|
780 |
+
$color_opt = $main_opts['download_button_color'];
|
781 |
+
$def_color = isset($color_opt) ? str_replace(' ', '', strtolower($color_opt)) : __('green', 'sdm_lang');
|
782 |
+
|
783 |
+
//Generate the download now button code
|
784 |
+
$homepage = get_bloginfo('url');
|
785 |
+
$download_url = $homepage. '/?smd_process_download=1&download_id='.$id;
|
786 |
+
$download_button_code = '<a href="'.$download_url.'" class="sdm_download '.$def_color.'" title="'.$isset_item_title.'">'.__('Download Now!', 'sdm_lang').'</a>';
|
787 |
+
//End of download now button code generation
|
788 |
+
|
789 |
+
if ($fancy == '0') {
|
790 |
+
$data = '<div class="sdm_download_link">'.$download_button_code.'</div>';
|
791 |
+
return $data;
|
792 |
+
}
|
793 |
+
|
794 |
+
if ($fancy == '1') {
|
795 |
+
// Prepare shortcode
|
796 |
+
$data = '<div class="sdm_download_item">';
|
797 |
+
$data .= '<div class="sdm_download_item_top">';
|
798 |
+
$data .= '<div class="sdm_download_thumbnail">'.$isset_download_thumbnail.'</div>';
|
799 |
+
$data .= '<div class="sdm_download_title">'.$isset_item_title.'</div>';
|
800 |
+
$data .= '</div>';//End of .sdm_download_item_top
|
801 |
+
$data .= '<div style="clear:both;"></div>';
|
802 |
+
$data .= '<div class="sdm_download_description">'.$isset_item_description.'</div>';
|
803 |
+
$data .= '<div class="sdm_download_link">'.$download_button_code.'</div>';
|
804 |
+
$data .= '</div>';
|
805 |
+
// Render shortcode
|
806 |
+
return $data;
|
807 |
+
}
|
808 |
+
}
|
809 |
+
|
810 |
+
/*
|
811 |
+
** Register scripts for front-end posts/pages
|
812 |
+
*/
|
813 |
+
add_action( 'wp_enqueue_scripts', 'sdm_wp_scripts' );
|
814 |
+
function sdm_wp_scripts() {
|
815 |
+
wp_enqueue_style( 'sdm-styles', WP_PLUGIN_URL. '/simple_download_monitor/css/sdm_wp_styles.css' );
|
816 |
+
}
|
817 |
+
|
818 |
+
function handle_sdm_download_via_direct_post()
|
819 |
+
{
|
820 |
+
if(isset($_REQUEST['smd_process_download']) && $_REQUEST['smd_process_download'] == '1')
|
821 |
+
{
|
822 |
+
$download_id = strip_tags($_REQUEST['download_id']);
|
823 |
+
$download_title = get_the_title( $download_id );
|
824 |
+
$download_link = get_post_meta( $download_id, 'sdm_upload', true );
|
825 |
+
$ipaddress = $_SERVER["REMOTE_ADDR"];
|
826 |
+
$date_time = current_time( 'mysql' );
|
827 |
+
|
828 |
+
global $wpdb;
|
829 |
+
$table = $wpdb->prefix . 'sdm_downloads';
|
830 |
+
$data = array(
|
831 |
+
'post_id' => $download_id,
|
832 |
+
'post_title' => $download_title,
|
833 |
+
'file_url' => $download_link,
|
834 |
+
'visitor_ip' => $ipaddress,
|
835 |
+
'date_time' => $date_time
|
836 |
+
);
|
837 |
+
|
838 |
+
$insert_table = $wpdb->insert( $table, $data );
|
839 |
+
|
840 |
+
if ($insert_table) {//Download request was logged successfully
|
841 |
+
wp_safe_redirect($download_link);
|
842 |
+
}
|
843 |
+
else {//Failed to log the download request
|
844 |
+
wp_die ("Error! Failed to log the download request in the database table");
|
845 |
+
}
|
846 |
+
exit;
|
847 |
+
}
|
848 |
+
}
|
849 |
+
|
850 |
+
// Tinymce Button Populate Post ID's
|
851 |
+
add_action( 'wp_ajax_nopriv_sdm_tiny_get_post_ids', 'sdm_tiny_get_post_ids_ajax_call' );
|
852 |
+
add_action( 'wp_ajax_sdm_tiny_get_post_ids', 'sdm_tiny_get_post_ids_ajax_call' );
|
853 |
+
function sdm_tiny_get_post_ids_ajax_call() {
|
854 |
+
|
855 |
+
$args = array(
|
856 |
+
'post_type' => 'sdm_downloads',
|
857 |
+
);
|
858 |
+
$loop = new WP_Query($args);
|
859 |
+
$test = '';
|
860 |
+
foreach ($loop->posts as $loop_post) {
|
861 |
+
//$test .= $loop_post->ID.'|'.$loop_post->post_title.'_';
|
862 |
+
$test[] = array('post_id' => $loop_post->ID, 'post_title' => $loop_post->post_title);
|
863 |
+
}
|
864 |
+
|
865 |
+
$response = json_encode( array( 'success' => true, 'test' => $test ));
|
866 |
+
|
867 |
+
header( 'Content-Type: application/json' );
|
868 |
+
echo $response;
|
869 |
+
exit;
|
870 |
+
}
|
871 |
+
// Remove Thumbnail Image
|
872 |
+
add_action( 'wp_ajax_nopriv_sdm_remove_thumbnail_image', 'sdm_remove_thumbnail_image_ajax_call' );
|
873 |
+
add_action( 'wp_ajax_sdm_remove_thumbnail_image', 'sdm_remove_thumbnail_image_ajax_call' );
|
874 |
+
function sdm_remove_thumbnail_image_ajax_call() {
|
875 |
+
|
876 |
+
$post_id = $_POST['post_id_del'];
|
877 |
+
$success = delete_post_meta( $post_id, 'sdm_upload_thumbnail' );
|
878 |
+
if($success) {
|
879 |
+
$response = json_encode( array( 'success' => true ));
|
880 |
+
}
|
881 |
+
|
882 |
+
header( 'Content-Type: application/json' );
|
883 |
+
echo $response;
|
884 |
+
exit;
|
885 |
+
}
|
886 |
+
|
887 |
+
|
888 |
+
/*
|
889 |
+
** Setup Sortable Columns
|
890 |
+
*/
|
891 |
+
add_filter( 'manage_edit-sdm_downloads_columns', 'sdm_create_columns' ); // Define columns
|
892 |
+
add_filter( 'manage_edit-sdm_downloads_sortable_columns', 'sdm_downloads_sortable' ); // Make sortable
|
893 |
+
add_action( 'manage_sdm_downloads_posts_custom_column', 'sdm_downloads_columns_content', 10, 2 ); // Populate new columns
|
894 |
+
function sdm_create_columns( $cols ) {
|
895 |
+
|
896 |
+
unset( $cols['title'] );
|
897 |
+
unset( $cols['taxonomy-sdm_tags'] );
|
898 |
+
unset( $cols['taxonomy-sdm_categories'] );
|
899 |
+
unset( $cols['date'] );
|
900 |
+
|
901 |
+
$cols['sdm_downloads_thumbnail'] = __('Image', 'sdm_lang');
|
902 |
+
$cols['title'] = __('Title', 'sdm_lang');
|
903 |
+
$cols['sdm_downloads_id'] = __('ID', 'sdm_lang');
|
904 |
+
$cols['sdm_downloads_file'] = __('File', 'sdm_lang');
|
905 |
+
$cols['taxonomy-sdm_categories'] = __('Categories', 'sdm_lang');
|
906 |
+
$cols['taxonomy-sdm_tags'] = __('Tags', 'sdm_lang');
|
907 |
+
$cols['sdm_downloads_count'] = __('Downloads', 'sdm_lang');
|
908 |
+
$cols['date'] = __('Date Posted', 'sdm_lang');
|
909 |
+
return $cols;
|
910 |
+
}
|
911 |
+
|
912 |
+
function sdm_downloads_sortable( $cols ) {
|
913 |
+
|
914 |
+
$cols['sdm_downloads_id'] = 'sdm_downloads_id';
|
915 |
+
$cols['sdm_downloads_file'] = 'sdm_downloads_file';
|
916 |
+
$cols['sdm_downloads_count'] = 'sdm_downloads_count';
|
917 |
+
$cols['taxonomy-sdm_categories'] = 'taxonomy-sdm_categories';
|
918 |
+
$cols['taxonomy-sdm_tags'] = 'taxonomy-sdm_tags';
|
919 |
+
return $cols;
|
920 |
+
}
|
921 |
+
|
922 |
+
function sdm_downloads_columns_content( $column_name, $post_ID ) {
|
923 |
+
|
924 |
+
if ($column_name == 'sdm_downloads_thumbnail') {
|
925 |
+
$old_thumbnail = get_post_meta( $post_ID, 'sdm_upload_thumbnail', true );
|
926 |
+
$old_value = isset($old_thumbnail) ? $old_thumbnail : '';
|
927 |
+
echo '<p class="sdm_downloads_count"><img src="'.$old_value.'" style="width:50px;height:50px;" /></p>';
|
928 |
+
}
|
929 |
+
if ($column_name == 'sdm_downloads_id') {
|
930 |
+
echo '<p class="sdm_downloads_postid">'.$post_ID.'</p>';
|
931 |
+
}
|
932 |
+
if ($column_name == 'sdm_downloads_file') {
|
933 |
+
$old_file = get_post_meta( $post_ID, 'sdm_upload', true );
|
934 |
+
$file = isset($old_file) ? $old_file : '--';
|
935 |
+
echo '<p class="sdm_downloads_file">'.$file.'</p>';
|
936 |
+
}
|
937 |
+
if ($column_name == 'sdm_downloads_count') {
|
938 |
+
global $wpdb;
|
939 |
+
$wpdb->get_results($wpdb->prepare('SELECT * FROM '.$wpdb->prefix.'sdm_downloads WHERE post_id=%s', $post_ID));
|
940 |
+
echo '<p class="sdm_downloads_count">'.$wpdb->num_rows.'</p>';
|
941 |
+
}
|
942 |
+
}
|
943 |
+
// Adjust admin column widths
|
944 |
+
add_action('admin_head', 'sdm_admin_column_width'); // Adjust column width in admin panel
|
945 |
+
function sdm_admin_column_width() {
|
946 |
+
|
947 |
+
echo '<style type="text/css">';
|
948 |
+
echo '.column-sdm_downloads_thumbnail { width:75px !important; overflow:hidden }';
|
949 |
+
echo '.column-sdm_downloads_id { width:100px !important; overflow:hidden }';
|
950 |
+
echo '.column-taxonomy-sdm_categories { width:200px !important; overflow:hidden }';
|
951 |
+
echo '.column-taxonomy-sdm_tags { width:200px !important; overflow:hidden }';
|
952 |
+
echo '</style>';
|
953 |
+
}
|
954 |
+
|
955 |
+
/*
|
956 |
+
** Register Tinymce Button
|
957 |
+
*/
|
958 |
+
|
959 |
+
// First check if option is checked to disable tinymce button
|
960 |
+
$main_option = get_option('sdm_downloads_options');
|
961 |
+
$tiny_button_option = isset($main_option['admin_tinymce_button']);
|
962 |
+
if($tiny_button_option != true) {
|
963 |
+
|
964 |
+
// Okay.. we're good. Add the button.
|
965 |
+
add_action( 'init', 'sdm_downloads_tinymce_button' );
|
966 |
+
function sdm_downloads_tinymce_button() {
|
967 |
+
|
968 |
+
add_filter( 'mce_external_plugins', 'sdm_downloads_add_button' );
|
969 |
+
add_filter( 'mce_buttons', 'sdm_downloads_register_button' );
|
970 |
+
}
|
971 |
+
function sdm_downloads_add_button( $plugin_array ) {
|
972 |
+
|
973 |
+
$plugin_array['sdm_downloads'] = WP_PLUGIN_URL. '/simple_download_monitor/tinymce/sdm_editor_plugin.js';
|
974 |
+
return $plugin_array;
|
975 |
+
}
|
976 |
+
function sdm_downloads_register_button( $buttons ) {
|
977 |
+
|
978 |
+
//array_push( $buttons, 'sdm_downloads' );
|
979 |
+
$buttons[] = 'sdm_downloads';
|
980 |
+
return $buttons;
|
981 |
+
}
|
982 |
+
}
|
readme.txt
CHANGED
@@ -1,340 +1,92 @@
|
|
1 |
-
===
|
2 |
-
Contributors:
|
3 |
-
Donate link:
|
4 |
-
Tags:
|
5 |
-
Requires at least:
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 0
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
1.
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
=
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
.
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
In the distribution archive you will find a 7Z archive containing
|
95 |
-
a PHP 4 version of the plugin. Just extract it over your existing
|
96 |
-
Simple Download Monitor installation to get PHP 4 compatibility.
|
97 |
-
(You can extract the archive using 7-Zip, http://www.7-zip.org )
|
98 |
-
|
99 |
-
Please note that this rewrite was only tested on PHP 5, where it
|
100 |
-
does work (PHP 5 is backwards compatible with PHP 4), but it may
|
101 |
-
not work on a real PHP 4 as I have no test machine for it. But I
|
102 |
-
will fix any errors that are reported to me.
|
103 |
-
|
104 |
-
= How do I prevent monitoring of certain files? =
|
105 |
-
|
106 |
-
There is no such functionality in Simple Download Monitor itself, because
|
107 |
-
the user interface would become needlessly complex. You can achieve the
|
108 |
-
same result through a proper record in the `.htaccess` file. See this
|
109 |
-
comment for an example (Richie, 2010-07-21):
|
110 |
-
|
111 |
-
http://www.pepak.net/wordpress/simple-download-monitor-plugin/#comment-4729
|
112 |
-
|
113 |
-
== Screenshots ==
|
114 |
-
|
115 |
-
1. Administrative options
|
116 |
-
2. The main statistics page
|
117 |
-
3. Detailed statistics for a file
|
118 |
-
|
119 |
-
== Changelog ==
|
120 |
-
|
121 |
-
= 0.24 =
|
122 |
-
|
123 |
-
* Updated the examples (`download-example.php`, `download-example-js.php`)
|
124 |
-
to be compatible with PHP 5.4.
|
125 |
-
|
126 |
-
* Due to my (Pepak's) lack of time to work on this project anymore, I will
|
127 |
-
be giving it to mra13 of "All In One WP Security & Firewall" who will be
|
128 |
-
developing it further. This is the last version created by me. It has been
|
129 |
-
good while it lasted, but now I have moved on and I don't want the plugin
|
130 |
-
to die.
|
131 |
-
|
132 |
-
|
133 |
-
= 0.23 =
|
134 |
-
|
135 |
-
* Support for more detailed error messages which may help with setting up the
|
136 |
-
plugin. The function is turned off by default, because it can be exploited
|
137 |
-
to determine the existence or nonexistence of a given file.
|
138 |
-
|
139 |
-
* There is a special option that allows you to setup your "files" directory
|
140 |
-
outside of the WordPress tree. This is not recommended nor supported, if you
|
141 |
-
want to use it, you are on your own - search the source code for
|
142 |
-
`basepath_modifier`, understand it and then decide whether you want to use it.
|
143 |
-
|
144 |
-
= 0.22 =
|
145 |
-
|
146 |
-
* Matheus Bratfisch (http://matbra.com) suggested and implemented an intermediate
|
147 |
-
download page. You can use this page to tell the user that his download is
|
148 |
-
about to begin, instead of just sending the file directly. To do so, please
|
149 |
-
enter the plugin's configuration, check the "Use the intermediate download page."
|
150 |
-
checkbox and provide a file path (not a web path!) to the page's source code.
|
151 |
-
An example page `download-example.php` is provided in the plugin's directory.
|
152 |
-
|
153 |
-
Note that if you are already used of Simple Download Monitor and want to use
|
154 |
-
this functionality, you'll need to modify your `.htaccess` file (new users
|
155 |
-
are not affected as they must have used the configuration listed in the
|
156 |
-
documentation and that is the required one already): Change the line
|
157 |
-
`RewriteRule ^(files/.*) /index.php?sdmon=$1 [L]`
|
158 |
-
to read
|
159 |
-
`RewriteRule ^(files/.*) /index.php?sdmon=$1 [L,QSA]`
|
160 |
-
(that is, add `,QSA` to the SDMon's rewrite rule's options). Then you can
|
161 |
-
open the SDMon configuration and in the "Use an intermediate Download page"
|
162 |
-
section enable the intermediate download page. A demo page is provided, but
|
163 |
-
you can of course use a different one.
|
164 |
-
|
165 |
-
I'd like to thank Matheus Bratfisch (http://matbra.com) very much for first
|
166 |
-
providing this functionality and then being patient and insistent enough for
|
167 |
-
me to incorporate it.
|
168 |
-
|
169 |
-
= 0.21 =
|
170 |
-
|
171 |
-
* A fix for the "feature" of WordPress 3.1 which requires manual deactivation
|
172 |
-
and reactivation of the plugin after upgrade (see http://core.trac.wordpress.org/ticket/14915).
|
173 |
-
|
174 |
-
* Removed the old PHP4 version. It hasn't been updated a long time anyway.
|
175 |
-
|
176 |
-
= 0.20 =
|
177 |
-
|
178 |
-
* Important! You need to deactivate and reactivate the plugin after upgrade
|
179 |
-
to version 0.19.
|
180 |
-
|
181 |
-
= 0.19 =
|
182 |
-
|
183 |
-
* Filenames are now returned quoted, which allows proper download of files
|
184 |
-
with a space in their filenames. Thanks Sameh Farouk for the tip.
|
185 |
-
|
186 |
-
* Possibility to limit the number of downloads per IP address and day. When
|
187 |
-
the number is exceeded, the user gets an error message.
|
188 |
-
|
189 |
-
This functionality requires detailed logs to be turned on. Ignored users
|
190 |
-
can always download as many files as they want.
|
191 |
-
|
192 |
-
* Support for a sidebar widget showing top-10 (or top-anything) most
|
193 |
-
downloaded files (either all files or those matching a given mask).
|
194 |
-
|
195 |
-
* The user who has rights to delete statistics can now mark some downloads
|
196 |
-
as hidden. This setting only affects the sidebar widget and is mostly
|
197 |
-
intended to remove obsolete versions of files from the list while keeping
|
198 |
-
the download statistics themselves.
|
199 |
-
|
200 |
-
= 0.18 =
|
201 |
-
|
202 |
-
* When Simple Download Monitor was used in conjunction with W3 Total Cache
|
203 |
-
(and possibly others), a file just a few megabytes long could cause
|
204 |
-
"Internal Server Errors". This is now fixed, along with any and all
|
205 |
-
output buffering plugins.
|
206 |
-
|
207 |
-
* Simple Download Monitor wasn't compatible with webhosters who provide
|
208 |
-
the fileinfo extension in conjunction with PHP older than 5.3.
|
209 |
-
|
210 |
-
= 0.17 =
|
211 |
-
|
212 |
-
* Forgot to allow empty strings in "Inline files".
|
213 |
-
|
214 |
-
= 0.16 =
|
215 |
-
|
216 |
-
* Something went wrong with uploading to WordPress database.
|
217 |
-
|
218 |
-
= 0.15 =
|
219 |
-
|
220 |
-
* User rights required to access various parts of the plugin's interface
|
221 |
-
are now configurable. This should satisfy the admins who don't want
|
222 |
-
their users to view download stats.
|
223 |
-
|
224 |
-
* More explicitly explained the "Inline files" setting and tightened it
|
225 |
-
so that it must be at least three characters long to be valid.
|
226 |
-
|
227 |
-
* Changed the captions of "delete" buttons to make it clear that only the
|
228 |
-
statistics get deleted, not the actual files.
|
229 |
-
|
230 |
-
= 0.14 =
|
231 |
-
|
232 |
-
* Changed country-flag-displaying code to use my IP-to-Country plugin in
|
233 |
-
version 0.03.
|
234 |
-
|
235 |
-
|
236 |
-
= 0.13 =
|
237 |
-
|
238 |
-
* Tested for compatibility with WordPress 3.0. Older versions work with
|
239 |
-
it, too, but now it is "official".
|
240 |
-
|
241 |
-
* Fixed date/time display to 24-hour format. Thanks Daniel for the report.
|
242 |
-
|
243 |
-
* Test for path validity (directory and extension) is performed *before*
|
244 |
-
logging the download request, not after. This means that requests for
|
245 |
-
files which don't match the two regular expressions are logged as requests
|
246 |
-
to nonexistent files, while previously they were logged ads successful
|
247 |
-
downloads (even though they were not downloaded by the user who got an
|
248 |
-
error 404 instead).
|
249 |
-
|
250 |
-
* Cosmetic fix for the paginator: links to first/previous page are displayed
|
251 |
-
on the left side of the table, links to next/last page on the right.
|
252 |
-
|
253 |
-
|
254 |
-
= 0.12 =
|
255 |
-
|
256 |
-
* Support for country-flagging of each download. This feature requires
|
257 |
-
that my plugin Ip-to-Country ( http://wordpress.org/extend/plugins/ip-to-country/ )
|
258 |
-
is installed and set-up.
|
259 |
-
|
260 |
-
I am still undecided if it is better to assign countries when a download
|
261 |
-
occurs or leave it until a list of downloads is displayed. I can see
|
262 |
-
benefits and drawbacks for both solutions. At the moment the plugin
|
263 |
-
leaves country-assignment until the list is displayed, but I am interested
|
264 |
-
in hearing your thoughts about this decision.
|
265 |
-
|
266 |
-
This function is only supported with PHP5.
|
267 |
-
|
268 |
-
* New setting for "ignored users". Downloads made by users whose names are
|
269 |
-
listed (in pipe-separated list) in configuration will not be monitored.
|
270 |
-
It is useful for admins who want to test that their download links work,
|
271 |
-
but don't want to record their tests as "downloads".
|
272 |
-
|
273 |
-
* Ability to ignore downloads if someone requests one file from one IP address
|
274 |
-
several times within a short time interval. There is an option that let's
|
275 |
-
admin specify how long this interval is (in seconds), and if multiple downloads
|
276 |
-
of the same file from the same IP address happen within so many seconds of
|
277 |
-
each other, only the first one gets recorded. This is useful for download
|
278 |
-
accelerators which try to download one file in several pieces, with longer
|
279 |
-
time intervals also for redownloads (e.g. download fails the first time so
|
280 |
-
the user tries again).
|
281 |
-
|
282 |
-
|
283 |
-
= 0.11 =
|
284 |
-
|
285 |
-
* Automatic upgrade of the plugin fails because of the nested ZIP
|
286 |
-
archives. As a result, PHP 4 version of the plugin was recompressed
|
287 |
-
to 7Z ( http://www.7-zip.org ).
|
288 |
-
|
289 |
-
|
290 |
-
= 0.10 =
|
291 |
-
|
292 |
-
* Belorussian translation by FatCow.
|
293 |
-
|
294 |
-
* PHP 4 version is also available (see the FAQ).
|
295 |
-
|
296 |
-
|
297 |
-
= 0.09 =
|
298 |
-
|
299 |
-
* Fixed incorrect header for file size. That should fix incompatibility
|
300 |
-
with some plugins and downloaders.
|
301 |
-
|
302 |
-
* Support for resumed transfers.
|
303 |
-
|
304 |
-
|
305 |
-
= 0.08 =
|
306 |
-
|
307 |
-
* Administrators can now delete download statistics from the Tools panel:
|
308 |
-
A checkbox is shown next to each record, and a button for deleting checked
|
309 |
-
records is provided at the bottom of the list. A button for deleting all
|
310 |
-
records is also provided. This is true for both the global list and
|
311 |
-
details list.
|
312 |
-
|
313 |
-
Note: This function is only allowed for users with a "delete_user"
|
314 |
-
capability (by default, that means only Administrators).
|
315 |
-
|
316 |
-
|
317 |
-
= 0.07 =
|
318 |
-
|
319 |
-
* Simple Download Monitor now allows inline content, e.g. images and
|
320 |
-
videos that display within pages rather than download as a file.
|
321 |
-
By default, all files are set to download, but you can override this
|
322 |
-
behavior for specific regular expressions in the configuration.
|
323 |
-
|
324 |
-
Note: Do not forget to add image extensions to Allowed Extensions -
|
325 |
-
a file must be allowed to download before it can be "inlined".
|
326 |
-
|
327 |
-
|
328 |
-
= 0.06 =
|
329 |
-
|
330 |
-
* Fixed a bug on download display if no downloads were recorded.
|
331 |
-
|
332 |
-
|
333 |
-
= 0.05 =
|
334 |
-
|
335 |
-
* First intentional public release.
|
336 |
-
|
337 |
-
|
338 |
-
= 0.04 =
|
339 |
-
|
340 |
-
* Accidental premature public release due to my unfamiliarity with WordPress plugin repository.
|
1 |
+
=== Simple Download Monitor ===
|
2 |
+
Contributors: Tips and Tricks HQ, Ruhul Amin, Josh
|
3 |
+
Donate link: http://www.tipsandtricks-hq.com
|
4 |
+
Tags: download, downloads, count, counter, tracker, tracking, hits, logging, monitor, manager, files, media, digital, download monitor
|
5 |
+
Requires at least: 3.0
|
6 |
+
Tested up to: 3.7.1
|
7 |
+
Stable tag: 2.0
|
8 |
+
License: GPLv2 or later
|
9 |
+
|
10 |
+
Easily manage downloadable files and monitor downloads of your digital files from your WordPress site.
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
I developed the Simple Download Monitor because I wanted to monitor the number of downloads of my files.
|
15 |
+
|
16 |
+
This plugin is very useful for tracking your digital file download counts.
|
17 |
+
|
18 |
+
You can configure downloadable files from your WordPress admin dashboard. Then allow your visitors to download the files and this plugin will monitor which files get downloaded how many times.
|
19 |
+
|
20 |
+
The plugin will also log the IP addresses of the users who download your files.
|
21 |
+
|
22 |
+
It has a very user-friendly interface for uploading, managing and tracking downloads.
|
23 |
+
|
24 |
+
= Simple Download Monitor Features =
|
25 |
+
|
26 |
+
* Add, edit and remove downloads from an easy to use interface
|
27 |
+
* Assign categories and tags to your downloadable files
|
28 |
+
* Use shortcodes to display a download now button on a WordPress post/page
|
29 |
+
* Option to use a nice looking template to show your download now button
|
30 |
+
* Track the number of downloads for each of your files
|
31 |
+
|
32 |
+
= Simple Download Monitor Plugin Usage =
|
33 |
+
|
34 |
+
Once you have installed the plugin go to "Downloads->Settings" to configure some options
|
35 |
+
|
36 |
+
**a)** Simple Download Monitor Settings
|
37 |
+
|
38 |
+
* Admin Options: Remove Tinymce Button - Removes the SDM Downloads button from the WP content editor (default: unchecked).
|
39 |
+
* Color Options: Download Button Color - Select a default color of the download button (default: green).
|
40 |
+
|
41 |
+
**b)** Add a new download
|
42 |
+
|
43 |
+
To configure a new download follw these steps:
|
44 |
+
|
45 |
+
1. Go to "Downloads->Add New"
|
46 |
+
1. Enter a title for your download
|
47 |
+
1. Add a description for the download
|
48 |
+
1. Select the file from your computer and upload it
|
49 |
+
1. Select an image for the download (it will be displayed as a thumbnail on the front end)
|
50 |
+
1. Publish it
|
51 |
+
|
52 |
+
You can view all of your existing downloads from the "Downloads->Downloads" menu.
|
53 |
+
|
54 |
+
**c)** Create a download button
|
55 |
+
|
56 |
+
Create a new post/page and click the "SDM Downlaods" TinyMCE button to insert a shortcode (This button will only show up if you haven't unchecked it in the settings). You can choose to display your download with a nice looking box or just a download button. For example:
|
57 |
+
|
58 |
+
`[sdm-download id="271" fancy="1"]` (embed a download button inside a box with other information e.g. Thumbnail, Title and Description)
|
59 |
+
|
60 |
+
`[sdm-download id="271" fancy="0"]` (embed a plain download button)
|
61 |
+
|
62 |
+
**d)** Download Logs
|
63 |
+
|
64 |
+
You can check the download stats from the "Downloads->Logs" menu. It shows the number of downloads for a particular file, IP address of the user who downloaded it, date and time.
|
65 |
+
|
66 |
+
== Installation ==
|
67 |
+
|
68 |
+
1. Go to the Add New plugins screen in your WordPress admin area
|
69 |
+
1. Click the upload tab
|
70 |
+
1. Browse for the plugin file (simple_download_monitor.zip)
|
71 |
+
1. Click Install Now and then activate the plugin
|
72 |
+
|
73 |
+
== Frequently Asked Questions ==
|
74 |
+
|
75 |
+
= Can this plugin be used to offer free downloads to the users? =
|
76 |
+
|
77 |
+
Yes.
|
78 |
+
|
79 |
+
== Screenshots ==
|
80 |
+
|
81 |
+
For screenshots please visit the plugin page
|
82 |
+
|
83 |
+
== Changelog ==
|
84 |
+
|
85 |
+
= 2.0 =
|
86 |
+
* Complete new architecture for the download monitor plugin
|
87 |
+
* You can download the old version with old architecture here:
|
88 |
+
http://wordpress.org/plugins/simple-download-monitor/developers/
|
89 |
+
|
90 |
+
== Upgrade Notice ==
|
91 |
+
|
92 |
+
Download monitor 2.0 uses a completely new architecture (it is much simpler and user friendly) for configuring and monitoring downloads. Read the usage section to understand how it works.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
screenshot-1.png
DELETED
Binary file
|
screenshot-2.png
DELETED
Binary file
|
screenshot-3.png
DELETED
Binary file
|
sdmon.css
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
#sdmon .sdmon-rownum { width: 3ex; text-align: right; }
|
2 |
-
#sdmon .sdmon-filename { }
|
3 |
-
#sdmon .sdmon-count { text-align: right; }
|
4 |
-
#sdmon .sdmon-date { width: 24ex; text-align: center; }
|
5 |
-
#sdmon .sdmon-nonex { width: 5ex; text-align: center; }
|
6 |
-
#sdmon .sdmon-ipaddr { }
|
7 |
-
#sdmon .sdmon-referer { }
|
8 |
-
#sdmon .sdmon-username { }
|
9 |
-
#sdmon th {text-align: center; }
|
10 |
-
#sdmon th, #sdmon td { padding-left: 1ex; padding-right: 1ex; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
simple-download-monitor.php
DELETED
@@ -1,1123 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
Plugin Name: Simple Download Monitor
|
5 |
-
Plugin URI: http://www.pepak.net/wordpress/simple-download-monitor-plugin
|
6 |
-
Description: Count the number of downloads without having to maintain a comprehensive download page.
|
7 |
-
Version: 0.24
|
8 |
-
Author: Pepak | contributors: matheusbrat (http://matbra.com)
|
9 |
-
Author URI: http://www.pepak.net
|
10 |
-
*/
|
11 |
-
|
12 |
-
/* Copyright 2009, 2010 Pepak (email: wordpress@pepak.net)
|
13 |
-
|
14 |
-
This program is free software; you can redistribute it and/or modify
|
15 |
-
it under the terms of the GNU General Public License as published by
|
16 |
-
the Free Software Foundation; either version 2 of the License, or
|
17 |
-
(at your option) any later version.
|
18 |
-
|
19 |
-
This program is distributed in the hope that it will be useful,
|
20 |
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21 |
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22 |
-
GNU General Public License for more details.
|
23 |
-
|
24 |
-
You should have received a copy of the GNU General Public License
|
25 |
-
along with this program; if not, write to the Free Software
|
26 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
27 |
-
*/
|
28 |
-
|
29 |
-
if (!class_exists('SimpleDownloadMonitor'))
|
30 |
-
{
|
31 |
-
class SimpleDownloadMonitor
|
32 |
-
{
|
33 |
-
|
34 |
-
const VERSION = '0.24';
|
35 |
-
const PREFIX = 'sdmon_';
|
36 |
-
const PREG_DELIMITER = '`';
|
37 |
-
const GET_PARAM = 'sdmon';
|
38 |
-
const RECORDS_PER_PAGE = 20;
|
39 |
-
const GETTEXT_REALM = 'simple-download-monitor';
|
40 |
-
|
41 |
-
protected $plugin_url = '';
|
42 |
-
protected $plugin_dir = '';
|
43 |
-
protected $plugin_dir_relative = '';
|
44 |
-
|
45 |
-
public function SimpleDownloadMonitor()
|
46 |
-
{
|
47 |
-
$this->plugin_url = WP_PLUGIN_URL . '/' . dirname(plugin_basename(__FILE__));
|
48 |
-
$this->plugin_dir = WP_PLUGIN_DIR . '/' . dirname(plugin_basename(__FILE__));
|
49 |
-
if (strpos($this->plugin_dir, ABSPATH) === 0)
|
50 |
-
$this->plugin_dir_relative = substr($this->plugin_dir, strlen(ABSPATH));
|
51 |
-
else
|
52 |
-
$this->plugin_dir_relative = $this->plugin_dir;
|
53 |
-
register_activation_hook(__FILE__, array('SimpleDownloadMonitor', 'Install'));
|
54 |
-
add_action('init', array(&$this, 'ActionInit'));
|
55 |
-
add_action('admin_menu', 'SimpleDownloadMonitor_BuildAdminMenu');
|
56 |
-
if (self::VERSION != get_option(self::PREFIX . 'version'))
|
57 |
-
self::Install();
|
58 |
-
}
|
59 |
-
|
60 |
-
public static function Install()
|
61 |
-
{
|
62 |
-
global $wpdb;
|
63 |
-
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
64 |
-
$table_downloads = $wpdb->prefix . self::PREFIX . 'downloads';
|
65 |
-
$sql = "CREATE TABLE ${table_downloads} (
|
66 |
-
id INTEGER NOT NULL AUTO_INCREMENT,
|
67 |
-
filename VARCHAR(1024) NOT NULL,
|
68 |
-
download_count INTEGER NOT NULL,
|
69 |
-
last_date TIMESTAMP NOT NULL,
|
70 |
-
file_exists TINYINT,
|
71 |
-
hide_from_sidebar TINYINT,
|
72 |
-
PRIMARY KEY id (id),
|
73 |
-
KEY download_count (download_count),
|
74 |
-
KEY last_date (last_date)
|
75 |
-
);";
|
76 |
-
dbDelta($sql);
|
77 |
-
$table_details = $wpdb->prefix . self::PREFIX . 'details';
|
78 |
-
$sql = "CREATE TABLE ${table_details} (
|
79 |
-
id INTEGER NOT NULL AUTO_INCREMENT,
|
80 |
-
download INTEGER NOT NULL,
|
81 |
-
download_date TIMESTAMP NOT NULL,
|
82 |
-
ip VARCHAR(64) NOT NULL,
|
83 |
-
referer TEXT,
|
84 |
-
userid INTEGER,
|
85 |
-
username VARCHAR(64),
|
86 |
-
PRIMARY KEY id (id),
|
87 |
-
KEY download (download),
|
88 |
-
KEY download_date (download_date)
|
89 |
-
);";
|
90 |
-
dbDelta($sql);
|
91 |
-
update_option(self::PREFIX . 'table_downloads', $table_downloads);
|
92 |
-
update_option(self::PREFIX . 'table_details', $table_details);
|
93 |
-
update_option(self::PREFIX . 'version', self::VERSION);
|
94 |
-
add_option(self::PREFIX . 'directories', 'files/');
|
95 |
-
add_option(self::PREFIX . 'extensions', 'zip|rar|7z');
|
96 |
-
add_option(self::PREFIX . 'detailed', '0');
|
97 |
-
add_option(self::PREFIX . 'inline', '');
|
98 |
-
add_option(self::PREFIX . 'ignored_users', '');
|
99 |
-
add_option(self::PREFIX . 'group_within', '0');
|
100 |
-
add_option(self::PREFIX . 'rights_view', 'read');
|
101 |
-
add_option(self::PREFIX . 'rights_delete', 'delete_users');
|
102 |
-
add_option(self::PREFIX . 'rights_options', 'manage_options');
|
103 |
-
add_option(self::PREFIX . 'max_downloads_per_ip_and_day', '0');
|
104 |
-
add_option(self::PREFIX . 'max_downloads_per_ip_and_day_registered', '0');
|
105 |
-
add_option(self::PREFIX . 'error_download_limit', '');
|
106 |
-
add_option(self::PREFIX . 'download_page', plugin_dir_path(__FILE__) . '/download-example.php');
|
107 |
-
add_option(self::PREFIX . 'show_download_page', '0');
|
108 |
-
add_option(self::PREFIX . 'detailed_errors', '0');
|
109 |
-
add_option(self::PREFIX . 'basepath_modifier', '');
|
110 |
-
}
|
111 |
-
|
112 |
-
public function table_downloads()
|
113 |
-
{
|
114 |
-
static $table = null;
|
115 |
-
if ($table == null)
|
116 |
-
$table = get_option(self::PREFIX . 'table_downloads');
|
117 |
-
return $table;
|
118 |
-
}
|
119 |
-
|
120 |
-
public function table_details()
|
121 |
-
{
|
122 |
-
static $table = null;
|
123 |
-
if ($table == null)
|
124 |
-
$table = get_option(self::PREFIX . 'table_details');
|
125 |
-
return $table;
|
126 |
-
}
|
127 |
-
|
128 |
-
//-----------------------------------------------------------------------------------
|
129 |
-
// Methods set_range, buffered_read, byteserve adapted from
|
130 |
-
// http://www.coneural.org/florian/papers/04_byteserving.php
|
131 |
-
|
132 |
-
function set_range($range, $filesize, &$first, &$last){
|
133 |
-
|
134 |
-
/*
|
135 |
-
Sets the first and last bytes of a range, given a range expressed as a string
|
136 |
-
and the size of the file.
|
137 |
-
|
138 |
-
If the end of the range is not specified, or the end of the range is greater
|
139 |
-
than the length of the file, $last is set as the end of the file.
|
140 |
-
|
141 |
-
If the begining of the range is not specified, the meaning of the value after
|
142 |
-
the dash is "get the last n bytes of the file".
|
143 |
-
|
144 |
-
If $first is greater than $last, the range is not satisfiable, and we should
|
145 |
-
return a response with a status of 416 (Requested range not satisfiable).
|
146 |
-
|
147 |
-
Examples:
|
148 |
-
$range='0-499', $filesize=1000 => $first=0, $last=499 .
|
149 |
-
$range='500-', $filesize=1000 => $first=500, $last=999 .
|
150 |
-
$range='500-1200', $filesize=1000 => $first=500, $last=999 .
|
151 |
-
$range='-200', $filesize=1000 => $first=800, $last=999 .
|
152 |
-
|
153 |
-
*/
|
154 |
-
$dash=strpos($range,'-');
|
155 |
-
$first=trim(substr($range,0,$dash));
|
156 |
-
$last=trim(substr($range,$dash+1));
|
157 |
-
if ($first=='') {
|
158 |
-
//suffix byte range: gets last n bytes
|
159 |
-
$suffix=$last;
|
160 |
-
$last=$filesize-1;
|
161 |
-
$first=$filesize-$suffix;
|
162 |
-
if($first<0) $first=0;
|
163 |
-
} else {
|
164 |
-
if ($last=='' || $last>$filesize-1) $last=$filesize-1;
|
165 |
-
}
|
166 |
-
if($first>$last){
|
167 |
-
//unsatisfiable range
|
168 |
-
header("Status: 416 Requested range not satisfiable");
|
169 |
-
header("Content-Range: */$filesize");
|
170 |
-
exit;
|
171 |
-
}
|
172 |
-
}
|
173 |
-
|
174 |
-
function buffered_read($file, $bytes, $buffer_size=65536){
|
175 |
-
/*
|
176 |
-
Outputs up to $bytes from the file $file to standard output, $buffer_size bytes at a time.
|
177 |
-
*/
|
178 |
-
$bytes_left=$bytes;
|
179 |
-
while($bytes_left>0 && !feof($file)){
|
180 |
-
if($bytes_left>$buffer_size)
|
181 |
-
$bytes_to_read=$buffer_size;
|
182 |
-
else
|
183 |
-
$bytes_to_read=$bytes_left;
|
184 |
-
$bytes_left-=$bytes_to_read;
|
185 |
-
$contents=fread($file, $bytes_to_read);
|
186 |
-
echo $contents;
|
187 |
-
flush();
|
188 |
-
}
|
189 |
-
}
|
190 |
-
|
191 |
-
function byteserve($filename, $mimetype, $disposition = ''){
|
192 |
-
/*
|
193 |
-
Byteserves the file $filename.
|
194 |
-
|
195 |
-
When there is a request for a single range, the content is transmitted
|
196 |
-
with a Content-Range header, and a Content-Length header showing the number
|
197 |
-
of bytes actually transferred.
|
198 |
-
|
199 |
-
When there is a request for multiple ranges, these are transmitted as a
|
200 |
-
multipart message. The multipart media type used for this purpose is
|
201 |
-
"multipart/byteranges".
|
202 |
-
*/
|
203 |
-
|
204 |
-
// Clean all buffering components, if any.
|
205 |
-
while (ob_list_handlers())
|
206 |
-
ob_end_clean();
|
207 |
-
|
208 |
-
$filesize=filesize($filename);
|
209 |
-
$file=fopen($filename,"rb");
|
210 |
-
|
211 |
-
$ranges=NULL;
|
212 |
-
if ($_SERVER['REQUEST_METHOD']=='GET' && isset($_SERVER['HTTP_RANGE']) && $range=stristr(trim($_SERVER['HTTP_RANGE']),'bytes=')){
|
213 |
-
$range=substr($range,6);
|
214 |
-
$boundary=sha1(uniqid());//set a random boundary
|
215 |
-
$ranges=explode(',',$range);
|
216 |
-
}
|
217 |
-
|
218 |
-
if($ranges && count($ranges)){
|
219 |
-
header("HTTP/1.1 206 Partial content");
|
220 |
-
header("Accept-Ranges: bytes");
|
221 |
-
if(count($ranges)>1){
|
222 |
-
/*
|
223 |
-
More than one range is requested.
|
224 |
-
*/
|
225 |
-
|
226 |
-
//compute content length
|
227 |
-
$content_length=0;
|
228 |
-
foreach ($ranges as $range){
|
229 |
-
$this->set_range($range, $filesize, $first, $last);
|
230 |
-
$content_length+=strlen("\r\n--$boundary\r\n");
|
231 |
-
$content_length+=strlen("Content-type: $mimetype\r\n");
|
232 |
-
$content_length+=strlen("Content-range: bytes $first-$last/$filesize\r\n\r\n");
|
233 |
-
$content_length+=$last-$first+1;
|
234 |
-
}
|
235 |
-
$content_length+=strlen("\r\n--$boundary--\r\n");
|
236 |
-
|
237 |
-
//output headers
|
238 |
-
header("Content-Length: $content_length");
|
239 |
-
//see http://httpd.apache.org/docs/misc/known_client_problems.html for an discussion of x-byteranges vs. byteranges
|
240 |
-
header("Content-Type: multipart/x-byteranges; boundary=$boundary");
|
241 |
-
|
242 |
-
//output the content
|
243 |
-
foreach ($ranges as $range){
|
244 |
-
$this->set_range($range, $filesize, $first, $last);
|
245 |
-
echo "\r\n--$boundary\r\n";
|
246 |
-
echo "Content-type: $mimetype\r\n";
|
247 |
-
echo "Content-range: bytes $first-$last/$filesize\r\n\r\n";
|
248 |
-
fseek($file,$first);
|
249 |
-
$this->buffered_read ($file, $last-$first+1);
|
250 |
-
}
|
251 |
-
echo "\r\n--$boundary--\r\n";
|
252 |
-
} else {
|
253 |
-
/*
|
254 |
-
A single range is requested.
|
255 |
-
*/
|
256 |
-
$range=$ranges[0];
|
257 |
-
$this->set_range($range, $filesize, $first, $last);
|
258 |
-
header("Content-Length: ".($last-$first+1) );
|
259 |
-
header("Content-Range: bytes $first-$last/$filesize");
|
260 |
-
header("Content-Type: $mimetype");
|
261 |
-
if ($disposition)
|
262 |
-
header("Content-Disposition: $disposition");
|
263 |
-
fseek($file,$first);
|
264 |
-
$this->buffered_read($file, $last-$first+1);
|
265 |
-
}
|
266 |
-
} else{
|
267 |
-
//no byteserving
|
268 |
-
header("Accept-Ranges: bytes");
|
269 |
-
header("Content-Length: $filesize");
|
270 |
-
header("Content-Type: $mimetype");
|
271 |
-
if ($disposition)
|
272 |
-
header("Content-Disposition: $disposition");
|
273 |
-
$this->buffered_read($file, $filesize);
|
274 |
-
}
|
275 |
-
fclose($file);
|
276 |
-
}
|
277 |
-
//-----------------------------------------------------------------------------------
|
278 |
-
|
279 |
-
protected function ErrorMessage($code, $message, $shortmessage)
|
280 |
-
{
|
281 |
-
$code = intval($code);
|
282 |
-
// Clean all buffering components, if any.
|
283 |
-
while (ob_list_handlers())
|
284 |
-
ob_end_clean();
|
285 |
-
header('Cache-control: no-cache');
|
286 |
-
if ($code >= 200)
|
287 |
-
header(sprintf('%s %d %s', $_SERVER["SERVER_PROTOCOL"], $code, $shortmessage));
|
288 |
-
get_header();
|
289 |
-
?><div class="error">
|
290 |
-
<h2><?php echo __("Simple Download Monitor error", self::GETTEXT_REALM); ?></h2>
|
291 |
-
<p><?php echo $message; ?></p>
|
292 |
-
<?php
|
293 |
-
get_sidebar();
|
294 |
-
get_footer();
|
295 |
-
die();
|
296 |
-
}
|
297 |
-
|
298 |
-
public function Download($filename)
|
299 |
-
{
|
300 |
-
global $wpdb, $user_login, $user_ID;
|
301 |
-
$store_details = intval(get_option(self::PREFIX . 'detailed'));
|
302 |
-
$details = $this->table_details();
|
303 |
-
$downloads = $this->table_downloads();
|
304 |
-
$ip_addr = $_SERVER['REMOTE_ADDR'];
|
305 |
-
// Normalize the filename
|
306 |
-
$basepath = realpath(ABSPATH . get_option(self::PREFIX . 'basepath_modifier')) . '/';
|
307 |
-
$fullfilename = realpath($basepath . $filename);
|
308 |
-
$relfilename = substr($fullfilename, strlen($basepath));
|
309 |
-
$relfilename = strtr($relfilename, '\\', '/');
|
310 |
-
$exists = (file_exists($fullfilename) AND !is_dir($fullfilename)) ? 1 : 0;
|
311 |
-
// Make sure it is a valid request
|
312 |
-
$dirregexp = self::PREG_DELIMITER . '^' . get_option(self::PREFIX . 'directories') . self::PREG_DELIMITER;
|
313 |
-
$extregexp = self::PREG_DELIMITER . '\\.' . get_option(self::PREFIX . 'extensions') . '$' . self::PREG_DELIMITER;
|
314 |
-
$valid_dir = preg_match($dirregexp, $relfilename);
|
315 |
-
$valid_ext = preg_match($extregexp, $relfilename);
|
316 |
-
$valid = ($valid_dir AND $valid_ext) ? 1 : 0;
|
317 |
-
// Get user information and decide if this user should be ignored
|
318 |
-
get_currentuserinfo();
|
319 |
-
$userid = $user_ID ? $user_ID : null;
|
320 |
-
$username = $user_login ? $user_login : null;
|
321 |
-
$ignored_users = get_option(self::PREFIX . 'ignored_users');
|
322 |
-
$monitor = empty($username) || empty($ignored_users) || (!in_array($username, explode('|', $ignored_users)));
|
323 |
-
if ($monitor)
|
324 |
-
{
|
325 |
-
// Check the number of downloads per IP and day
|
326 |
-
$max_downloads = intval(get_option(self::PREFIX . (is_user_logged_in() ? 'max_downloads_per_ip_and_day_registered' : 'max_downloads_per_ip_and_day')));
|
327 |
-
if ($max_downloads > 0)
|
328 |
-
{
|
329 |
-
$row = $wpdb->get_row($wpdb->prepare("SELECT COUNT(*) count, MIN(TIMESTAMPDIFF(MINUTE, NOW(), TIMESTAMPADD(DAY, 1, download_date))) retry FROM ${details} WHERE (download_date > TIMESTAMPADD(DAY, -1, NOW())) AND ip=%s", $ip_addr), ARRAY_N);
|
330 |
-
list($download_count, $retry_minutes) = $row;
|
331 |
-
if ($download_count >= $max_downloads)
|
332 |
-
{
|
333 |
-
$msg = get_option(self::PREFIX . 'error_download_limit');
|
334 |
-
if ($msg == '') $msg = __("You have exceeded your download quota today. Please try again in %d hours and %d minutes.", self::GETTEXT_REALM);
|
335 |
-
$this->ErrorMessage(403, sprintf($msg, $retry_minutes/60, abs($retry_minutes%60)), 'Forbidden');
|
336 |
-
}
|
337 |
-
}
|
338 |
-
// Store uncorrected request name to database for security/mistake review
|
339 |
-
$id = $wpdb->get_var($wpdb->prepare("SELECT id FROM ${downloads} WHERE filename=%s", $filename));
|
340 |
-
if ($id)
|
341 |
-
{
|
342 |
-
// Ignore quick downloads by the same user
|
343 |
-
if ($store_details && (($group_within = intval(get_option(self::PREFIX . 'group_within'))) > 0))
|
344 |
-
{
|
345 |
-
$grouped_id = $wpdb->get_var($wpdb->prepare("SELECT MIN(id) FROM ${details} WHERE download=%d AND (download_date > DATE_ADD(NOW(), INTERVAL -%d SECOND)) AND ip=%s", $id, $group_within, $ip_addr));
|
346 |
-
if (intval($grouped_id) > 0)
|
347 |
-
$monitor = FALSE;
|
348 |
-
}
|
349 |
-
if ($monitor)
|
350 |
-
{
|
351 |
-
$sql = "UPDATE ${downloads} SET download_count=download_count+1, last_date=NOW(), file_exists=%d WHERE id=%d";
|
352 |
-
$wpdb->query($wpdb->prepare($sql, $exists * $valid, $id));
|
353 |
-
}
|
354 |
-
}
|
355 |
-
else
|
356 |
-
{
|
357 |
-
$sql = "INSERT INTO ${downloads} (filename, download_count, last_date, file_exists) VALUES (%s, 1, NOW(), %d)";
|
358 |
-
$wpdb->query($wpdb->prepare($sql, $filename, $exists * $valid));
|
359 |
-
$id = $wpdb->insert_id;
|
360 |
-
}
|
361 |
-
// If details are requested, store them as well
|
362 |
-
if ($monitor && $store_details)
|
363 |
-
{
|
364 |
-
$sql = "INSERT INTO ${details} (download, download_date, ip, referer, username, userid) VALUES (%d, NOW(), %s, %s, %s, %d)";
|
365 |
-
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null;
|
366 |
-
if (!$username AND isset($_COOKIE['comment_author_'.COOKIEHASH]))
|
367 |
-
$username = utf8_encode($_COOKIE['comment_author_'.COOKIEHASH]);
|
368 |
-
$wpdb->query($wpdb->prepare($sql, $id, $ip_addr, $referer, $username, $userid));
|
369 |
-
}
|
370 |
-
}
|
371 |
-
// If the file exists and is valid, download it
|
372 |
-
// Make sure the file is available for download
|
373 |
-
if (!$exists)
|
374 |
-
$this->ErrorMessage(404, sprintf(__("Requested file <strong>%s</strong> not found."), htmlspecialchars($filename)), 'Not found');
|
375 |
-
if (intval(get_option(self::PREFIX . 'detailed_errors')))
|
376 |
-
{
|
377 |
-
if (!$valid_dir)
|
378 |
-
$this->ErrorMessage(404, sprintf(__("Requested file <strong>%s</strong> has an invalid path."), htmlspecialchars($filename)), 'Not valid');
|
379 |
-
if (!$valid_ext)
|
380 |
-
$this->ErrorMessage(404, sprintf(__("Requested file <strong>%s</strong> has an invalid extension."), htmlspecialchars($filename)), 'Not valid');
|
381 |
-
}
|
382 |
-
if (!$valid)
|
383 |
-
$this->ErrorMessage(404, sprintf(__("Requested file <strong>%s</strong> not found."), htmlspecialchars($filename)), 'Not found');
|
384 |
-
|
385 |
-
// Generate proper headers
|
386 |
-
$mimetype = '';
|
387 |
-
if (function_exists('finfo_open') AND defined('FILEINFO_MIME_TYPE'))
|
388 |
-
{
|
389 |
-
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
390 |
-
$mimetype = finfo_file($finfo, $fullfilename);
|
391 |
-
}
|
392 |
-
if (!$mimetype && function_exists('mime_content_type'))
|
393 |
-
$mimetype = mime_content_type($fullfilename);
|
394 |
-
if (!$mimetype || ((strpos($mimetype, '/')) === FALSE))
|
395 |
-
$mimetype = 'application/octet-stream';
|
396 |
-
$disposition = 'attachment';
|
397 |
-
$inlineregexp = self::PREG_DELIMITER . get_option(self::PREFIX . 'inline') . self::PREG_DELIMITER;
|
398 |
-
if ($inlineregexp && preg_match($inlineregexp, $relfilename))
|
399 |
-
$disposition = 'inline';
|
400 |
-
$disposition = $disposition . '; filename="' . basename($fullfilename) . '"';
|
401 |
-
$this->byteserve($fullfilename, $mimetype, $disposition);
|
402 |
-
// Successful end
|
403 |
-
return TRUE;
|
404 |
-
}
|
405 |
-
|
406 |
-
public function Download_Page($filename) {
|
407 |
-
$page = get_option(self::PREFIX . 'download_page');
|
408 |
-
if ($page && file_exists($page))
|
409 |
-
include($page);
|
410 |
-
else
|
411 |
-
$this->Download($filename);
|
412 |
-
}
|
413 |
-
|
414 |
-
public function ActionInit() {
|
415 |
-
|
416 |
-
// Function is called in 'init' hook. It checks for download and if so, stops normal WordPress processing
|
417 |
-
// and replaces it with its monitoring functions.
|
418 |
-
$currentLocale = get_locale();
|
419 |
-
if(!empty($currentLocale))
|
420 |
-
{
|
421 |
-
$moFile = $this->plugin_dir . "/lang/" . $currentLocale . ".mo";
|
422 |
-
if(@file_exists($moFile) && is_readable($moFile))
|
423 |
-
load_textdomain(self::GETTEXT_REALM, $moFile);
|
424 |
-
}
|
425 |
-
//load_plugin_textdomain(self::GETTEXT_REALM, $this->plugin_dir . '/lang');
|
426 |
-
if (isset($_GET[self::GET_PARAM]) && ($filename = $_GET[self::GET_PARAM]))
|
427 |
-
{
|
428 |
-
// If it is setup so, show the download page
|
429 |
-
$usedownloadpage = intval(get_option(self::PREFIX . 'show_download_page'));
|
430 |
-
// Skip the download page if 'download' parameter is used
|
431 |
-
if ($usedownloadpage && isset($_GET['download']) && $_GET['download'])
|
432 |
-
$usedownloadpage = FALSE;
|
433 |
-
if ($usedownloadpage && isset($_SERVER['HTTP_REFERER'])) {
|
434 |
-
$referer = $_SERVER['HTTP_REFERER'];
|
435 |
-
$site_url = get_option('site_url');
|
436 |
-
if ($site_url)
|
437 |
-
$found = strpos($referer, $site_url . strval($_POST[self::PREFIX . 'directories']) . $filename) === 0;
|
438 |
-
else
|
439 |
-
$found = strpos($referer, strval($_POST[self::PREFIX . 'directories']) . $filename) !== FALSE;
|
440 |
-
if ($found)
|
441 |
-
$usedownloadpage = FALSE;
|
442 |
-
}
|
443 |
-
// Also skip the download page if the file is intended for inline use
|
444 |
-
if ($usedownloadpage && ($inlineregexp = get_option(self::PREFIX . 'inline')) && preg_match(self::PREG_DELIMITER . $inlineregexp . self::PREG_DELIMITER, $filename))
|
445 |
-
$usedownloadpage = FALSE;
|
446 |
-
// Go to it
|
447 |
-
if ($usedownloadpage)
|
448 |
-
$this->Download_Page($filename);
|
449 |
-
else
|
450 |
-
if ($this->Download($filename))
|
451 |
-
die();
|
452 |
-
else
|
453 |
-
wp_redirect(get_option('site_url'));
|
454 |
-
}
|
455 |
-
}
|
456 |
-
|
457 |
-
public function AdminPanel()
|
458 |
-
{
|
459 |
-
// Function draws the admin panel.
|
460 |
-
// First, post any modified options
|
461 |
-
if (isset($_POST['SimpleDownloadMonitor_Submit']))
|
462 |
-
{
|
463 |
-
// Read options from the form
|
464 |
-
$directories = strval($_POST[self::PREFIX . 'directories']);
|
465 |
-
$extensions = strval($_POST[self::PREFIX . 'extensions']);
|
466 |
-
$detailed = intval($_POST[self::PREFIX . 'detailed']);
|
467 |
-
$inline = strval($_POST[self::PREFIX . 'inline']);
|
468 |
-
$ignored_users = strval($_POST[self::PREFIX . 'ignored_users']);
|
469 |
-
$group_within = intval($_POST[self::PREFIX . 'group_within']);
|
470 |
-
$rights_view = strval($_POST[self::PREFIX . 'rights_view']);
|
471 |
-
$rights_delete = strval($_POST[self::PREFIX . 'rights_delete']);
|
472 |
-
$rights_options = strval($_POST[self::PREFIX . 'rights_options']);
|
473 |
-
$downloads_per_day = intval($_POST[self::PREFIX . 'max_downloads_per_ip_and_day']);
|
474 |
-
$downloads_per_day_registered = intval($_POST[self::PREFIX . 'max_downloads_per_ip_and_day_registered']);
|
475 |
-
$error_download_limit = strval($_POST[self::PREFIX . 'error_download_limit']);
|
476 |
-
$show_download_page = intval($_POST[self::PREFIX . 'show_download_page']);
|
477 |
-
$download_page = strval($_POST[self::PREFIX . 'download_page']);
|
478 |
-
$basepath_modifier = strval($_POST[self::PREFIX . 'basepath_modifier']);
|
479 |
-
$detailed_errors = intval($_POST[self::PREFIX . 'detailed_errors']);
|
480 |
-
// Remove slashes if necessary
|
481 |
-
if (get_magic_quotes_gpc())
|
482 |
-
{
|
483 |
-
$directories = stripslashes($directories);
|
484 |
-
$extensions = stripslashes($extensions);
|
485 |
-
$inline = stripslashes($inline);
|
486 |
-
$ignored_users = stripslashes($ignored_users);
|
487 |
-
$error_download_limit = stripslashes($error_download_limit);
|
488 |
-
}
|
489 |
-
// Escape the delimiter
|
490 |
-
list($directories, $extensions) = str_replace(self::PREG_DELIMITER, '\\'.self::PREG_DELIMITER, array($directories, $extensions));
|
491 |
-
// Write the changes to database
|
492 |
-
update_option(self::PREFIX . 'directories', $directories);
|
493 |
-
update_option(self::PREFIX . 'extensions', $extensions);
|
494 |
-
update_option(self::PREFIX . 'detailed', $detailed);
|
495 |
-
if (($inline == '') OR (strlen($inline) >= 3))
|
496 |
-
update_option(self::PREFIX . 'inline', $inline);
|
497 |
-
update_option(self::PREFIX . 'ignored_users', $ignored_users);
|
498 |
-
update_option(self::PREFIX . 'group_within', $group_within);
|
499 |
-
update_option(self::PREFIX . 'rights_view', $rights_view);
|
500 |
-
update_option(self::PREFIX . 'rights_delete', $rights_delete);
|
501 |
-
update_option(self::PREFIX . 'rights_options', $rights_options);
|
502 |
-
update_option(self::PREFIX . 'max_downloads_per_ip_and_day', $downloads_per_day);
|
503 |
-
update_option(self::PREFIX . 'max_downloads_per_ip_and_day_registered', $downloads_per_day_registered);
|
504 |
-
update_option(self::PREFIX . 'error_download_limit', $error_download_limit);
|
505 |
-
if (file_exists($download_page))
|
506 |
-
update_option(self::PREFIX . 'download_page', $download_page);
|
507 |
-
update_option(self::PREFIX . 'show_download_page', $show_download_page);
|
508 |
-
update_option(self::PREFIX . 'basepath_modifier', $basepath_modifier);
|
509 |
-
update_option(self::PREFIX . 'detailed_errors', $detailed_errors);
|
510 |
-
|
511 |
-
}
|
512 |
-
// Load options from the database
|
513 |
-
$directories = get_option(self::PREFIX . 'directories');
|
514 |
-
$extensions = get_option(self::PREFIX . 'extensions');
|
515 |
-
$detailed = get_option(self::PREFIX . 'detailed');
|
516 |
-
$inline = get_option(self::PREFIX . 'inline');
|
517 |
-
$ignored_users = get_option(self::PREFIX . 'ignored_users');
|
518 |
-
$group_within = intval(get_option(self::PREFIX . 'group_within'));
|
519 |
-
$rights_view = get_option(self::PREFIX . 'rights_view');
|
520 |
-
$rights_delete = get_option(self::PREFIX . 'rights_delete');
|
521 |
-
$rights_options = get_option(self::PREFIX . 'rights_options');
|
522 |
-
$downloads_per_day = get_option(self::PREFIX . 'max_downloads_per_ip_and_day');
|
523 |
-
$downloads_per_day_registered = get_option(self::PREFIX . 'max_downloads_per_ip_and_day_registered');
|
524 |
-
$error_download_limit = get_option(self::PREFIX . 'error_download_limit');
|
525 |
-
$download_page = get_option(self::PREFIX . 'download_page');
|
526 |
-
$show_download_page = intval(get_option(self::PREFIX . 'show_download_page'));
|
527 |
-
$basepath_modifier = get_option(self::PREFIX . 'basepath_modifier');
|
528 |
-
$detailed_errors = intval(get_option(self::PREFIX . 'detailed_errors'));
|
529 |
-
// Build the form
|
530 |
-
?>
|
531 |
-
<div class="wrap">
|
532 |
-
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
533 |
-
<h2><?php echo __('Simple Download Monitor options', self::GETTEXT_REALM); ?></h2>
|
534 |
-
<h3><?php echo __('Access rights', self::GETTEXT_REALM); ?></h3>
|
535 |
-
<p><?php echo __('You can set up user rights required to access various functions of Simple Download Monitor. Rights are assigned through capabilities (see <a href="http://codex.wordpress.org/Roles_and_Capabilities#Roles">Roles and Capabilities</a> in WordPress Codex). Predefined values are <strong>read</strong> ("any registered user") for displaying stats, <strong>delete_users</strong> ("administrator") for reseting stats and <strong>manage_options</strong> ("administrator") for changing options.', self::GETTEXT_REALM); ?></p>
|
536 |
-
<p><?php echo __('Capability required for viewing download stats:', self::GETTEXT_REALM); ?></p>
|
537 |
-
<p><input type="text" name="<?php echo self::PREFIX; ?>rights_view" value="<?php echo esc_attr($rights_view); ?>" /></p>
|
538 |
-
<p><?php echo __('Capability required for reseting download stats:', self::GETTEXT_REALM); ?></p>
|
539 |
-
<p><input type="text" name="<?php echo self::PREFIX; ?>rights_delete" value="<?php echo esc_attr($rights_delete); ?>" /></p>
|
540 |
-
<p><?php echo __('Capability required for setting SDMON options:', self::GETTEXT_REALM); ?></p>
|
541 |
-
<p><input type="text" name="<?php echo self::PREFIX; ?>rights_options" value="<?php echo esc_attr($rights_options); ?>" /></p>
|
542 |
-
<h3><?php echo __('Allowed directories', self::GETTEXT_REALM); ?></h3>
|
543 |
-
<p><?php echo __("Only requested files whose full names (relative to document root) start with this regular expression will be processed. It is strongly recommended to place all downloadable files (and ONLY downloadable files) into a designated directory and then placing that directory's name followed by a slash here. It is possible to use the power of PREG to allow multiple directories, but make sure there are ONLY files which you are comfortable with malicious users downloading. Do not EVER allow directories which contain PHP files here! That could lead to disclosure of sensitive data, including username and password used to connect to WordPress database.", self::GETTEXT_REALM); ?></p>
|
544 |
-
<p><?php echo __("Default value is <code>files/</code>, which only allows download from /files directory (the leading <code>/</code> is implicit).", self::GETTEXT_REALM); ?></p>
|
545 |
-
<p><input type="text" name="<?php echo self::PREFIX; ?>directories" value="<?php echo esc_attr($directories); ?>" size="80" /></p>
|
546 |
-
<h3><?php echo __('Allowed extensions', self::GETTEXT_REALM); ?></h3>
|
547 |
-
<p><?php echo __('Only files with extensions matching this regular expressions will be processed. This is another important security value. Make sure you only add extensions which are safe for malicious users to have, e.g. archives and possibly images. Do NOT use any expression that could allow a user to download PHP files, even if you think it safe given the Allowed Directories option above.', self::GETTEXT_REALM); ?></p>
|
548 |
-
<p><?php echo __("Default value is <code>zip|rar|7z</code> which only allows download of files ending with <code>.zip</code>, <code>.rar</code> and <code>.7z</code> (the leading <code>.</code> is implicit).", self::GETTEXT_REALM); ?></p>
|
549 |
-
<p><input type="text" name="<?php echo self::PREFIX; ?>extensions" value="<?php echo esc_attr($extensions); ?>" size="80" /></p>
|
550 |
-
<h3><?php echo __('Inline files', self::GETTEXT_REALM); ?></h3>
|
551 |
-
<p><?php echo __('Files whose names match this regular expression will be displayed inline (within a HTML page) rather than downloaded.', self::GETTEXT_REALM); ?></p>
|
552 |
-
<p><?php echo __("By default, this value is empty - no files will appear inline, all will be downloaded. You may want to place something like <code>\.(jpe?g|gif|png|swf)$</code> here to make images and Flash videos appear inline.", self::GETTEXT_REALM); ?></p>
|
553 |
-
<p><?php echo __('Note: Unlike the options above, nothing is implied in this regular expression. You <em>must</em> use an explicit <code>\.</code> to denote "start of extension", you <em>must</em> use an explicit <code>$</code> to mark "end of filename", etc.', self::GETTEXT_REALM); ?></p>
|
554 |
-
<p><?php echo __('Also note that this plugin uses PCRE-compatible regular expressions, NOT the better-known POSIX-compatible regular expressions. As a result, a valid regular expression must be at least three characters long - separator twice, and at least one character for a meaningful r.e.', self::GETTEXT_REALM); ?></p>
|
555 |
-
<p><input type="text" name="<?php echo self::PREFIX; ?>inline" value="<?php echo esc_attr($inline); ?>" size="80" /></p>
|
556 |
-
<h3><?php echo __("Store detailed logs?", self::GETTEXT_REALM); ?></h3>
|
557 |
-
<p><?php echo __("If detailed logs are allowed, various information (including exact time of download, user's IP address, referrer etc.) is stored. This can fill your database quickly if you have only a little space or a lot of popular downloads. Otherwise just the total numbers of downloads are stored, consuming significantly less space.", self::GETTEXT_REALM); ?></p>
|
558 |
-
<p><label for="<?php echo self::PREFIX; ?>detailed"><input type="checkbox" name="<?php echo self::PREFIX; ?>detailed" value="1" <?php if ($detailed) echo 'checked="checked" '; ?>/> <?php echo __('Use detailed statistics.', self::GETTEXT_REALM); ?></label></p>
|
559 |
-
<h3><?php echo __("Ignored users", self::GETTEXT_REALM); ?></h3>
|
560 |
-
<p><?php echo __("List of users whose downloads are not monitored. Separate multiple users with pipe character <code>|</code>. It is useful to prevent administrator damaging the statistics by testing that downloads work.", self::GETTEXT_REALM); ?></p>
|
561 |
-
<p><input type="text" name="<?php echo self::PREFIX; ?>ignored_users" value="<?php echo esc_attr($ignored_users); ?>" size="80" /></p>
|
562 |
-
<h3><?php echo __("Ignore quick re-downloads", self::GETTEXT_REALM); ?></h3>
|
563 |
-
<p><?php echo __("If one IP address requests the same download several times within a given time interval, only the first time will be recorded. If a zero or a negative value is entered, all downloads will get recorded regardless of how quickly they occur after each other.", self::GETTEXT_REALM); ?></p>
|
564 |
-
<p><input type="text" name="<?php echo self::PREFIX; ?>group_within" value="<?php echo esc_attr($group_within); ?>" /> <?php echo __('seconds', self::GETTEXT_REALM); ?></p>
|
565 |
-
<h3><?php echo __("Limit number of downloads per IP address", self::GETTEXT_REALM); ?></h3>
|
566 |
-
<p><?php echo __("Limit the number of files an IP address can download per day. The default value of zero means 'no limits' - an IP address can download as many files as it likes. Note that various download managers can initiate several downloads for each file, so make sure the limit is high enough not to interfere with the normal usage of your site. Also, please understand that this is NOT a perfect solution: One IP address can be shared by multiple users, and one user can easily use more than one IP address.", self::GETTEXT_REALM); ?></p>
|
567 |
-
<p><?php echo __("Users listed in the <strong>Ignored users</strong> section above can always download an unlimited number of files.", self::GETTEXT_REALM); ?></p>
|
568 |
-
<p><?php echo __("Visitors:", self::GETTEXT_REALM); ?> <input type="text" name="<?php echo self::PREFIX; ?>max_downloads_per_ip_and_day" value="<?php echo esc_attr($downloads_per_day); ?>" /></p>
|
569 |
-
<p><?php echo __("Registered users:", self::GETTEXT_REALM); ?> <input type="text" name="<?php echo self::PREFIX; ?>max_downloads_per_ip_and_day_registered" value="<?php echo esc_attr($downloads_per_day_registered); ?>" /></p>
|
570 |
-
<p><?php echo __("Error message:", self::GETTEXT_REALM); ?></p>
|
571 |
-
<p><textarea name="<?php echo self::PREFIX; ?>error_download_limit" rows="4" cols="64"><?php echo htmlspecialchars($error_download_limit); ?></textarea></p>
|
572 |
-
<p><?php echo __("(The first <code>%d</code> will be replaced by number of hours, the second one by number of minutes.)", self::GETTEXT_REALM); ?>
|
573 |
-
<h3><?php echo __("Use more detailed error messages", self::GETTEXT_REALM); ?></h3>
|
574 |
-
<p><?php echo __("In case a link doesn't pass the security checks, display a more detailed error message than just \"file not found\". This is useful for the initial setting up, but can be used to exploit the security of your site (e.g. discovering whether a file exists). I recommend unchecking this option as soon as you get SDMon working.", self::GETTEXT_REALM); ?></p>
|
575 |
-
<p><label for="<?php echo self::PREFIX; ?>detailed_errors"><input type="checkbox" name="<?php echo self::PREFIX; ?>detailed_errors" value="1" <?php if ($detailed_errors) echo 'checked="checked" '; ?>/> <?php echo __('Use more detailed error messages.', self::GETTEXT_REALM); ?></label></p>
|
576 |
-
<h3><?php echo __("Use an intermediate Download page", self::GETTEXT_REALM); ?></h3>
|
577 |
-
<p><?php echo __("Before sending the actual requested file, display an intermediate download page which tells the user that the download is about to start.", self::GETTEXT_REALM); ?></p>
|
578 |
-
<p><label for="<?php echo self::PREFIX; ?>show_download_page"><input type="checkbox" name="<?php echo self::PREFIX; ?>show_download_page" value="1" <?php if ($show_download_page) echo 'checked="checked" '; ?>/> <?php echo __('Use the intermediate download page.', self::GETTEXT_REALM); ?></label></p>
|
579 |
-
<p><?php echo __("Path to your download page:", self::GETTEXT_REALM); ?><input type="text" name="<?php echo self::PREFIX; ?>download_page" value="<?php echo esc_attr($download_page); ?>" size="80" /></p>
|
580 |
-
<p><?php printf(__("You can use <strong>%s</strong> to use a demo page provided with the plugin.", self::GETTEXT_REALM), htmlspecialchars($this->plugin_dir . '/download-example.php')); ?></p>
|
581 |
-
<p><?php echo __("This functionality was suggested and for the most part programmed by <a href=\"http://matbra.com\">Matheus Bratfisch</a>, I (Pepak) just cleaned it up and added it to the plugin's distribution.", self::GETTEXT_REALM); ?></p>
|
582 |
-
<h3><?php echo __('Basepath modifier', self::GETTEXT_REALM); ?></h3>
|
583 |
-
<p><strong><?php echo __("Note: Keep this option empty unless you know what you are doing. DO NOT ASK! The use of this option is not supported.", self::GETTEXT_REALM); ?></strong></p>
|
584 |
-
<p><?php echo __("You can provide a modifier which, applied to WordPress' ABSPATH, gets you to the base directory from which relative links to files start. This way you can store files outside of the WordPress directory tree, by using something like <code>../private_dir/</code> (the ending slash is required). Note that this option is incompatible with some functionality and is not supported - if you want to use it, search the plugin's source code for <code>basepath_modifier</code>, understand how it is used and then act accordingly.", self::GETTEXT_REALM); ?></p>
|
585 |
-
<p><input type="text" name="<?php echo self::PREFIX; ?>basepath_modifier" value="<?php echo esc_attr($basepath_modifier); ?>" size="80" /></p>
|
586 |
-
<p> </p>
|
587 |
-
<div class="submit"><input type="submit" name="SimpleDownloadMonitor_Submit" value="<?php echo __("Update settings", self::GETTEXT_REALM) ?>" /></div>
|
588 |
-
</form>
|
589 |
-
</div><?php
|
590 |
-
}
|
591 |
-
|
592 |
-
public function ToolsPanel()
|
593 |
-
{
|
594 |
-
$download = isset($_GET['download']) ? intval($_GET['download']) : 0;
|
595 |
-
$from = isset($_GET['from']) ? intval($_GET['from']) : 0;
|
596 |
-
$order = isset($_GET['order']) ? $_GET['order'] : '';
|
597 |
-
$flags = isset($_GET['flags']) ? intval($_GET['flags']) : 0;
|
598 |
-
$detailed = get_option(self::PREFIX . 'detailed');
|
599 |
-
$options = array('download' => $download, 'from' => $from, 'order' => $order, 'flags' => $flags);
|
600 |
-
if ($this->IsAdmin())
|
601 |
-
{
|
602 |
-
if (isset($_POST['SimpleDownloadMonitor_Update']) && isset($_POST['SimpleDownloadMonitor_HideIds']) && is_array($_POST['SimpleDownloadMonitor_HideIds']) && isset($_POST['SimpleDownloadMonitor_ShowIds']) && is_array($_POST['SimpleDownloadMonitor_ShowIds']))
|
603 |
-
{
|
604 |
-
$this->HideDownloads($_POST['SimpleDownloadMonitor_ShowIds'], $_POST['SimpleDownloadMonitor_HideIds']);
|
605 |
-
}
|
606 |
-
if (isset($_POST['SimpleDownloadMonitor_Delete']) && isset($_POST['SimpleDownloadMonitor_DeleteIds']) && is_array($_POST['SimpleDownloadMonitor_DeleteIds']))
|
607 |
-
{
|
608 |
-
$this->DeleteDownloads($_POST['SimpleDownloadMonitor_DeleteIds']);
|
609 |
-
}
|
610 |
-
elseif (isset($_POST['SimpleDownloadMonitor_DeleteAll']) && ($_POST['SimpleDownloadMonitor_DeleteAllReally'] == 'yes'))
|
611 |
-
{
|
612 |
-
$this->DeleteAllDownloads();
|
613 |
-
}
|
614 |
-
if (isset($_POST['SimpleDownloadMonitor_DeleteDetail']) && isset($_POST['SimpleDownloadMonitor_DeleteIds']) && is_array($_POST['SimpleDownloadMonitor_DeleteIds']))
|
615 |
-
{
|
616 |
-
$this->DeleteDownloadDetails($_POST['SimpleDownloadMonitor_DeleteIds']);
|
617 |
-
}
|
618 |
-
}
|
619 |
-
if ($detailed && $download)
|
620 |
-
$this->DetailedDownloadList($options);
|
621 |
-
else
|
622 |
-
$this->DownloadList($options);
|
623 |
-
}
|
624 |
-
|
625 |
-
const ORDER_NAME = 'name';
|
626 |
-
const ORDER_COUNT = 'count';
|
627 |
-
const ORDER_DATE = 'date';
|
628 |
-
const ORDER_IP = 'ip';
|
629 |
-
const ORDER_REFERER = 'referer';
|
630 |
-
const ORDER_USER = 'user';
|
631 |
-
|
632 |
-
protected function GetOrderBy($order = '')
|
633 |
-
{
|
634 |
-
static $orders = array(
|
635 |
-
self::ORDER_NAME => 'filename',
|
636 |
-
self::ORDER_COUNT => 'download_count DESC, filename',
|
637 |
-
self::ORDER_DATE => 'last_date DESC, filename',
|
638 |
-
);
|
639 |
-
$result = isset($orders[$order]) ? $orders[$order] : $orders[self::ORDER_COUNT];
|
640 |
-
$result = " ORDER BY ${result} ";
|
641 |
-
return $result;
|
642 |
-
}
|
643 |
-
|
644 |
-
protected function GetDetailOrderBy($order = '')
|
645 |
-
{
|
646 |
-
static $orders = array(
|
647 |
-
self::ORDER_DATE => 'download_date DESC',
|
648 |
-
self::ORDER_IP => 'ip, download_date DESC',
|
649 |
-
self::ORDER_REFERER => 'referer, download_date DESC',
|
650 |
-
self::ORDER_USER => 'username, download_date DESC',
|
651 |
-
);
|
652 |
-
$result = isset($orders[$order]) ? $orders[$order] : $orders[self::ORDER_DATE];
|
653 |
-
$result = " ORDER BY ${result} ";
|
654 |
-
return $result;
|
655 |
-
}
|
656 |
-
|
657 |
-
const FLAGS_NOTEXISTING = 1;
|
658 |
-
|
659 |
-
protected function GetWhere($flags = 0)
|
660 |
-
{
|
661 |
-
$conditions = array();
|
662 |
-
if ($flags & self::FLAGS_NOTEXISTING)
|
663 |
-
$conditions[] = '(file_exists=0)';
|
664 |
-
else
|
665 |
-
$conditions[] = '(file_exists<>0)';
|
666 |
-
if ($conditions)
|
667 |
-
$result = ' WHERE ' . implode(' AND ', $conditions);
|
668 |
-
else
|
669 |
-
$result = '';
|
670 |
-
return $result;
|
671 |
-
}
|
672 |
-
|
673 |
-
protected function GetDetailWhere($flags = 0)
|
674 |
-
{
|
675 |
-
$conditions = array();
|
676 |
-
if ($conditions)
|
677 |
-
$result = ' AND ' . implode(' AND ', $conditions);
|
678 |
-
else
|
679 |
-
$result = '';
|
680 |
-
return $result;
|
681 |
-
}
|
682 |
-
|
683 |
-
protected function GetLimit($from = 0)
|
684 |
-
{
|
685 |
-
$from = intval($from);
|
686 |
-
if ($from < 0)
|
687 |
-
$from = 0;
|
688 |
-
$count = self::RECORDS_PER_PAGE;
|
689 |
-
$result = " LIMIT ${from}, ${count} ";
|
690 |
-
return $result;
|
691 |
-
}
|
692 |
-
|
693 |
-
protected function GetUrlForList($options = array(), $html = TRUE)
|
694 |
-
{
|
695 |
-
$amp = $html ? '&' : '&';
|
696 |
-
$result = get_option('site_url') . 'tools.php?page=' . basename(__FILE__);
|
697 |
-
foreach ($options as $name => $value)
|
698 |
-
if ($value)
|
699 |
-
$result .= $amp . ($html ? htmlspecialchars($name) : $name) . '=' . ($html ? htmlspecialchars($value) : $value);
|
700 |
-
return $result;
|
701 |
-
|
702 |
-
}
|
703 |
-
|
704 |
-
protected function Paginator($options, $count)
|
705 |
-
{
|
706 |
-
$from = intval($options['from']);
|
707 |
-
$count = intval($count);
|
708 |
-
$pages = array();
|
709 |
-
if ($from > 0)
|
710 |
-
{
|
711 |
-
$pages[] = '<div style="float: left;">';
|
712 |
-
$pages[] = '<a href="' . $this->GetUrlForList(array_merge($options, array('from'=>0))) . '">' . __("First", self::GETTEXT_REALM) . '</a>';
|
713 |
-
$pages[] = '<a href="' . $this->GetUrlForList(array_merge($options, array('from'=>($from>self::RECORDS_PER_PAGE ? $from-self::RECORDS_PER_PAGE : 0)))) . '">' . __("Previous", self::GETTEXT_REALM) . '</a>';
|
714 |
-
$pages[] = '</div>';
|
715 |
-
}
|
716 |
-
|
717 |
-
if (($from + self::RECORDS_PER_PAGE) < $count)
|
718 |
-
{
|
719 |
-
$pages[] = '<div style="float: right;">';
|
720 |
-
$pages[] = '<a href="' . $this->GetUrlForList(array_merge($options, array('from'=>$from+self::RECORDS_PER_PAGE))) . '">' . __("Next", self::GETTEXT_REALM) . '</a>';
|
721 |
-
$pages[] = '<a href="' . $this->GetUrlForList(array_merge($options, array('from'=>$count-self::RECORDS_PER_PAGE))) . '">' . __("Last", self::GETTEXT_REALM) . '</a>';
|
722 |
-
$pages[] = '</div>';
|
723 |
-
}
|
724 |
-
$result = $pages ? '<div class="pages-list">' . implode(' ', $pages) . '<div style="clear: both;" /></div>' : '';
|
725 |
-
return $result;
|
726 |
-
}
|
727 |
-
|
728 |
-
protected function IsAdmin()
|
729 |
-
{
|
730 |
-
if (current_user_can(get_option(self::PREFIX . 'rights_delete')))
|
731 |
-
/*
|
732 |
-
global $user_level;
|
733 |
-
get_currentuserinfo();
|
734 |
-
if ($user_level >= 10)
|
735 |
-
*/
|
736 |
-
return TRUE;
|
737 |
-
else
|
738 |
-
return FALSE;
|
739 |
-
}
|
740 |
-
|
741 |
-
protected function HideDownloads($show_ids, $hide_ids = array())
|
742 |
-
{
|
743 |
-
global $wpdb;
|
744 |
-
$show_ids = implode(',', array_map('intval', $show_ids));
|
745 |
-
$hide_ids = implode(',', array_map('intval', $hide_ids));
|
746 |
-
$downloads = $this->table_downloads();
|
747 |
-
if ($show_ids)
|
748 |
-
{
|
749 |
-
$sql = "UPDATE ${downloads} SET hide_from_sidebar=0, last_date=last_date WHERE id IN (${show_ids})";
|
750 |
-
// The last_date is used to prevent automatic update to current_timestamp
|
751 |
-
$wpdb->query($sql);
|
752 |
-
}
|
753 |
-
if ($hide_ids)
|
754 |
-
{
|
755 |
-
$sql = "UPDATE ${downloads} SET hide_from_sidebar=1, last_date=last_date WHERE id IN (${hide_ids})";
|
756 |
-
// The last_date is used to prevent automatic update to current_timestamp
|
757 |
-
$wpdb->query($sql);
|
758 |
-
}
|
759 |
-
//wp_redirect($_SERVER['REQUEST_URI']);
|
760 |
-
//die();
|
761 |
-
}
|
762 |
-
|
763 |
-
protected function DeleteDownloadDetails($ids = array())
|
764 |
-
{
|
765 |
-
global $wpdb;
|
766 |
-
$ids = array_map('intval', $ids);
|
767 |
-
if ($ids)
|
768 |
-
{
|
769 |
-
$ids = implode(',', $ids);
|
770 |
-
$downloads = $this->table_downloads();
|
771 |
-
$details = $this->table_details();
|
772 |
-
$downloadids = array();
|
773 |
-
$sql = "SELECT DISTINCT download FROM ${details} WHERE id IN (${ids})";
|
774 |
-
$results = $wpdb->get_results($sql, ARRAY_N);
|
775 |
-
if (is_array($results))
|
776 |
-
foreach ($results as $row)
|
777 |
-
{
|
778 |
-
list($downloadid) = $row;
|
779 |
-
$downloadids[] = $downloadid;
|
780 |
-
}
|
781 |
-
if ($downloadids) {
|
782 |
-
$sql = "DELETE FROM ${details} WHERE id IN (${ids})";
|
783 |
-
$wpdb->query($sql);
|
784 |
-
foreach ($downloadids as $downloadid)
|
785 |
-
{
|
786 |
-
$sql = "SELECT COUNT(*), MAX(download_date) FROM ${details} WHERE download=%d";
|
787 |
-
$result = $wpdb->get_row($wpdb->prepare($sql, $downloadid), ARRAY_N);
|
788 |
-
if (is_array($result))
|
789 |
-
{
|
790 |
-
list($count, $date) = $result;
|
791 |
-
$sql = "UPDATE ${downloads} SET download_count=%d, last_date=%s WHERE id=%d";
|
792 |
-
$wpdb->query($wpdb->prepare($sql, $count, $date, $downloadid));
|
793 |
-
}
|
794 |
-
}
|
795 |
-
}
|
796 |
-
}
|
797 |
-
//wp_redirect($_SERVER['REQUEST_URI']);
|
798 |
-
//die();
|
799 |
-
}
|
800 |
-
|
801 |
-
protected function DeleteDownloads($ids = array())
|
802 |
-
{
|
803 |
-
global $wpdb;
|
804 |
-
$ids = array_map('intval', $ids);
|
805 |
-
if ($ids)
|
806 |
-
{
|
807 |
-
$ids = implode(',', $ids);
|
808 |
-
$downloads = $this->table_downloads();
|
809 |
-
$details = $this->table_details();
|
810 |
-
$sql = "DELETE FROM ${downloads} WHERE id IN (${ids})";
|
811 |
-
$wpdb->query($sql);
|
812 |
-
$sql = "DELETE FROM ${details} WHERE download IN (${ids})";
|
813 |
-
$wpdb->query($sql);
|
814 |
-
}
|
815 |
-
//wp_redirect($_SERVER['REQUEST_URI']);
|
816 |
-
//die();
|
817 |
-
}
|
818 |
-
|
819 |
-
protected function DeleteAllDownloads()
|
820 |
-
{
|
821 |
-
global $wpdb;
|
822 |
-
$downloads = $this->table_downloads();
|
823 |
-
$details = $this->table_details();
|
824 |
-
$sql = "DELETE FROM ${downloads}";
|
825 |
-
$wpdb->query($sql);
|
826 |
-
$sql = "DELETE FROM ${details}";
|
827 |
-
$wpdb->query($sql);
|
828 |
-
//wp_redirect($_SERVER['REQUEST_URI']);
|
829 |
-
//die();
|
830 |
-
}
|
831 |
-
|
832 |
-
protected function DownloadList($options)
|
833 |
-
{
|
834 |
-
global $wpdb;
|
835 |
-
$flags = $options['flags'];
|
836 |
-
$from = $options['from'];
|
837 |
-
$order = $options['order'];
|
838 |
-
$detailed = get_option(self::PREFIX . 'detailed');
|
839 |
-
?>
|
840 |
-
<div class="wrap">
|
841 |
-
<h2><?php echo __('Simple Download Monitor', self::GETTEXT_REALM); ?></h2>
|
842 |
-
<h3><?php echo ($options['flags'] & self::FLAGS_NOTEXISTING) ? __('Nonexistent downloads', self::GETTEXT_REALM) : __('All downloads', self::GETTEXT_REALM); ?></h3>
|
843 |
-
<p><a href="<?php echo $this->GetUrlForList(array_merge($options, array('from' => 0, 'flags' => $options['flags']^self::FLAGS_NOTEXISTING))); ?>"><?php echo ($options['flags'] & self::FLAGS_NOTEXISTING) ? __('Show all downloads', self::GETTEXT_REALM) : __('Show nonexistent downloads', self::GETTEXT_REALM); ?></a></p>
|
844 |
-
<?php if ($this->isAdmin()): ?>
|
845 |
-
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
846 |
-
<?php endif; ?>
|
847 |
-
<table id="sdmon">
|
848 |
-
<colgroup>
|
849 |
-
<col class="sdmon-rownum" align="right" width="32" />
|
850 |
-
<col class="sdmon-filename" />
|
851 |
-
<col class="sdmon-count" align="right" width="64" />
|
852 |
-
<col class="sdmon-date" align="center" />
|
853 |
-
<col class="sdmon-hidden" />
|
854 |
-
<col class="sdmon-delete" />
|
855 |
-
</colgroup>
|
856 |
-
<thead>
|
857 |
-
<tr>
|
858 |
-
<th> </th>
|
859 |
-
<th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_NAME ))); ?>"><?php echo __("Filename", self::GETTEXT_REALM); ?></a></th>
|
860 |
-
<th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_COUNT))); ?>"><?php echo __("Download count", self::GETTEXT_REALM); ?></a></th>
|
861 |
-
<th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_DATE ))); ?>"><?php echo __("Last date", self::GETTEXT_REALM); ?></a></th>
|
862 |
-
<th><?php echo __('Hide from sidebar', self::GETTEXT_REALM); ?></th>
|
863 |
-
<th><?php echo __('Reset to zero', self::GETTEXT_REALM); ?></th>
|
864 |
-
</tr>
|
865 |
-
</thead>
|
866 |
-
<tbody><?php
|
867 |
-
$table_downloads = $this->table_downloads();
|
868 |
-
$where = $this->GetWhere($flags);
|
869 |
-
$orderby = $this->GetOrderBy($order);
|
870 |
-
$limit = $this->GetLimit($from);
|
871 |
-
$sql = "SELECT id, filename, download_count, last_date, file_exists, hide_from_sidebar FROM ${table_downloads} ${where} ${orderby} ${limit}";
|
872 |
-
$totalcount = $wpdb->get_var("SELECT COUNT(*) FROM ${table_downloads} ${where}");
|
873 |
-
$results = $wpdb->get_results($sql, ARRAY_N);
|
874 |
-
$rownum = intval($options['from']);
|
875 |
-
if (is_array($results)) {
|
876 |
-
foreach ($results as $row) {
|
877 |
-
$rownum++;
|
878 |
-
list($download, $filename, $count, $date, $exists, $hidden) = $row;
|
879 |
-
?>
|
880 |
-
<tr<?php if (!$exists) echo ' class="not-exist"'; ?>>
|
881 |
-
<td><?php echo $rownum; ?>.</td>
|
882 |
-
<td><?php if ($detailed): ?><a href="<?php echo $this->GetUrlForList(array('download' => $download)); ?>"><?php endif; echo htmlspecialchars($filename); if ($detailed): ?></a><?php endif; ?></td>
|
883 |
-
<td><?php echo $count; ?></td>
|
884 |
-
<td><?php echo mysql2date('Y-m-d H:i:s', $date, TRUE); ?></td>
|
885 |
-
<td><?php if ($this->IsAdmin()): ?>
|
886 |
-
<input type="checkbox" name="SimpleDownloadMonitor_HideIds[]" value="<?php echo $download; ?>" <?php if ($hidden) echo ' checked="checked"'; ?> />
|
887 |
-
<input type="hidden" name="SimpleDownloadMonitor_ShowIds[]" value="<?php echo $download; ?>" />
|
888 |
-
<label for="SimpleDownloadMonitor_HideIds[]" /> <?php echo __('Hidden', self::GETTEXT_REALM); ?></label>
|
889 |
-
<?php else: ?> <?php endif; ?>
|
890 |
-
</td>
|
891 |
-
<td><?php if ($this->IsAdmin()): ?>
|
892 |
-
<input type="checkbox" name="SimpleDownloadMonitor_DeleteIds[]" value="<?php echo $download; ?>" />
|
893 |
-
<label for="SimpleDownloadMonitor_DeleteIds[]"> <?php echo __('Reset', self::GETTEXT_REALM); ?></label>
|
894 |
-
<?php else: ?> <?php endif; ?>
|
895 |
-
</td>
|
896 |
-
</tr>
|
897 |
-
</tbody><?php
|
898 |
-
}
|
899 |
-
}
|
900 |
-
?>
|
901 |
-
</table>
|
902 |
-
<?php if ($this->isAdmin()): ?>
|
903 |
-
<div><input type="submit" name="SimpleDownloadMonitor_Update" value="<?php echo __('Update settings', self::GETTEXT_REALM); ?>" /></div>
|
904 |
-
<div><input type="submit" name="SimpleDownloadMonitor_Delete" value="<?php echo __('Reset checked statistics', self::GETTEXT_REALM); ?>" /></div>
|
905 |
-
<div><input type="submit" name="SimpleDownloadMonitor_DeleteAll" value="<?php echo __('Reset all statistics', self::GETTEXT_REALM); ?>" /> - <input type="checkbox" name="SimpleDownloadMonitor_DeleteAllReally" value="yes" /><label for="SimpleDownloadMonitor_DeleteAllReally"> <?php echo __('Yes, I am sure', self::GETTEXT_REALM); ?></label></div>
|
906 |
-
</form>
|
907 |
-
<?php endif; ?>
|
908 |
-
<?php echo $this->Paginator($options, $totalcount); ?>
|
909 |
-
</div><?php
|
910 |
-
}
|
911 |
-
|
912 |
-
protected function DetailedDownloadList($options)
|
913 |
-
{
|
914 |
-
global $wpdb;
|
915 |
-
$flags = $options['flags'];
|
916 |
-
$from = $options['from'];
|
917 |
-
$order = $options['order'];
|
918 |
-
$download = $options['download'];
|
919 |
-
$detailed = $options['detailed'];
|
920 |
-
$table_downloads = $this->table_downloads();
|
921 |
-
list($id, $filename, $count) = $wpdb->get_row($wpdb->prepare("SELECT id, filename, download_count FROM ${table_downloads} WHERE id=%d", $download), ARRAY_N);
|
922 |
-
if (!$id)
|
923 |
-
{
|
924 |
-
$this->DownloadList($options);
|
925 |
-
return;
|
926 |
-
}
|
927 |
-
else
|
928 |
-
{
|
929 |
-
?>
|
930 |
-
<div class="wrap">
|
931 |
-
<h2><?php echo __('Simple Download Monitor', self::GETTEXT_REALM); ?></h2>
|
932 |
-
<h3><?php printf(__('Detailed data for <strong>%s</strong>:', self::GETTEXT_REALM), $filename); ?></h3>
|
933 |
-
<p><?php printf(__('Total number of downloads: <strong>%d</strong>.', self::GETTEXT_REALM), $count); ?></p>
|
934 |
-
<?php if ($this->isAdmin()): ?>
|
935 |
-
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
936 |
-
<?php endif; ?>
|
937 |
-
<table id="sdmon">
|
938 |
-
<colgroup>
|
939 |
-
<col class="sdmon-rownum" align="right" width="32" />
|
940 |
-
<col class="sdmon-date" align="center" />
|
941 |
-
<col class="sdmon-ipaddr" />
|
942 |
-
<col class="sdmon-country" />
|
943 |
-
<col class="sdmon-referer" />
|
944 |
-
<col class="sdmon-username" />
|
945 |
-
<col class="sdmon-tools" />
|
946 |
-
</colgroup>
|
947 |
-
<thead>
|
948 |
-
<tr>
|
949 |
-
<th> </th>
|
950 |
-
<th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_DATE ))); ?>"><?php echo __("Date", self::GETTEXT_REALM); ?></a></th>
|
951 |
-
<th><?php echo __("Country", self::GETTEXT_REALM); ?></th>
|
952 |
-
<th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_IP ))); ?>"><?php echo __("IP address", self::GETTEXT_REALM); ?></a></th>
|
953 |
-
<th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_REFERER))); ?>"><?php echo __("Referer", self::GETTEXT_REALM); ?></a></th>
|
954 |
-
<th><a href="<?php echo $this->GetUrlForList(array_merge($options, array('order' => self::ORDER_USER ))); ?>"><?php echo __("Username", self::GETTEXT_REALM); ?></a></th>
|
955 |
-
<th> </th>
|
956 |
-
</tr>
|
957 |
-
</thead>
|
958 |
-
<tbody><?php
|
959 |
-
$table_details = $this->table_details();
|
960 |
-
$where = $this->GetDetailWhere($flags);
|
961 |
-
$orderby = $this->GetDetailOrderBy($order);
|
962 |
-
$limit = $this->GetLimit($from);
|
963 |
-
if (class_exists('PepakIpToCountry'))
|
964 |
-
{
|
965 |
-
$ip_loc = PepakIpToCountry::Subselect("INET_ATON(${table_details}.ip)", 'iso_code2');
|
966 |
-
}
|
967 |
-
else
|
968 |
-
$ip_loc = 'NULL';
|
969 |
-
$sql = "SELECT id, download_date, ip, referer, userid, username, ${ip_loc} iso_code2 FROM ${table_details} WHERE download=%d ${where} ${orderby} ${limit}";
|
970 |
-
$totalcount = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM ${table_details} WHERE download=%d ${where}", $download));
|
971 |
-
$results = $wpdb->get_results($wpdb->prepare($sql, $download), ARRAY_N);
|
972 |
-
$rownum = intval($options['from']);
|
973 |
-
foreach ($results as $row) {
|
974 |
-
$rownum++;
|
975 |
-
list($id, $date, $ip, $referer, $userid, $username, $country) = $row;
|
976 |
-
if (class_exists('PepakIpToCountry') AND (PepakIpToCountry::VERSION>='0.03'))
|
977 |
-
$country_flag = PepakIpToCountry::IP_to_Country_Flag($ip);
|
978 |
-
else
|
979 |
-
{
|
980 |
-
$country = strtolower($country);
|
981 |
-
$country_flag = ($country && file_exists($this->plugin_dir.'/flags/'.$country.'.png')) ? '<img src="'.$this->plugin_url.'/flags/'.$country.'.png" alt="'.$country.'" />' : '';
|
982 |
-
}
|
983 |
-
?>
|
984 |
-
<tr>
|
985 |
-
<td><?php echo $rownum; ?>.</td>
|
986 |
-
<td><?php echo mysql2date('Y-m-d H:i:s', $date, TRUE); ?></td>
|
987 |
-
<td><?php echo ($country_flag) ? $country_flag : ' '; ?></td>
|
988 |
-
<td><?php echo htmlspecialchars($ip); ?></td>
|
989 |
-
<td><?php echo htmlspecialchars($referer); ?></td>
|
990 |
-
<td><?php echo htmlspecialchars($username); ?></td>
|
991 |
-
<td><?php if ($this->IsAdmin()): ?><input type="checkbox" name="SimpleDownloadMonitor_DeleteIds[]" value="<?php echo $id; ?>" /><label for="SimpleDownloadMonitor_DeleteIds[]"> <?php echo __('Delete this statistic', self::GETTEXT_REALM); ?></label><?php else: ?> <?php endif; ?></td>
|
992 |
-
</tr>
|
993 |
-
</tbody><?php
|
994 |
-
}
|
995 |
-
}
|
996 |
-
?>
|
997 |
-
</table>
|
998 |
-
<?php if ($this->isAdmin()): ?>
|
999 |
-
<div><input type="submit" name="SimpleDownloadMonitor_DeleteDetail" value="<?php echo __('Delete checked statistics', self::GETTEXT_REALM); ?>" /></div>
|
1000 |
-
</form>
|
1001 |
-
<form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
1002 |
-
<div><input type="submit" name="SimpleDownloadMonitor_Delete" value="<?php echo __('Delete all statistics', self::GETTEXT_REALM); ?>" /> - <input type="checkbox" name="SimpleDownloadMonitor_DeleteIds[]" value="<?php echo $download; ?>" /> <?php echo __('Yes, I am sure', self::GETTEXT_REALM); ?></label></div>
|
1003 |
-
</form>
|
1004 |
-
<?php endif; ?>
|
1005 |
-
<?php echo $this->Paginator($options, $totalcount); ?>
|
1006 |
-
<p><a href="<?php echo $this->GetUrlForList(); ?>"><?php echo __('Return to full list.', self::GETTEXT_REALM); ?></a></p>
|
1007 |
-
</div><?php
|
1008 |
-
}
|
1009 |
-
|
1010 |
-
public function ActionHead()
|
1011 |
-
{
|
1012 |
-
echo '<link type="text/css" rel="stylesheet" href="' . $this->plugin_url . '/css/sdmon.css" />'."\n";
|
1013 |
-
}
|
1014 |
-
|
1015 |
-
}
|
1016 |
-
}
|
1017 |
-
|
1018 |
-
if (!isset($sdmon))
|
1019 |
-
$sdmon = new SimpleDownloadMonitor();
|
1020 |
-
|
1021 |
-
if (!function_exists('SimpleDownloadMonitor_BuildAdminMenu'))
|
1022 |
-
{
|
1023 |
-
function SimpleDownloadMonitor_BuildAdminMenu()
|
1024 |
-
{
|
1025 |
-
global $sdmon;
|
1026 |
-
if (isset($sdmon))
|
1027 |
-
{
|
1028 |
-
$rights_options = get_option(SimpleDownloadMonitor::PREFIX . 'rights_options');
|
1029 |
-
$rights_view = get_option(SimpleDownloadMonitor::PREFIX . 'rights_view');
|
1030 |
-
if (!$rights_options) $rights_options = 'manage_options';
|
1031 |
-
if (!$rights_view) $rights_view = 'read';
|
1032 |
-
$options_page = add_options_page(__('Simple Download Monitor options', SimpleDownloadMonitor::GETTEXT_REALM), __('Simple Download Monitor', SimpleDownloadMonitor::GETTEXT_REALM), $rights_options, basename(__FILE__), array(&$sdmon, 'AdminPanel'));
|
1033 |
-
$tool_page = add_submenu_page('tools.php', __('Simple Download Monitor', SimpleDownloadMonitor::GETTEXT_REALM), __('Simple Download Monitor', SimpleDownloadMonitor::GETTEXT_REALM), $rights_view, basename(__FILE__), array(&$sdmon, 'ToolsPanel'));
|
1034 |
-
add_action('admin_head-'.$tool_page, array(&$sdmon, 'ActionHead'));
|
1035 |
-
}
|
1036 |
-
}
|
1037 |
-
}
|
1038 |
-
|
1039 |
-
if (!class_exists('SimpleDownloadMonitor_Widget'))
|
1040 |
-
{
|
1041 |
-
class SimpleDownloadMonitor_Widget extends WP_Widget
|
1042 |
-
{
|
1043 |
-
function SimpleDownloadMonitor_Widget()
|
1044 |
-
{
|
1045 |
-
$widget_options = array(
|
1046 |
-
'classname' => 'sdmon',
|
1047 |
-
'description' => __('Allows you to display the most popular downloads in the sidebar.', SimpleDownloadMonitor::GETTEXT_REALM)
|
1048 |
-
);
|
1049 |
-
$control_options = array(
|
1050 |
-
//'width' => 250,
|
1051 |
-
//'height' => 0,
|
1052 |
-
'id_base' => 'sdmon-widget'
|
1053 |
-
);
|
1054 |
-
$this->WP_Widget('sdmon-widget', 'Simple Download Monitor', $widget_options, $control_options);
|
1055 |
-
}
|
1056 |
-
|
1057 |
-
function widget($arguments, $instance)
|
1058 |
-
{
|
1059 |
-
global $wpdb;
|
1060 |
-
$title = apply_filters('widget_title', $instance['title']);
|
1061 |
-
$count = intval(isset($instance['count']) ? intval($instance['count']) : 0);
|
1062 |
-
if ($count <= 0) $count = 10;
|
1063 |
-
$like = isset($instance['like']) ? $instance['like'] : '';
|
1064 |
-
echo $arguments['before_widget'];
|
1065 |
-
if ($title) echo $arguments['before_title'] . $title . $arguments['after_title'];
|
1066 |
-
$downloads = SimpleDownloadMonitor::table_downloads();
|
1067 |
-
$liketest = $like ? ' AND filename LIKE "%s"' : '';
|
1068 |
-
$sql = "SELECT id, filename, download_count FROM ${downloads} WHERE file_exists<>0 AND COALESCE(hide_from_sidebar,0)=0 ${liketest} ORDER BY download_count DESC LIMIT ${count}";
|
1069 |
-
$results = $wpdb->get_results($wpdb->prepare($sql, $like), ARRAY_N);
|
1070 |
-
echo "<ul>\n";
|
1071 |
-
foreach ($results as $row)
|
1072 |
-
{
|
1073 |
-
list($id, $filename, $downloadcount) = $row;
|
1074 |
-
?><li><a href="/<?php echo esc_attr($filename); ?>"><?php echo htmlspecialchars(basename($filename)); ?></a> <strong><?php echo $downloadcount; ?></strong></li><?php
|
1075 |
-
}
|
1076 |
-
echo "</ul>\n";
|
1077 |
-
echo $arguments['after_widget'];
|
1078 |
-
}
|
1079 |
-
|
1080 |
-
function update($new_instance, $old_instance)
|
1081 |
-
{
|
1082 |
-
$instance = $old_instance;
|
1083 |
-
$instance['title'] = strip_tags($new_instance['title']);
|
1084 |
-
$instance['count'] = intval($new_instance['count']);
|
1085 |
-
$instance['like'] = $new_instance['like'];
|
1086 |
-
return $instance;
|
1087 |
-
}
|
1088 |
-
|
1089 |
-
function form($instance)
|
1090 |
-
{
|
1091 |
-
$defaults = array(
|
1092 |
-
'title' => __('Popular files', SimpleDownloadMonitor::GETTEXT_REALM),
|
1093 |
-
'count' => '10',
|
1094 |
-
'like' => ''
|
1095 |
-
);
|
1096 |
-
$instance = wp_parse_args((array) $instance, $defaults);
|
1097 |
-
?><p>
|
1098 |
-
<label for="<?php echo $this->get_field_id('title'); ?>"><?php echo __('Title:', SimpleDownloadMonitor::GETTEXT_REALM); ?></label>
|
1099 |
-
<input id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($instance['title']); ?>" type="text" style="width: 100%;" />
|
1100 |
-
</p>
|
1101 |
-
<p>
|
1102 |
-
<label for="<?php echo $this->get_field_id('count'); ?>"><?php echo __('Number of files to show:', SimpleDownloadMonitor::GETTEXT_REALM); ?></label>
|
1103 |
-
<input id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>" value="<?php echo esc_attr($instance['count']); ?>" type="text" />
|
1104 |
-
</p><p>
|
1105 |
-
<label for="<?php echo $this->get_field_id('like'); ?>"><?php echo __('Only show filenames which match this LIKE condition:', SimpleDownloadMonitor::GETTEXT_REALM); ?></label>
|
1106 |
-
<input id="<?php echo $this->get_field_id('like'); ?>" name="<?php echo $this->get_field_name('like'); ?>" value="<?php echo esc_attr($instance['like']); ?>" type="text" style="width: 100%;" />
|
1107 |
-
<br /><?php echo __("Empty string matches all filenames and is useful for most usage scenarios. You would only use a non-empty value if you wanted to create multiple SDMon widgets, each showing a different list of files: only filenames which match the given string in a LIKE condition of a SQL query will be shown. The most common values would be something like <code>files/documents/%</code> (meaning \"The filename must begin with <code>files/documents/</code>\") or <code>%.mp3</code> (meaning \"The filename must end with <code>.mp3</code>\") - the percentage symbol <code>%</code> means \"anything\", the underscore symbol <code>_</code> means \"Any one character\".", SimpleDownloadMonitor::GETTEXT_REALM); ?>
|
1108 |
-
</p><?php
|
1109 |
-
}
|
1110 |
-
|
1111 |
-
}
|
1112 |
-
}
|
1113 |
-
|
1114 |
-
if (!function_exists('SimpleDownloadMonitorWidget_Init'))
|
1115 |
-
{
|
1116 |
-
function SimpleDownloadMonitorWidget_Init()
|
1117 |
-
{
|
1118 |
-
register_widget('SimpleDownloadMonitor_Widget');
|
1119 |
-
}
|
1120 |
-
|
1121 |
-
}
|
1122 |
-
|
1123 |
-
add_action('widgets_init', 'SimpleDownloadMonitorWidget_Init');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tinymce/img/Thumbs.db
ADDED
Binary file
|
tinymce/img/sdm_downloads.png
ADDED
Binary file
|
tinymce/sdm_editor_plugin.js
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function() {
|
2 |
+
tinymce.create('tinymce.plugins.sdmDownloads', {
|
3 |
+
/**
|
4 |
+
* Initializes the plugin, this will be executed after the plugin has been created.
|
5 |
+
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
6 |
+
* of the editor instance to intercept that event.
|
7 |
+
*
|
8 |
+
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
9 |
+
* @param {string} url Absolute URL to where the plugin is located.
|
10 |
+
*/
|
11 |
+
init : function(ed, url) {
|
12 |
+
ed.addButton('sdm_downloads', {
|
13 |
+
title : 'SDM Downloads',
|
14 |
+
cmd : 'sdm_downloads',
|
15 |
+
image : url + '/img/sdm_downloads.png'
|
16 |
+
});
|
17 |
+
|
18 |
+
ed.addCommand('sdm_downloads', function() {
|
19 |
+
/*
|
20 |
+
ed.windowManager.open({
|
21 |
+
file : url + '/sdm_downloads.php',
|
22 |
+
width : 400,
|
23 |
+
height : 400,
|
24 |
+
inline : 1
|
25 |
+
});
|
26 |
+
*/
|
27 |
+
var width = jQuery(window).width(),
|
28 |
+
H = jQuery(window).height(),
|
29 |
+
W = ( 720 < width ) ? 720 : width;
|
30 |
+
W = W - 80;
|
31 |
+
H = H - 84;
|
32 |
+
tb_show( 'SDM Downloads Insert Shortcode', '#TB_inline?width=' + W + '&height=' + H + '&inlineId=highlight-form' );
|
33 |
+
});
|
34 |
+
},
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Creates control instances based in the incomming name. This method is normally not
|
38 |
+
* needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
|
39 |
+
* but you sometimes need to create more complex controls like listboxes, split buttons etc then this
|
40 |
+
* method can be used to create those.
|
41 |
+
*
|
42 |
+
* @param {String} n Name of the control to create.
|
43 |
+
* @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
|
44 |
+
* @return {tinymce.ui.Control} New control instance or null if no control was created.
|
45 |
+
*/
|
46 |
+
createControl : function(n, cm) {
|
47 |
+
return null;
|
48 |
+
},
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Returns information about the plugin as a name/value array.
|
52 |
+
* The current keys are longname, author, authorurl, infourl and version.
|
53 |
+
*
|
54 |
+
* @return {Object} Name/value array containing information about the plugin.
|
55 |
+
*/
|
56 |
+
getInfo : function() {
|
57 |
+
return {
|
58 |
+
longname : 'Simple Download Monitor Button',
|
59 |
+
author : 'Tips and Tricks HQ',
|
60 |
+
authorurl : 'http://www.tipsandtricks-hq.com/development-center',
|
61 |
+
infourl : 'http://www.tipsandtricks-hq.com/development-center',
|
62 |
+
version : "1.0"
|
63 |
+
};
|
64 |
+
}
|
65 |
+
});
|
66 |
+
|
67 |
+
// Register plugin
|
68 |
+
tinymce.PluginManager.add( 'sdm_downloads', tinymce.plugins.sdmDownloads );
|
69 |
+
})();
|
70 |
+
|
71 |
+
jQuery(function(){
|
72 |
+
|
73 |
+
|
74 |
+
// Run an ajax call to the main.php to get all current CPT items
|
75 |
+
jQuery.post(
|
76 |
+
sdm_admin_ajax_url.sdm_admin_ajax_url,
|
77 |
+
{
|
78 |
+
action: 'sdm_tiny_get_post_ids'
|
79 |
+
},
|
80 |
+
function(response) {
|
81 |
+
if(response) { // ** If response was successful
|
82 |
+
console.log(response.test);
|
83 |
+
|
84 |
+
jQuery.each(response.test, function (index, value) {
|
85 |
+
jQuery('#sdm_select').append('<option value="'+value.post_id+'">'+value.post_title+'</option>'); // Populate dropdown list with CPT item titles
|
86 |
+
});
|
87 |
+
}
|
88 |
+
else { // ** Else response was unsuccessful
|
89 |
+
alert('SDM Downloads AJAX Error! Please deactivate the plugin to permanently dismiss this alert.');
|
90 |
+
}
|
91 |
+
}
|
92 |
+
);
|
93 |
+
|
94 |
+
// Instantiate a form in the wp thickbox window (hidden at start)
|
95 |
+
var form = jQuery('<div id="highlight-form"><div id="sdm_tinymce_postids" style="display:none;"></div>\
|
96 |
+
<div id="sdm_select_title" style="margin-top:20px;">Please select a Download Item:</div>\
|
97 |
+
<table id="highlight-table" class="form-table" style="text-align: left">\
|
98 |
+
\
|
99 |
+
\
|
100 |
+
<tr>\
|
101 |
+
<th><label class="title" for="highlight-bg">Download Title</label></th>\
|
102 |
+
<td><select name="sdm_select" id="sdm_select">\
|
103 |
+
</select><br />\
|
104 |
+
</tr>\
|
105 |
+
<tr>\
|
106 |
+
<th><label class="sdm_fancy" for "sdm_fancy_option">Include Fancy Box</th>\
|
107 |
+
<td><input type="checkbox" name="sdm_fancy_cb" id="sdm_fancy_cb" />\
|
108 |
+
</tr>\
|
109 |
+
</table>\
|
110 |
+
<p class="submit">\
|
111 |
+
<input type="button" id="sdm-tinymce-submit" class="button-primary" value="Insert SDM Shortcode" name="submit" style=""/>\
|
112 |
+
</p>\
|
113 |
+
<p></p>\
|
114 |
+
</div>');
|
115 |
+
|
116 |
+
var table = form.find('table');
|
117 |
+
form.appendTo('body').hide(); // Hide form
|
118 |
+
|
119 |
+
// handles the click event of the submit button
|
120 |
+
form.find('#sdm-tinymce-submit').click(function(){
|
121 |
+
|
122 |
+
fancy_cb = jQuery('#sdm_fancy_cb').is(':checked');
|
123 |
+
post_id = jQuery('#sdm_select').find(":selected").val(); // Get selected CPT item title value (item id)
|
124 |
+
|
125 |
+
if (jQuery('#sdm_fancy_cb').is(':checked')) {
|
126 |
+
shortcode = '[sdm-download id="'+post_id+'" fancy="1"]'; // Process shortcode
|
127 |
+
} else {
|
128 |
+
shortcode = '[sdm-download id="'+post_id+'" fancy="0"]'; // Process shortcode
|
129 |
+
}
|
130 |
+
|
131 |
+
// inserts the shortcode into the active editor
|
132 |
+
tinyMCE.activeEditor.execCommand('mceInsertContent', 0, shortcode); // Send processed shortcode to editor
|
133 |
+
|
134 |
+
// close WP thickbox window
|
135 |
+
tb_remove();
|
136 |
+
});
|
137 |
+
});
|