Protect uploads - Version 0.1

Version Description

Nothing for now

Download this release

Release Info

Developer alticreation
Plugin Icon 128x128 Protect uploads
Version 0.1
Comparing to
See all releases

Version 0.1

LICENSE.txt ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ <one line to give the program's name and a brief idea of what it does.>
294
+ Copyright (C) <year> <name of author>
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, write to the Free Software Foundation, Inc.,
308
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
+
310
+ Also add information on how to contact you by electronic and paper mail.
311
+
312
+ If the program is interactive, make it output a short notice like this
313
+ when it starts in an interactive mode:
314
+
315
+ Gnomovision version 69, Copyright (C) year name of author
316
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
+ This is free software, and you are welcome to redistribute it
318
+ under certain conditions; type `show c' for details.
319
+
320
+ The hypothetical commands `show w' and `show c' should show the appropriate
321
+ parts of the General Public License. Of course, the commands you use may
322
+ be called something other than `show w' and `show c'; they could even be
323
+ mouse-clicks or menu items--whatever suits your program.
324
+
325
+ You should also get your employer (if you work as a programmer) or your
326
+ school, if any, to sign a "copyright disclaimer" for the program, if
327
+ necessary. Here is a sample; alter the names:
328
+
329
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
+
332
+ <signature of Ty Coon>, 1 April 1989
333
+ Ty Coon, President of Vice
334
+
335
+ This General Public License does not permit incorporating your program into
336
+ proprietary programs. If your program is a subroutine library, you may
337
+ consider it more useful to permit linking proprietary applications with the
338
+ library. If this is what you want to do, use the GNU Lesser General
339
+ Public License instead of this License.
admin/assets/css/protect-uploads-admin.css ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #wrap.protect-uploads h2 {
2
+ font-size: 30px;
3
+ }
4
+ #wrap.protect-uploads h2 span, #wrap.protect-uploads h2 span * {
5
+ font-size: 14px;
6
+ color: #238ECB;
7
+ }
8
+ #wrap.protect-uploads .description {
9
+ color: #666;
10
+ }
11
+ #wrap.protect-uploads .small {
12
+ font-size: .8em;
13
+ font-style: none !important;
14
+ }
15
+ #wrap.protect-uploads .alert {
16
+ font-size: .9em;
17
+ color: #238ECB;
18
+ }
19
+ #wrap.protect-uploads .error {
20
+ color: #E23C0C;
21
+ }
22
+ #wrap.protect-uploads .valid {
23
+ color: #7ad03a;
24
+ }
25
+ #wrap.protect-uploads .valid.note {
26
+ margin-left: 25px;
27
+ background: #fff;
28
+ display: inline-block;
29
+ padding:10px;
30
+ }
31
+ #wrap.protect-uploads .valid.note span {
32
+ color: #919191;
33
+ }
34
+ #wrap.protect-uploads label span.dashicons-image-crop:before {
35
+ font-size: 16px !important;
36
+ color: #aaa;
37
+ }
38
+ #wrap.protect-uploads th label span.dashicons {
39
+ color: #238ECB;
40
+ margin: 0 5px 10px 0;
41
+ }
42
+ #wrap.protect-uploads td label {
43
+ margin-bottom: 15px !important;
44
+ }
45
+ #wrap.protect-uploads td label p.description {
46
+ margin-left: 25px;
47
+ }
48
+ #wrap.protect-uploads img.protect-uploads {
49
+ border: 1px solid #ccc;
50
+ padding: 5px;
51
+ }
52
+ #wrap.protect-uploads .protect-uploads-footer {
53
+ border-left: 0 !important;
54
+ margin-left: 0 !important;
55
+ overflow: hidden;
56
+ padding: 15px !important;
57
+ margin-top: 30px;
58
+ }
59
+ #wrap.protect-uploads .protect-uploads-footer .logo {
60
+ float: left;
61
+ margin-right: 20px;
62
+ }
63
+ #wrap.protect-uploads .protect-uploads-footer .share a {
64
+ display: inline-block;
65
+ padding: 5px 10px;
66
+ background: #238ECB;
67
+ color: #fff;
68
+ margin: 0 5px 0 0;
69
+ }
admin/assets/js/protect-uploads-admin.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*
2
+ nothing for now
3
+ */
admin/class-protect-uploads-admin.php ADDED
@@ -0,0 +1,317 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Alti_ProtectUploads_Admin {
4
+
5
+ private $plugin_name;
6
+ private $version;
7
+ private $messages = array();
8
+
9
+ /**
10
+ * constructor
11
+ * @param string $plugin_name
12
+ * @param string $version
13
+ */
14
+ public function __construct( $plugin_name, $version ) {
15
+ $this->plugin_name = $plugin_name;
16
+ $this->version = $version;
17
+ }
18
+
19
+ public function get_plugin_name() {
20
+ return $this->plugin_name;
21
+ }
22
+
23
+ /**
24
+ * Add submenu to left page in admin
25
+ */
26
+ public function add_submenu_page() {
27
+ add_submenu_page( 'upload.php', $this->plugin_name, 'Protect Uploads <span class="dashicons dashicons-shield-alt" style="font-size:15px;"></span>', 'manage_options', $this->plugin_name . '-settings-page', array($this, 'render_settings_page') );
28
+ }
29
+
30
+ /**
31
+ * Render settings page for plugin
32
+ */
33
+ public function render_settings_page() {
34
+ require plugin_dir_path( __FILE__ ) . 'views/' . $this->plugin_name . '-admin-settings-page.php';
35
+ }
36
+
37
+ /**
38
+ * prepare enqueue styles for wordpress hook
39
+ */
40
+ public function enqueue_styles() {
41
+ wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'assets/css/protect-uploads-admin.css', array(), $this->version, 'all' );
42
+ }
43
+
44
+ /**
45
+ * prepare enqueue scripts for wordpress hook
46
+ */
47
+ public function enqueue_scripts() {
48
+ wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'assets/js/protect-uploads-admin.js', array( 'jquery' ), $this->version, false );
49
+ }
50
+
51
+ /**
52
+ * add a settings link to plugin page.
53
+ * @param string $links array of links
54
+ */
55
+ public function add_settings_link( $links ) {
56
+ $settings_link = '<a href="upload.php?page=' . $this->plugin_name . '-settings-page">' . __( 'Settings' ) . '</a>';
57
+ array_unshift($links, $settings_link);
58
+ return $links;
59
+ }
60
+
61
+ /**
62
+ * get uploads dir
63
+ * @return string return path
64
+ */
65
+ public function get_uploads_dir() {
66
+ $uploads_dir = wp_upload_dir();
67
+ return $uploads_dir['basedir'];
68
+ }
69
+
70
+ /**
71
+ * get uploads folder url
72
+ * @return string return full url
73
+ */
74
+ public function get_uploads_url() {
75
+ $uploads_dir = wp_upload_dir();
76
+ return $uploads_dir['baseurl'];
77
+ }
78
+
79
+ public function get_uploads_subdirectories() {
80
+
81
+ $directories = scandir( self::get_uploads_dir() );
82
+ $subs = array( self::get_uploads_dir() );
83
+
84
+ foreach ($directories as $directory) {
85
+
86
+ if(is_dir(self::get_uploads_dir() . '/' . $directory) && !preg_match('/^\.*$/', $directory)) {
87
+ $subs[] = self::get_uploads_dir() . '/' . $directory;
88
+ $subDirectories = scandir( self::get_uploads_dir() . '/' . $directory );
89
+ foreach ($subDirectories as $subDirectory) {
90
+ if(is_dir(self::get_uploads_dir() . '/' . $directory . '/' . $subDirectory) && !preg_match('/^\.*$/', $subDirectory)) $subs[] = self::get_uploads_dir() . '/' . $directory . '/' . $subDirectory;
91
+ }
92
+ }
93
+
94
+ }
95
+ return $subs;
96
+
97
+ }
98
+
99
+ /**
100
+ * saving form
101
+ */
102
+ public function save_form( $form ) {
103
+ if( $form['protection'] == 'index_php' ) { $this->remove_htaccess(); $this->create_index(); }
104
+ if( $form['protection'] == 'htaccess' ) { $this->remove_index(); $this->create_htaccess(); }
105
+ if( $form['protection'] == 'remove' ) { $this->remove_index(); $this->remove_htaccess(); }
106
+ }
107
+
108
+
109
+ /**
110
+ *
111
+ */
112
+ public function create_index() {
113
+ // check if index php does not exists
114
+ if(!file_exists( self::get_uploads_dir() .'/index.php' )) {
115
+
116
+ $indexContent = "<!-- \n Generated by " . $this->get_plugin_name() . " \n http://www.alticreation.com/en/protect-uploads/ \n date:" . date('d/m/Y') . "\n--><?php // Silence is golden";
117
+ $i = 0;
118
+ foreach (self::get_uploads_subdirectories() as $subDirectory) {
119
+
120
+ if( !file_put_contents( $subDirectory.'/'.'index.php', $indexContent ) ) {
121
+ $this->messages['file'][] = array(
122
+ 'message' => __('Impossible to create or modified the index.php file in '. $subDirectory, $this->get_plugin_name()),
123
+ 'type' => 'error',
124
+ 'id' => '1'
125
+ );
126
+ }
127
+ else {
128
+ update_option( $this->get_plugin_name().'-protection', 'index_php' );
129
+ $i++;
130
+ }
131
+
132
+ }
133
+
134
+ if($i == count(self::get_uploads_subdirectories())) {
135
+ $this->messages['file'][] = array(
136
+ 'message' => __('The index.php file has been created in main folder and subfolders (two levels max).', $this->get_plugin_name()),
137
+ 'type' => 'updated'
138
+ );
139
+ }
140
+
141
+ }
142
+ // if index php already exists
143
+ else {
144
+ $this->messages['file'][] = array(
145
+ 'message' => 'The index.php file already exists',
146
+ 'type' => 'error',
147
+ 'id' => '2'
148
+ );
149
+ }
150
+ }
151
+
152
+ /**
153
+ *
154
+ */
155
+ public function create_htaccess() {
156
+ // prepare htaccess Content
157
+ $date = date('Y-m-d H:i.s');
158
+ $phpv = phpversion();
159
+
160
+ $htaccessContent = "\n# BEGIN " . $this->get_plugin_name() . " Plugin\n";
161
+ $htaccessContent .= "\tOptions -Indexes\n";
162
+ $htaccessContent .= "# [date={$date}] [php={$phpv}] [plugin_name=" . $this->plugin_name . "] [version={$this->version}]\n";
163
+ $htaccessContent .= "# END " . $this->get_plugin_name() . " Plugin\n";
164
+
165
+ // check if htaccess does not exists
166
+ if(!file_exists( self::get_uploads_dir() .'/.htaccess' )) {
167
+ // if htaccess is successfuly written
168
+ if( !file_put_contents( self::get_uploads_dir().'/'.'.htaccess', $htaccessContent ) ) {
169
+ $this->messages['file'][] = array(
170
+ 'message' => __('Impossible to create or modified the htaccess file.', $this->get_plugin_name()),
171
+ 'type' => 'error',
172
+ 'id' => '1'
173
+ );
174
+ }
175
+ // if htaccess has not been written
176
+ else {
177
+ update_option( $this->get_plugin_name().'-protection', 'htaccess');
178
+ $this->messages['file'][] = array(
179
+ 'message' => __('The htaccess file has been created.', $this->get_plugin_name()),
180
+ 'type' => 'updated'
181
+ );
182
+ }
183
+
184
+ }
185
+ // if htaccess already exists
186
+ if(file_exists( self::get_uploads_dir() .'/.htaccess') && preg_match( '/(# BEGIN protect-uploads Plugin)(.*?)(# END protect-uploads Plugin)/is', file_get_contents( self::get_uploads_dir() .'/.htaccess' ) ) == 0) {
187
+ // if content added to existing htaccess
188
+ if( file_put_contents( self::get_uploads_dir() .'/.htaccess', $htaccessContent, FILE_APPEND | LOCK_EX ) ) {
189
+ update_option( $this->get_plugin_name().'-protection', 'htaccess');
190
+ $this->messages['file'][] = array(
191
+ 'message' => __('Existing htaccess has been updated.', $this->get_plugin_name()),
192
+ 'type' => 'updated'
193
+ );
194
+
195
+ }
196
+ else {
197
+ $this->messages['file'][] = array(
198
+ 'message' => 'The existing htaccess file couldn\'t be updated. Please check file permissions.',
199
+ 'type' => 'error',
200
+ 'id' => '2'
201
+ );
202
+ }
203
+ }
204
+ }
205
+
206
+ /**
207
+ * remove index file
208
+ */
209
+ public function remove_index() {
210
+
211
+ $i = 0;
212
+ foreach( self::get_uploads_subdirectories() as $subDirectory ) {
213
+ if(file_exists( $subDirectory .'/index.php' )) {
214
+ unlink( $subDirectory .'/index.php' );
215
+ $i++;
216
+ }
217
+
218
+ }
219
+ if( $i == count(self::get_uploads_subdirectories()) ) {
220
+ $this->messages['file'][] = array(
221
+ 'message' => __('The index.php file(s) have(has) been deleted.', $this->get_plugin_name()),
222
+ 'type' => 'updated'
223
+ );
224
+ update_option( $this->get_plugin_name().'-protection', 'remove');
225
+ }
226
+
227
+
228
+ }
229
+
230
+ /**
231
+ * remove htaccess
232
+ */
233
+ public function remove_htaccess() {
234
+
235
+ if(file_exists( self::get_uploads_dir() .'/.htaccess' )) {
236
+ update_option( $this->get_plugin_name().'-protection', 'remove');
237
+
238
+ $htaccessContent = file_get_contents(self::get_uploads_dir() .'/.htaccess');
239
+ $htaccessContent = preg_replace( '/(# BEGIN protect-uploads Plugin)(.*?)(# END protect-uploads Plugin)/is', '', $htaccessContent );
240
+ file_put_contents( self::get_uploads_dir() .'/.htaccess', $htaccessContent, LOCK_EX );
241
+
242
+ // if htaccess is empty, we remove it.
243
+ if( strlen(preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "", file_get_contents(self::get_uploads_dir() .'/.htaccess'))) == 0) {
244
+ unlink( self::get_uploads_dir() .'/.htaccess' );
245
+ }
246
+
247
+
248
+ //
249
+ $this->messages['file'][] = array(
250
+ 'message' => __('The htaccess file has been updated.', $this->get_plugin_name()),
251
+ 'type' => 'updated'
252
+ );
253
+ }
254
+
255
+ }
256
+
257
+ /**
258
+ * check if apache is active
259
+ * @return message messages
260
+ */
261
+ public function get_current_protection() {
262
+ // check if header is 200 (ok)
263
+ $uploads_headers = @get_headers( self::get_uploads_url() . '/' );
264
+ if(!is_array($uploads_headers)) $uploads_headers[0] = '';
265
+ if( preg_match('/200/i', $uploads_headers[0] )) {
266
+ // because
267
+ if( !file_exists( self::get_uploads_dir() .'/index.php' ) ) {
268
+ return false;
269
+ }
270
+ else {
271
+ return true;
272
+ }
273
+ }
274
+ // check if header is 403 (forbidden)
275
+ if( preg_match('/403/i', $uploads_headers[0] )) {
276
+ if( !file_exists( self::get_uploads_dir() .'/index.php' ) ) {
277
+ return true;
278
+ }
279
+ else {
280
+ return true;
281
+ }
282
+ }
283
+
284
+ }
285
+
286
+ /**
287
+ * check if apache is active
288
+ * @return message messages
289
+ */
290
+ public function check_apache() {
291
+
292
+ if( !function_exists('apache_get_modules')) {
293
+ $this->messages['apache'][] = array(
294
+ 'message' => __('The Protect Uploads plugin cannot work without Apache. Yourself or your web host has to activate this module.', $this->plugin_name),
295
+ 'type' => 'error',
296
+ 'id' => '3'
297
+ );
298
+ }
299
+ }
300
+
301
+
302
+
303
+ /**
304
+ * display messages manager
305
+ * @return array push array messages in to partial view
306
+ */
307
+ public function display_messages() {
308
+
309
+ foreach ($this->messages as $name => $messages) {
310
+ foreach ($messages as $message) {
311
+ require plugin_dir_path( dirname( __FILE__ ) ) . 'admin/views/includes/protect-uploads-admin-message.php';
312
+ }
313
+ }
314
+
315
+ }
316
+
317
+ }
admin/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
admin/views/includes/protect-uploads-admin-message.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="message" class="<?php echo $message['type']; ?>">
2
+ <p>
3
+ <?php echo $message['message']; ?>
4
+ <?php if( !empty($message['id']) ) {
5
+ ?>
6
+ <div>
7
+ <i>[<?php _e('Error code', $this->plugin_name); ?> : <?php echo sprintf('%03d', $message['id']); ?></i>] <a target="_blank" href="http://alticreation.com/en/protect-uploads#error<?php echo sprintf('%03d', $message['id']); ?>"><?php _e('Go to Protect Uploads documentation', $this->plugin_name); ?></a>
8
+ </div>
9
+ <?php } ?>
10
+ </p>
11
+ </div>
admin/views/protect-uploads-admin-settings-page.php ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="wrap" class="<?php echo $this->plugin_name ?>">
2
+ <?php
3
+ $plugin = new Alti_ProtectUploads_Admin($this->plugin_name, $this->version);
4
+ if($_POST) {
5
+ $plugin->save_form( $_POST );
6
+ }
7
+ $plugin->display_messages();
8
+ ?>
9
+ <h2>Protect Uploads Directory <span><?php _e('by', $this->plugin_name); ?> <a href="http://alticreation.com/en">alticreation.com</a></span></h2>
10
+ <p class="description"><?php _e('Prevent users to browse your uploads directory. You\'ll protect your uploads directory to be accessed and content stolen too easily in one batch.', $this->plugin_name); ?></p>
11
+ <form method="POST" enctype="multipart/form-data">
12
+
13
+ <table class="form-table">
14
+ <tbody>
15
+ <tr>
16
+ <th scope="row">
17
+ <label for=""><span class="dashicons dashicons-dashboard"></span> <?php _e('Status', $this->plugin_name); ?></label>
18
+ </th>
19
+ <td>
20
+ <fieldset>
21
+ <?php if( $this->get_current_protection() === true ) { ?>
22
+ <p class="valid"><span class="dashicons dashicons-lock"></span> <?php _e('Uploads directory is protected.', $this->plugin_name); ?></p>
23
+ <?php if( get_option( $this->plugin_name . '-protection') == 'remove' ) { ?>
24
+ <p class="valid note"><?php _e('Your uploads directory is <strong>already protected</strong> by an htaccess file or an Apache setting set for the whole website. You don\'t need extra protection.<br>The «remove option» behind will have no effect on the current protection.', $this->plugin_name); ?></p>
25
+ <?php } ?>
26
+ <?php } else { ?>
27
+ <p class="error"><span class="dashicons dashicons-shield"></span> <?php _e('Uploads directory is not protected!', $this->plugin_name); ?></p>
28
+ <?php } ?>
29
+ </fieldset>
30
+ </td>
31
+ </tr>
32
+ <tr>
33
+ <th scope="row">
34
+ <label for="size"><span class="dashicons dashicons-shield-alt"></span> <?php _e('Protection', $this->plugin_name); ?></label>
35
+ </th>
36
+ <td>
37
+ <fieldset>
38
+ <legend class="screen-reader-text">
39
+ <span><?php _e('Protection', $this->plugin_name); ?></span>
40
+ </legend>
41
+ <!-- -->
42
+ <label for="protection_1">
43
+ <input type="radio" value="index_php" name="protection" id="protection_1" <?php if( get_option( $this->plugin_name . '-protection') == 'index_php' ) { ?>checked<?php } ?>>
44
+ <strong><?php _e('add index file', $this->plugin_name); ?></strong>
45
+ <p class="description"><?php _e('This will create an index.php file on the root of your uploads directory. This simple trick will hide the content of your whole uploads directory.', $this->plugin_name); ?></p>
46
+ </label><br>
47
+ <!-- -->
48
+ <label for="protection_2">
49
+ <input type="radio" value="htaccess" name="protection" id="protection_2" <?php if( get_option( $this->plugin_name . '-protection') == 'htaccess' ) { ?>checked<?php } ?>>
50
+ <strong><?php _e('prevent directory listing with htaccess', $this->plugin_name); ?></strong>
51
+ <p class="description"><?php _e('Through the htaccess file, it will prevent people to browse your uploads directory and return a 403 code (Forbidden Access).', $this->plugin_name); ?></p>
52
+ </label><br>
53
+ <!-- -->
54
+ <label for="protection_3">
55
+ <input type="radio" value="remove" name="protection" id="protection_3" <?php if( get_option( $this->plugin_name . '-protection') == 'remove' || get_option( $this->plugin_name . '-protection') == '' ) { ?>checked<?php } ?>>
56
+ <strong><?php _e('remove protection or disabled protection', $this->plugin_name); ?></strong>
57
+ <p class="description"><?php _e('Your uploads directory is not protected.', $this->plugin_name); ?></p>
58
+ </label><br>
59
+ </fieldset>
60
+
61
+ </td>
62
+ </tr>
63
+ <tr>
64
+ <th scope="row">
65
+ <label for=""><span class="dashicons dashicons-visibility"></span> <?php _e('Check', $this->plugin_name); ?></label>
66
+ </th>
67
+ <td>
68
+ <p><?php _e('Visit your', $this->plugin_name); ?> <a href="<?php echo $this->get_uploads_url(); ?>" target="_blank"><?php _e('uploads directory', $this->plugin_name); ?></a> <?php _e('to check the current protection', $this->plugin_name); ?>.</p>
69
+ </td>
70
+ </tr>
71
+ <tr>
72
+ <th scope="row">
73
+ <label for=""><span class="dashicons dashicons-welcome-learn-more"></span> <?php _e('Support', $this->plugin_name); ?></label>
74
+ </th>
75
+ <td>
76
+ <p><?php _e('Protect Uploads Plugin <a href="http://www.alticreation.com/en/protect-uploads/" target="_blank">support page</a>.', $this->plugin_name); ?></p>
77
+ <p><?php _e('This plugin is compatible with the <span class="dashicons dashicons-awards"></span> <a href="http://www.alticreation.com/en/alti-watermark/" target="_blank">Watermark Plugin</a>.', $this->plugin_name); ?></p>
78
+ <p class="small"><?php _e('To do so, you have to: 1. Install the Watermark Plugin 2. Then choose your settings in this page and Update.', $this->plugin_name); ?></p>
79
+ </td>
80
+ </tr>
81
+ <tr>
82
+ <th scope="row">
83
+ </th>
84
+ <td>
85
+ <input type="submit" id="submit" value="<?php _e('Update', $this->plugin_name); ?>" name="submit" class="button button-primary">
86
+ </td>
87
+ </tr>
88
+ </tbody>
89
+ </table>
90
+
91
+ </form>
92
+ <div id="message" class="updated protect-uploads-footer">
93
+ <a class="logo" href="http://www.alticreation.com?plugin=protect-uploads"><img src="http://alticreation.com/logos/alticreation_color_01.png" alt="alticreation"></a>
94
+ <p><?php _e('Protect Uploads plugin is developped by', $this->plugin_name); ?> <a href="http://www.alticreation.com/en/profile">Alexis Blondin</a>.</p>
95
+ <div class="share">
96
+ <a href="http://www.alticreation.com?plugin=protect-uploads" target="_blank">alticreation.com</a>
97
+ <a href="https://plus.google.com/+AlexisBlondin" target="_blank">google&nbsp;+</a>
98
+ <a href="https://twitter.com/alticreation" target="_blank">twitter</a>
99
+ </div>
100
+ </div>
101
+ </div>
102
+
includes/class-protect-uploads-activator.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * fired on activation
4
+ */
5
+ class Alti_ProtectUploads_Activator extends Alti_ProtectUploads {
6
+
7
+ /**
8
+ * set option for plugin
9
+ */
10
+ public function run() {
11
+
12
+ if( !get_option( $this->get_plugin_name().'-protection' ) ) {
13
+ add_option( $this->get_plugin_name().'-protection', 'remove', '', 'yes' );
14
+ }
15
+ else {
16
+ update_option( $this->get_plugin_name().'-protection', 'remove' );
17
+ }
18
+
19
+ }
20
+
21
+ }
includes/class-protect-uploads-deactivator.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * triggered on deactivate
4
+ */
5
+ class Alti_ProtectUploads_Deactivator extends Alti_ProtectUploads_Admin {
6
+
7
+ public function run() {
8
+
9
+ $this->remove_index();
10
+ $this->remove_htaccess();
11
+
12
+ }
13
+
14
+ }
includes/class-protect-uploads-i18n.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Define the internationalization functionality
5
+ */
6
+ class Alti_ProtectUploads_i18n {
7
+
8
+ /**
9
+ * The domain specified for this plugin.
10
+ * @var string $domain The domain identifier for this plugin.
11
+ */
12
+ private $domain;
13
+
14
+ /**
15
+ * Load the plugin text domain for translation.
16
+ */
17
+ public function load_plugin_textdomain() {
18
+
19
+ load_plugin_textdomain(
20
+ $this->domain,
21
+ false,
22
+ dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
23
+ );
24
+
25
+ }
26
+
27
+ /**
28
+ * Set the domain equal to that of the specified domain.
29
+ * @param string $domain The domain that represents the locale of this plugin.
30
+ */
31
+ public function set_domain( $domain ) {
32
+ $this->domain = $domain;
33
+ }
34
+
35
+ }
includes/class-protect-uploads-loader.php ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Register all actions and filters for the plugin
5
+ * from : https://github.com/DevinVinson/WordPress-Plugin-Boilerplate
6
+ *
7
+ * Maintain a list of all hooks that are registered throughout
8
+ * the plugin, and register them with the WordPress API. Call the
9
+ * run function to execute the list of actions and filters.
10
+ */
11
+ class Alti_ProtectUploads_Loader {
12
+
13
+ /**
14
+ * The array of actions registered with WordPress.
15
+ * @var array $actions The actions registered with WordPress to fire when the plugin loads.
16
+ */
17
+ protected $actions;
18
+
19
+ /**
20
+ * The array of filters registered with WordPress.
21
+ * @var array $filters The filters registered with WordPress to fire when the plugin loads.
22
+ */
23
+ protected $filters;
24
+
25
+ /**
26
+ * Initialize the collections used to maintain the actions and filters.
27
+ */
28
+ public function __construct() {
29
+
30
+ $this->actions = array();
31
+ $this->filters = array();
32
+
33
+ }
34
+
35
+ /**
36
+ * Add a new action to the collection to be registered with WordPress.
37
+ * @param string $hook The name of the WordPress action that is being registered.
38
+ * @param object $component A reference to the instance of the object on which the action is defined.
39
+ * @param string $callback The name of the function definition on the $component.
40
+ * @param int Optional $priority The priority at which the function should be fired.
41
+ * @param int Optional $accepted_args The number of arguments that should be passed to the $callback.
42
+ */
43
+ public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
44
+ $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args );
45
+ }
46
+
47
+ /**
48
+ * Add a new filter to the collection to be registered with WordPress.
49
+ * @param string $hook The name of the WordPress filter that is being registered.
50
+ * @param object $component A reference to the instance of the object on which the filter is defined.
51
+ * @param string $callback The name of the function definition on the $component.
52
+ * @param int Optional $priority The priority at which the function should be fired.
53
+ * @param int Optional $accepted_args The number of arguments that should be passed to the $callback.
54
+ */
55
+ public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) {
56
+ $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args );
57
+ }
58
+
59
+ /**
60
+ * A utility function that is used to register the actions and hooks into a single
61
+ * collection.
62
+ * @param array $hooks The collection of hooks that is being registered (that is, actions or filters).
63
+ * @param string $hook The name of the WordPress filter that is being registered.
64
+ * @param object $component A reference to the instance of the object on which the filter is defined.
65
+ * @param string $callback The name of the function definition on the $component.
66
+ * @param int Optional $priority The priority at which the function should be fired.
67
+ * @param int Optional $accepted_args The number of arguments that should be passed to the $callback.
68
+ * @return type The collection of actions and filters registered with WordPress.
69
+ */
70
+ private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) {
71
+
72
+ $hooks[] = array(
73
+ 'hook' => $hook,
74
+ 'component' => $component,
75
+ 'callback' => $callback,
76
+ 'priority' => $priority,
77
+ 'accepted_args' => $accepted_args
78
+ );
79
+
80
+ return $hooks;
81
+
82
+ }
83
+
84
+ /**
85
+ * Register the filters and actions with WordPress.
86
+ */
87
+ public function run() {
88
+
89
+ foreach ( $this->filters as $hook ) {
90
+ add_filter( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
91
+ }
92
+
93
+ foreach ( $this->actions as $hook ) {
94
+ add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
95
+ }
96
+
97
+ }
98
+
99
+ }
includes/class-protect-uploads.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Alti_ProtectUploads {
4
+
5
+ protected $version;
6
+ protected $plugin_name;
7
+ protected $loader;
8
+
9
+ /**
10
+ * constructor
11
+ */
12
+ public function __construct() {
13
+
14
+ $this->version = '0.1';
15
+ $this->plugin_name = 'protect-uploads';
16
+
17
+ $this->load_dependencies();
18
+ $this->set_locale();
19
+ $this->define_admin_hooks();
20
+
21
+ }
22
+
23
+ /**
24
+ * load seperate files needed to trigger actions or filters, translation and admin class only since public class has to be autonomous.
25
+ */
26
+ private function load_dependencies() {
27
+
28
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-protect-uploads-loader.php';
29
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-protect-uploads-i18n.php';
30
+ require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-protect-uploads-admin.php';
31
+
32
+ $this->loader = new Alti_ProtectUploads_Loader();
33
+
34
+ }
35
+
36
+ /**
37
+ * set locale for translation ends.
38
+ */
39
+ private function set_locale() {
40
+
41
+ $plugin_i18n = new Alti_ProtectUploads_i18n();
42
+ $plugin_i18n->set_domain( $this->get_plugin_name() );
43
+
44
+ $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
45
+
46
+ }
47
+
48
+ /**
49
+ * action and filter for admin side
50
+ */
51
+ private function define_admin_hooks() {
52
+
53
+ $plugin_admin = new Alti_ProtectUploads_Admin( $this->get_plugin_name(), $this->get_version() );
54
+
55
+ $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_submenu_page' );
56
+ $this->loader->add_filter( 'plugin_action_links_' . $this->get_plugin_name() . '/' . $this->get_plugin_name() . '.php', $plugin_admin, 'add_settings_link' );
57
+ $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
58
+ $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
59
+
60
+ }
61
+
62
+ /**
63
+ * run the whole logic of the plugin
64
+ */
65
+ public function run() {
66
+ $this->loader->run();
67
+ }
68
+
69
+ /**
70
+ * get plugin name from constructor
71
+ * @return string plugin name
72
+ */
73
+ public function get_plugin_name() {
74
+ return $this->plugin_name;
75
+ }
76
+
77
+ /**
78
+ * get loader
79
+ */
80
+ public function get_loader() {
81
+ return $this->loader;
82
+ }
83
+
84
+ /**
85
+ * get version of plugin from constructor
86
+ * @return string current version
87
+ */
88
+ public function get_version() {
89
+ return $this->version;
90
+ }
91
+
92
+ }
includes/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
languages/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // Silence is golden
languages/protect-uploads-es_ES.mo ADDED
Binary file
languages/protect-uploads-es_ES.po ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: protect-uploads\n"
4
+ "POT-Creation-Date: 2015-04-01 15:38-0500\n"
5
+ "PO-Revision-Date: 2015-04-01 15:53-0500\n"
6
+ "Last-Translator: alticreation <alexis@alticreation.com>\n"
7
+ "Language-Team: alticreation <alexis@alticreation.com>\n"
8
+ "Language: es\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.6.11\n"
13
+ "X-Poedit-Basepath: ../\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "X-Poedit-KeywordsList: _;__;_e\n"
16
+ "X-Poedit-SourceCharset: UTF-8\n"
17
+ "X-Poedit-SearchPath-0: .\n"
18
+
19
+ #: admin/class-protect-uploads-admin.php:56
20
+ msgid "Settings"
21
+ msgstr "Ajustes"
22
+
23
+ #: admin/class-protect-uploads-admin.php:122
24
+ msgid "Impossible to create or modified the index.php file in "
25
+ msgstr "Imposible de crear o modificar el archivo index.php en"
26
+
27
+ #: admin/class-protect-uploads-admin.php:136
28
+ msgid ""
29
+ "The index.php file has been created in main folder and subfolders (two "
30
+ "levels max)."
31
+ msgstr ""
32
+ "El archivo index.php se ha creado en la carpeta principal de uploads y "
33
+ "subcarpetas (dos niveles max)."
34
+
35
+ #: admin/class-protect-uploads-admin.php:170
36
+ msgid "Impossible to create or modified the htaccess file."
37
+ msgstr "Imposible de crear o modificar el archivo .htaccess."
38
+
39
+ #: admin/class-protect-uploads-admin.php:179
40
+ msgid "The htaccess file has been created."
41
+ msgstr "El archivo .htaccess se ha creado."
42
+
43
+ #: admin/class-protect-uploads-admin.php:191
44
+ msgid "Existing htaccess has been updated."
45
+ msgstr "Htaccess existente se ha actualizado."
46
+
47
+ #: admin/class-protect-uploads-admin.php:221
48
+ msgid "The index.php file(s) have(has) been deleted."
49
+ msgstr "El(los) archivo(s) index.php ha(n) sido eliminado(s)."
50
+
51
+ #: admin/class-protect-uploads-admin.php:250
52
+ msgid "The htaccess file has been updated."
53
+ msgstr "El archivo .htaccess se ha actualizado."
54
+
55
+ #: admin/class-protect-uploads-admin.php:294
56
+ msgid ""
57
+ "The Protect Uploads plugin cannot work without Apache. Yourself or your web "
58
+ "host has to activate this module."
59
+ msgstr ""
60
+ "El plugin Protect Uploads no puede funcionar sin Apache. Usted o su "
61
+ "proveedor de alojamiento web tiene que activar este módulo."
62
+
63
+ #: admin/views/includes/protect-uploads-admin-message.php:7
64
+ msgid "Error code"
65
+ msgstr "Código de error"
66
+
67
+ #: admin/views/includes/protect-uploads-admin-message.php:7
68
+ msgid "Go to Protect Uploads documentation"
69
+ msgstr "Ir a la documentación de Protect Uploads"
70
+
71
+ #: admin/views/protect-uploads-admin-settings-page.php:9
72
+ msgid "by"
73
+ msgstr "por"
74
+
75
+ #: admin/views/protect-uploads-admin-settings-page.php:10
76
+ msgid ""
77
+ "Prevent users to browse your uploads directory. You'll protect your uploads "
78
+ "directory to be accessed and content stolen too easily in one batch."
79
+ msgstr ""
80
+ "Evita que los usuarios navigen directamente por el directorio de archivos. "
81
+ "Va a proteger su directorio de archivos y contenido no sera robado con "
82
+ "demasiada facilidad en un solo lote."
83
+
84
+ #: admin/views/protect-uploads-admin-settings-page.php:17
85
+ msgid "Status"
86
+ msgstr "Estado"
87
+
88
+ #: admin/views/protect-uploads-admin-settings-page.php:22
89
+ msgid "Uploads directory is protected."
90
+ msgstr "Directorio Uploads está protegida."
91
+
92
+ #: admin/views/protect-uploads-admin-settings-page.php:24
93
+ msgid ""
94
+ "Your uploads directory is <strong>already protected</strong> by an htaccess "
95
+ "file or an Apache setting set for the whole website. You don't need extra "
96
+ "protection.<br>The «remove option» behind will have no effect on the current "
97
+ "protection."
98
+ msgstr ""
99
+ "Su directorio de archivos está <strong> ya protegido </ strong> por un "
100
+ "archivo .htaccess o una configuración de Apache puesta para todo el sitio. "
101
+ "Usted no necesita protección adicional. <br> El «opción quitar» aqui abajo "
102
+ "no tendrá ningún efecto sobre la protección actual."
103
+
104
+ #: admin/views/protect-uploads-admin-settings-page.php:27
105
+ msgid "Uploads directory is not protected!"
106
+ msgstr "Directorio de Uploads no está protegido!"
107
+
108
+ #: admin/views/protect-uploads-admin-settings-page.php:34
109
+ #: admin/views/protect-uploads-admin-settings-page.php:39
110
+ msgid "Protection"
111
+ msgstr "Protección"
112
+
113
+ #: admin/views/protect-uploads-admin-settings-page.php:44
114
+ msgid "add index file"
115
+ msgstr "añadir archivo index"
116
+
117
+ #: admin/views/protect-uploads-admin-settings-page.php:45
118
+ msgid ""
119
+ "This will create an index.php file on the root of your uploads directory. "
120
+ "This simple trick will hide the content of your whole uploads directory."
121
+ msgstr ""
122
+ "Esto creará un archivo index.php en la raíz del directorio de los archivos "
123
+ "subidos. Este sencillo truco ocultará el contenido de todo su directorio "
124
+ "uploads."
125
+
126
+ #: admin/views/protect-uploads-admin-settings-page.php:50
127
+ msgid "prevent directory listing with htaccess"
128
+ msgstr "previene la navegacion en el directorio de Uploads con htaccess"
129
+
130
+ #: admin/views/protect-uploads-admin-settings-page.php:51
131
+ msgid ""
132
+ "Through the htaccess file, it will prevent people to browse your uploads "
133
+ "directory and return a 403 code (Forbidden Access)."
134
+ msgstr ""
135
+ "Mediante el archivo .htaccess, se evitará que la gente navega en el "
136
+ "directorio de archivos y devuelve un código 403 (Acceso prohibido)."
137
+
138
+ #: admin/views/protect-uploads-admin-settings-page.php:56
139
+ msgid "remove protection or disabled protection"
140
+ msgstr "eliminar la protección o desactivar la protección"
141
+
142
+ #: admin/views/protect-uploads-admin-settings-page.php:57
143
+ msgid "Your uploads directory is not protected."
144
+ msgstr "El directorio Uploads no está protegido."
145
+
146
+ #: admin/views/protect-uploads-admin-settings-page.php:65
147
+ msgid "Check"
148
+ msgstr "Comprobar"
149
+
150
+ #: admin/views/protect-uploads-admin-settings-page.php:68
151
+ msgid "Visit your"
152
+ msgstr "Visite a su"
153
+
154
+ #: admin/views/protect-uploads-admin-settings-page.php:68
155
+ msgid "uploads directory"
156
+ msgstr "directorio de uploads"
157
+
158
+ #: admin/views/protect-uploads-admin-settings-page.php:68
159
+ msgid "to check the current protection"
160
+ msgstr "para comprobar la protección actual"
161
+
162
+ #: admin/views/protect-uploads-admin-settings-page.php:73
163
+ msgid "Support"
164
+ msgstr "Ayuda"
165
+
166
+ #: admin/views/protect-uploads-admin-settings-page.php:76
167
+ msgid ""
168
+ "Protect Uploads Plugin <a href=\"http://www.alticreation.com/en/protect-"
169
+ "uploads/\" target=\"_blank\">support page</a>."
170
+ msgstr ""
171
+ "Ver la <a href=\"http://www.alticreation.com/en/protect-uploads/\" target="
172
+ "\"_blank\">pagina de ayuda</a> del plugin."
173
+
174
+ #: admin/views/protect-uploads-admin-settings-page.php:77
175
+ msgid ""
176
+ "This plugin is compatible with the <span class=\"dashicons dashicons-awards"
177
+ "\"></span> <a href=\"http://www.alticreation.com/en/alti-watermark/\" target="
178
+ "\"_blank\">Watermark Plugin</a>."
179
+ msgstr ""
180
+ "Este plugin es compatible con el <span class=\"dashicons dashicons-premios "
181
+ "\"></ span> <a href=\"http: //www.alticreation.com/en/alti-watermark/ \" "
182
+ "target =\"_blank \"> Plugin Marca de agua </a>."
183
+
184
+ #: admin/views/protect-uploads-admin-settings-page.php:78
185
+ msgid ""
186
+ "To do so, you have to: 1. Install the Watermark Plugin 2. Then choose your "
187
+ "settings in this page and Update."
188
+ msgstr ""
189
+ "Por eso, usted tiene que: 1. Instalar el Watermark Plugin 2. Seleccione la "
190
+ "configuración en esta página y actualizar."
191
+
192
+ #: admin/views/protect-uploads-admin-settings-page.php:85
193
+ msgid "Update"
194
+ msgstr "Actualizar"
195
+
196
+ #: admin/views/protect-uploads-admin-settings-page.php:94
197
+ msgid "Protect Uploads plugin is developped by"
198
+ msgstr "El Plugin Protect Uploads está desarrollado por"
languages/protect-uploads-fr_FR.mo ADDED
Binary file
languages/protect-uploads-fr_FR.po ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: alti-protect-uplodas\n"
4
+ "POT-Creation-Date: 2015-04-01 15:34-0500\n"
5
+ "PO-Revision-Date: 2015-04-01 15:36-0500\n"
6
+ "Last-Translator: alticreation <alexis@alticreation.com>\n"
7
+ "Language-Team: alticreation <alexis@alticreation.com>\n"
8
+ "Language: fr\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.6.11\n"
13
+ "X-Poedit-Basepath: ../\n"
14
+ "Plural-Forms: nplurals=2; plural=(n > 1);\n"
15
+ "X-Poedit-KeywordsList: __;_e;_\n"
16
+ "X-Poedit-SourceCharset: UTF-8\n"
17
+ "X-Poedit-SearchPath-0: .\n"
18
+
19
+ #: admin/class-protect-uploads-admin.php:56
20
+ msgid "Settings"
21
+ msgstr "Réglages"
22
+
23
+ #: admin/class-protect-uploads-admin.php:122
24
+ msgid "Impossible to create or modified the index.php file in "
25
+ msgstr "Il est impossible de créer ou modifier le fichier index.php dans "
26
+
27
+ #: admin/class-protect-uploads-admin.php:136
28
+ msgid ""
29
+ "The index.php file has been created in main folder and subfolders (two "
30
+ "levels max)."
31
+ msgstr ""
32
+ "Le fichier index.php a été créé dans le dossier principal des uploads ainsi "
33
+ "que dans les sous-dossiers (jusqu'à deux niveaux)."
34
+
35
+ #: admin/class-protect-uploads-admin.php:170
36
+ msgid "Impossible to create or modified the htaccess file."
37
+ msgstr "Impossible de créer ou modifier le fichier htaccess."
38
+
39
+ #: admin/class-protect-uploads-admin.php:179
40
+ msgid "The htaccess file has been created."
41
+ msgstr "Le fichier htaccess a été créé."
42
+
43
+ #: admin/class-protect-uploads-admin.php:191
44
+ msgid "Existing htaccess has been updated."
45
+ msgstr "Le fichier htaccess préexistant a été mis à jour."
46
+
47
+ #: admin/class-protect-uploads-admin.php:221
48
+ msgid "The index.php file(s) have(has) been deleted."
49
+ msgstr "Le(s) fichier(s) index.php a (ont) été(s) supprimé(s)."
50
+
51
+ #: admin/class-protect-uploads-admin.php:250
52
+ msgid "The htaccess file has been updated."
53
+ msgstr "Le fichier htaccess a été mis à jour."
54
+
55
+ #: admin/class-protect-uploads-admin.php:294
56
+ msgid ""
57
+ "The Protect Uploads plugin cannot work without Apache. Yourself or your web "
58
+ "host has to activate this module."
59
+ msgstr ""
60
+ "L'extension «Protect Uploads» ne peut pas fonctionner sans APache. Vous-même "
61
+ "ou votre hébergeur web doit active ce module."
62
+
63
+ #: admin/views/includes/protect-uploads-admin-message.php:7
64
+ msgid "Error code"
65
+ msgstr "Code erreur"
66
+
67
+ #: admin/views/includes/protect-uploads-admin-message.php:7
68
+ msgid "Go to Protect Uploads documentation"
69
+ msgstr "Aller à la documentation de Protect Uploads"
70
+
71
+ #: admin/views/protect-uploads-admin-settings-page.php:9
72
+ msgid "by"
73
+ msgstr "par"
74
+
75
+ #: admin/views/protect-uploads-admin-settings-page.php:10
76
+ msgid ""
77
+ "Prevent users to browse your uploads directory. You'll protect your uploads "
78
+ "directory to be accessed and content stolen too easily in one batch."
79
+ msgstr ""
80
+ "Empêche les utilisateurs de lister le contenu de votre repertoire uploads. "
81
+ "Vous protégerez votre répertoire uploads. Il ne sera pas accessible et le "
82
+ "contenu ne pourra pas être voler."
83
+
84
+ #: admin/views/protect-uploads-admin-settings-page.php:17
85
+ msgid "Status"
86
+ msgstr "Statut"
87
+
88
+ #: admin/views/protect-uploads-admin-settings-page.php:22
89
+ msgid "Uploads directory is protected."
90
+ msgstr "Le repertoire Uploads est protégé."
91
+
92
+ #: admin/views/protect-uploads-admin-settings-page.php:24
93
+ msgid ""
94
+ "Your uploads directory is <strong>already protected</strong> by an htaccess "
95
+ "file or an Apache setting set for the whole website. You don't need extra "
96
+ "protection.<br>The «remove option» behind will have no effect on the current "
97
+ "protection."
98
+ msgstr ""
99
+ "Votre répertoir Uploads est déjà protégé par un fichier htaccess ou par un "
100
+ "réglage Apache défini pour l'ensemble du site. Vous n'avez pas besoin de "
101
+ "protection supplémentaire.<br>L'option «supprimer» ci-dessous n'aura pas "
102
+ "d'effet sur la protection actuelle."
103
+
104
+ #: admin/views/protect-uploads-admin-settings-page.php:27
105
+ msgid "Uploads directory is not protected!"
106
+ msgstr "Le repertoire Uploads n'est pas protégé !"
107
+
108
+ #: admin/views/protect-uploads-admin-settings-page.php:34
109
+ #: admin/views/protect-uploads-admin-settings-page.php:39
110
+ msgid "Protection"
111
+ msgstr "Protection"
112
+
113
+ #: admin/views/protect-uploads-admin-settings-page.php:44
114
+ msgid "add index file"
115
+ msgstr "ajouter un fichier index"
116
+
117
+ #: admin/views/protect-uploads-admin-settings-page.php:45
118
+ msgid ""
119
+ "This will create an index.php file on the root of your uploads directory. "
120
+ "This simple trick will hide the content of your whole uploads directory."
121
+ msgstr ""
122
+ "Ceci créera un fichier index.php à la racine du repertoire Uploads. Cette "
123
+ "simple manipulation cachera le contenu de tout votre repertoire Uploads."
124
+
125
+ #: admin/views/protect-uploads-admin-settings-page.php:50
126
+ msgid "prevent directory listing with htaccess"
127
+ msgstr "Empêcher le listage du repertoire Uploads avec htaccess"
128
+
129
+ #: admin/views/protect-uploads-admin-settings-page.php:51
130
+ msgid ""
131
+ "Through the htaccess file, it will prevent people to browse your uploads "
132
+ "directory and return a 403 code (Forbidden Access)."
133
+ msgstr ""
134
+ "Via le fichier htaccess, les utilisateurs ne pourront pas naviguer dans les "
135
+ "repertoires Uploads librement et ceci retournera un code 403 (Accès "
136
+ "Interdit)."
137
+
138
+ #: admin/views/protect-uploads-admin-settings-page.php:56
139
+ msgid "remove protection or disabled protection"
140
+ msgstr "enlever la protection ou protection désactivée"
141
+
142
+ #: admin/views/protect-uploads-admin-settings-page.php:57
143
+ msgid "Your uploads directory is not protected."
144
+ msgstr "Votre repertoire Uploads n'est pas protégé."
145
+
146
+ #: admin/views/protect-uploads-admin-settings-page.php:65
147
+ msgid "Check"
148
+ msgstr "Contrôle"
149
+
150
+ #: admin/views/protect-uploads-admin-settings-page.php:68
151
+ msgid "Visit your"
152
+ msgstr "Visitez votre"
153
+
154
+ #: admin/views/protect-uploads-admin-settings-page.php:68
155
+ msgid "uploads directory"
156
+ msgstr "repertoire Uploads"
157
+
158
+ #: admin/views/protect-uploads-admin-settings-page.php:68
159
+ msgid "to check the current protection"
160
+ msgstr "pour verifier la protection actuelle."
161
+
162
+ #: admin/views/protect-uploads-admin-settings-page.php:73
163
+ msgid "Support"
164
+ msgstr "Support"
165
+
166
+ #: admin/views/protect-uploads-admin-settings-page.php:76
167
+ msgid ""
168
+ "Protect Uploads Plugin <a href=\"http://www.alticreation.com/en/protect-"
169
+ "uploads/\" target=\"_blank\">support page</a>."
170
+ msgstr ""
171
+ "<a href=\"http://www.alticreation.com/en/alti-protect-uploads/\" target="
172
+ "\"_blank\">Page de support</a> de l'extension Protect Uploads."
173
+
174
+ #: admin/views/protect-uploads-admin-settings-page.php:77
175
+ msgid ""
176
+ "This plugin is compatible with the <span class=\"dashicons dashicons-awards"
177
+ "\"></span> <a href=\"http://www.alticreation.com/en/alti-watermark/\" target="
178
+ "\"_blank\">Watermark Plugin</a>."
179
+ msgstr ""
180
+ "Cette extension est compatible avec <span class=\"dashicons dashicons-awards"
181
+ "\"></span> <a href=\"http://www.alticreation.com/en/alti-watermark/\" target="
182
+ "\"_blank\">l'extension Watermark</a>."
183
+
184
+ #: admin/views/protect-uploads-admin-settings-page.php:78
185
+ msgid ""
186
+ "To do so, you have to: 1. Install the Watermark Plugin 2. Then choose your "
187
+ "settings in this page and Update."
188
+ msgstr ""
189
+ "Pour faire cela, vous devez : 1. Installer l'extension Watermark 2. Ensuite "
190
+ "choisir vos réglages dans cette page puis Mettre à jour."
191
+
192
+ #: admin/views/protect-uploads-admin-settings-page.php:85
193
+ msgid "Update"
194
+ msgstr "Mettre à jour"
195
+
196
+ #: admin/views/protect-uploads-admin-settings-page.php:94
197
+ msgid "Protect Uploads plugin is developped by"
198
+ msgstr "L'extension Protect Uploads est développé par"
protect-uploads.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: Protect Uploads
4
+ * Plugin URI: http://www.alticreation.com/en/protect-uploads/
5
+ * Description: Protect your uploads directory. Avoid browsing of your uploads directory by adding a htaccess file or an index.php file.
6
+ * Version: 0.1
7
+ * Author: Alexis Blondin
8
+ * Author URI: http://www.alticreation.com
9
+ * License: GPL-2.0+
10
+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
11
+ * Text Domain: protect-uploads
12
+ * Domain Path: /languages
13
+ */
14
+
15
+ // If this file is called directly, abort.
16
+ if ( ! defined( 'WPINC' ) ) {
17
+ die;
18
+ }
19
+
20
+ function activate_alti_protect_uploads() {
21
+
22
+ require_once plugin_dir_path( __FILE__ ) . 'includes/class-protect-uploads.php';
23
+ require_once plugin_dir_path( __FILE__ ) . 'includes/class-protect-uploads-activator.php';
24
+ $activation = new Alti_ProtectUploads_Activator();
25
+ $activation->run();
26
+
27
+ }
28
+
29
+ function deactivate_alti_protect_uploads() {
30
+
31
+ require_once plugin_dir_path( __FILE__ ) . 'admin/class-protect-uploads-admin.php';
32
+ require_once plugin_dir_path( __FILE__ ) . 'includes/class-protect-uploads-deactivator.php';
33
+ $deactivation = new Alti_ProtectUploads_Deactivator();
34
+ $deactivation->run();
35
+
36
+ }
37
+
38
+ register_activation_hook( __FILE__, 'activate_alti_protect_uploads' );
39
+ register_deactivation_hook( __FILE__, 'deactivate_alti_protect_uploads' );
40
+
41
+ require plugin_dir_path( __FILE__ ) . 'includes/class-protect-uploads.php';
42
+
43
+ $plugin = new Alti_ProtectUploads();
44
+ $plugin->run();
readme.txt ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Protect uploads ===
2
+ Contributors: alticreation
3
+ Donate link: http://www.alticreation.com/en/protect-uploads/
4
+ Tags: uploads, protection, images protection, browsing images, uploads folder, image folder, avoid browsing folder, hide uploads, prevent uploads browsing, prevent images browsing, protect library, library
5
+ Requires at least: 3.0.1
6
+ Tested up to: 4.1.1
7
+ Stable tag: 0.1
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Protect your uploads directory to people who want to browse it. Avoid browsing of your uploads directory by adding a htaccess or index.php file.
12
+
13
+ == Description ==
14
+
15
+ The uploads directory is where the files of the WordPress library are stored. Unfortunelty, this directory is not protected. A person who wants to see all your library could list it instantly going to : http://yourwebsite/wp-content/uploads . This plugin will hide the content by adding an index.php file on the root of your uploads directory or by setting an htaccess which will return a 403 error (Forbidden Access).
16
+
17
+ * Depending on your server setting, the htaccess option could be disabled.
18
+
19
+ Available languages :
20
+
21
+ * English
22
+ * Français
23
+ * Español
24
+
25
+ For support, please visit [protect uploads plugin](http://www.alticreation.com/en/protect-uploads/ "protect uploads plugin for Wordpress by alticreation")
26
+
27
+ == Installation ==
28
+
29
+ 1. Upload `protect-uploads` folder to the `/wp-content/plugins/` directory
30
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
31
+
32
+ Note : GD library is needed and being able to create a .htaccess file in uploads directory.
33
+
34
+ == Frequently Asked Questions ==
35
+
36
+ = Support =
37
+ You can ask question and read documentation at [protect uploads plugin](http://www.alticreation.com/en/protect-uploads/ "protect uploads plugin for Wordpress by alticreation")
38
+
39
+ == Screenshots ==
40
+
41
+ 1. Administration Page for the plugin.
42
+
43
+ == Upgrade Notice ==
44
+
45
+ Nothing for now
46
+
47
+ == Changelog ==
48
+
49
+ = 0.1 =
50
+ * Initial release
uninstall.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Fired when the plugin is uninstalled.
5
+ *
6
+ * When populating this file, consider the following flow
7
+ * of control:
8
+ *
9
+ * - This method should be static
10
+ * - Check if the $_REQUEST content actually is the plugin name
11
+ * - Run an admin referrer check to make sure it goes through authentication
12
+ * - Verify the output of $_GET makes sense
13
+ * - Repeat with other user roles. Best directly by using the links/query string parameters.
14
+ * - Repeat things for multisite. Once for a single site in the network, once sitewide.
15
+ *
16
+ * This file may be updated more in future version of the Boilerplate; however, this is the
17
+ * general skeleton and outline for how the file should work.
18
+ *
19
+ * For more information, see the following discussion:
20
+ * https://github.com/tommcfarlin/WordPress-Plugin-Boilerplate/pull/123#issuecomment-28541913
21
+ *
22
+ * @link http://example.com
23
+ * @since 1.0.0
24
+ *
25
+ * @package Plugin_Name
26
+ */
27
+
28
+ // If uninstall not called from WordPress, then exit.
29
+ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
30
+ exit;
31
+ }
32
+
33
+ class Alti_ProtectUploads_Uninstall {
34
+
35
+ public static function run() {
36
+ $plugin_name = 'protect-uploads';
37
+ if( is_admin()) delete_option( $plugin_name . '-protection' );
38
+ }
39
+
40
+
41
+
42
+ }
43
+
44
+ Alti_ProtectUploads_Uninstall::run();