WP Crontrol - Version 0.3

Version Description

Download this release

Release Info

Developer scompt
Plugin Icon 128x128 WP Crontrol
Version 0.3
Comparing to
See all releases

Code changes from version 0.1 to 0.3

COPYING ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 Library 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
gettext/crontrol-de_DE.mo ADDED
Binary file
gettext/crontrol-de_DE.po ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # German translations for PACKAGE package
2
+ # German messages for PACKAGE.
3
+ # Copyright (C) 2008 THE PACKAGE'S COPYRIGHT HOLDER
4
+ # This file is distributed under the same license as the PACKAGE package.
5
+ # Edward Dale <>, 2008.
6
+ #
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: PACKAGE VERSION\n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2008-04-25 17:22+0200\n"
12
+ "PO-Revision-Date: 2008-04-25 17:27+0200\n"
13
+ "Last-Translator: Edward Dale <>\n"
14
+ "Language-Team: German\n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=UTF-8\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
+
20
+ #: wp-crontrol.php:102 wp-crontrol.php:111
21
+ msgid "You are not allowed to add new cron events."
22
+ msgstr ""
23
+
24
+ #: wp-crontrol.php:122
25
+ msgid "You are not allowed to add new cron schedules."
26
+ msgstr ""
27
+
28
+ #: wp-crontrol.php:147
29
+ msgid "You are not allowed to delete cron schedules."
30
+ msgstr ""
31
+
32
+ #: wp-crontrol.php:154
33
+ msgid "You are not allowed to delete cron events."
34
+ msgstr ""
35
+
36
+ #: wp-crontrol.php:161
37
+ msgid "You are not allowed to run cron events."
38
+ msgstr ""
39
+
40
+ #: wp-crontrol.php:218
41
+ msgid "Twice Daily"
42
+ msgstr ""
43
+
44
+ #: wp-crontrol.php:258
45
+ msgid "Successfully deleted the cron schedule <b>%s</b>"
46
+ msgstr "Cron Zeitplan <b>%s</b> erfolgreich gel&ouml;scht"
47
+
48
+ #: wp-crontrol.php:269
49
+ msgid "Cron Schedules"
50
+ msgstr "Cron Zeitpl&auml;ne"
51
+
52
+ #: wp-crontrol.php:270
53
+ msgid ""
54
+ "Cron schedules are the time intervals that are available to WordPress and "
55
+ "plugin developers to schedule events. You can only delete cron schedules "
56
+ "that you have created with WP-Crontrol."
57
+ msgstr ""
58
+
59
+ #: wp-crontrol.php:275
60
+ msgid "Name"
61
+ msgstr "Name"
62
+
63
+ #: wp-crontrol.php:276 wp-crontrol.php:311
64
+ msgid "Interval"
65
+ msgstr "Intervall"
66
+
67
+ #: wp-crontrol.php:277
68
+ msgid "Display Name"
69
+ msgstr ""
70
+
71
+ #: wp-crontrol.php:278 wp-crontrol.php:354
72
+ msgid "Actions"
73
+ msgstr ""
74
+
75
+ #: wp-crontrol.php:301
76
+ msgid "Add new cron schedule"
77
+ msgstr ""
78
+
79
+ #: wp-crontrol.php:302
80
+ msgid ""
81
+ "Adding a new cron schedule will allow you to schedule events that re-occur "
82
+ "at the given interval."
83
+ msgstr ""
84
+
85
+ #: wp-crontrol.php:307
86
+ msgid "Internal name"
87
+ msgstr ""
88
+
89
+ #: wp-crontrol.php:315
90
+ msgid "Display name"
91
+ msgstr ""
92
+
93
+ #: wp-crontrol.php:319
94
+ msgid "Add Cron Schedule &raquo;"
95
+ msgstr ""
96
+
97
+ #: wp-crontrol.php:331
98
+ msgid "Successfully executed the cron entry <b>%s</b>"
99
+ msgstr "Cron Eintrag <b>%s</b> erfolgreich ausgef&uuml;hrt"
100
+
101
+ #: wp-crontrol.php:332
102
+ msgid "Successfully edited the cron entry <b>%s</b>"
103
+ msgstr "Cron Eintrag <b>%s</b> erfolgreich bearbeitet"
104
+
105
+ #: wp-crontrol.php:333
106
+ msgid "Successfully created the cron entry <b>%s</b>"
107
+ msgstr "Cron Eintrag <b>%s</b> erfolgreich geschaffen"
108
+
109
+ #: wp-crontrol.php:334
110
+ msgid "Successfully deleted the cron entry <b>%s</b>"
111
+ msgstr "Cron Eintrag <b>%s</b> erfolgreich gel&ouml;scht"
112
+
113
+ #: wp-crontrol.php:345
114
+ msgid "WP-Cron Entries"
115
+ msgstr "WP-Cron Eintr&auml;ge"
116
+
117
+ #: wp-crontrol.php:351
118
+ msgid "Hook Name"
119
+ msgstr ""
120
+
121
+ #: wp-crontrol.php:352
122
+ msgid "Next Run"
123
+ msgstr ""
124
+
125
+ #: wp-crontrol.php:353
126
+ msgid "Recurrence"
127
+ msgstr ""
128
+
129
+ #: wp-crontrol.php:386
130
+ msgid "Edit cron entry"
131
+ msgstr ""
132
+
133
+ #: wp-crontrol.php:386
134
+ msgid "Add new"
135
+ msgstr ""
136
+
137
+ #: wp-crontrol.php:392 wp-crontrol.php:422
138
+ msgid "Hook name"
139
+ msgstr ""
140
+
141
+ #: wp-crontrol.php:395 wp-crontrol.php:425
142
+ msgid "Next run"
143
+ msgstr ""
144
+
145
+ #: wp-crontrol.php:398 wp-crontrol.php:428
146
+ msgid "Entry schedule"
147
+ msgstr ""
148
+
149
+ #: wp-crontrol.php:411
150
+ msgid "Modify Cron Entry &raquo;"
151
+ msgstr ""
152
+
153
+ #: wp-crontrol.php:416
154
+ msgid "Add new cron entry"
155
+ msgstr ""
156
+
157
+ #: wp-crontrol.php:417
158
+ msgid ""
159
+ "Cron entries trigger actions in your code. After adding a new cron entry "
160
+ "here, you will need to add a corresponding action hook somewhere in code, "
161
+ "perhaps the <code>functions.php</code> file in your theme."
162
+ msgstr ""
163
+
164
+ #: wp-crontrol.php:440
165
+ msgid "Add Cron Entry &raquo;"
166
+ msgstr ""
167
+
168
+ #: wp-crontrol.php:471
169
+ msgid "now"
170
+ msgstr "jetzt"
gettext/crontrol.pot ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: PACKAGE VERSION\n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2008-04-25 17:22+0200\n"
12
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=CHARSET\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+
19
+ #: wp-crontrol.php:102 wp-crontrol.php:111
20
+ msgid "You are not allowed to add new cron events."
21
+ msgstr ""
22
+
23
+ #: wp-crontrol.php:122
24
+ msgid "You are not allowed to add new cron schedules."
25
+ msgstr ""
26
+
27
+ #: wp-crontrol.php:147
28
+ msgid "You are not allowed to delete cron schedules."
29
+ msgstr ""
30
+
31
+ #: wp-crontrol.php:154
32
+ msgid "You are not allowed to delete cron events."
33
+ msgstr ""
34
+
35
+ #: wp-crontrol.php:161
36
+ msgid "You are not allowed to run cron events."
37
+ msgstr ""
38
+
39
+ #: wp-crontrol.php:218
40
+ msgid "Twice Daily"
41
+ msgstr ""
42
+
43
+ #: wp-crontrol.php:258
44
+ #, possible-php-format
45
+ msgid "Successfully deleted the cron schedule <b>%s</b>"
46
+ msgstr ""
47
+
48
+ #: wp-crontrol.php:269
49
+ msgid "Cron Schedules"
50
+ msgstr ""
51
+
52
+ #: wp-crontrol.php:270
53
+ msgid ""
54
+ "Cron schedules are the time intervals that are available to WordPress and "
55
+ "plugin developers to schedule events. You can only delete cron schedules "
56
+ "that you have created with WP-Crontrol."
57
+ msgstr ""
58
+
59
+ #: wp-crontrol.php:275
60
+ msgid "Name"
61
+ msgstr ""
62
+
63
+ #: wp-crontrol.php:276 wp-crontrol.php:311
64
+ msgid "Interval"
65
+ msgstr ""
66
+
67
+ #: wp-crontrol.php:277
68
+ msgid "Display Name"
69
+ msgstr ""
70
+
71
+ #: wp-crontrol.php:278 wp-crontrol.php:354
72
+ msgid "Actions"
73
+ msgstr ""
74
+
75
+ #: wp-crontrol.php:301
76
+ msgid "Add new cron schedule"
77
+ msgstr ""
78
+
79
+ #: wp-crontrol.php:302
80
+ msgid ""
81
+ "Adding a new cron schedule will allow you to schedule events that re-occur "
82
+ "at the given interval."
83
+ msgstr ""
84
+
85
+ #: wp-crontrol.php:307
86
+ msgid "Internal name"
87
+ msgstr ""
88
+
89
+ #: wp-crontrol.php:315
90
+ msgid "Display name"
91
+ msgstr ""
92
+
93
+ #: wp-crontrol.php:319
94
+ msgid "Add Cron Schedule &raquo;"
95
+ msgstr ""
96
+
97
+ #: wp-crontrol.php:331
98
+ #, possible-php-format
99
+ msgid "Successfully executed the cron entry <b>%s</b>"
100
+ msgstr ""
101
+
102
+ #: wp-crontrol.php:332
103
+ #, possible-php-format
104
+ msgid "Successfully edited the cron entry <b>%s</b>"
105
+ msgstr ""
106
+
107
+ #: wp-crontrol.php:333
108
+ #, possible-php-format
109
+ msgid "Successfully created the cron entry <b>%s</b>"
110
+ msgstr ""
111
+
112
+ #: wp-crontrol.php:334
113
+ #, possible-php-format
114
+ msgid "Successfully deleted the cron entry <b>%s</b>"
115
+ msgstr ""
116
+
117
+ #: wp-crontrol.php:345
118
+ msgid "WP-Cron Entries"
119
+ msgstr ""
120
+
121
+ #: wp-crontrol.php:351
122
+ msgid "Hook Name"
123
+ msgstr ""
124
+
125
+ #: wp-crontrol.php:352
126
+ msgid "Next Run"
127
+ msgstr ""
128
+
129
+ #: wp-crontrol.php:353
130
+ msgid "Recurrence"
131
+ msgstr ""
132
+
133
+ #: wp-crontrol.php:386
134
+ msgid "Edit cron entry"
135
+ msgstr ""
136
+
137
+ #: wp-crontrol.php:386
138
+ msgid "Add new"
139
+ msgstr ""
140
+
141
+ #: wp-crontrol.php:392 wp-crontrol.php:422
142
+ msgid "Hook name"
143
+ msgstr ""
144
+
145
+ #: wp-crontrol.php:395 wp-crontrol.php:425
146
+ msgid "Next run"
147
+ msgstr ""
148
+
149
+ #: wp-crontrol.php:398 wp-crontrol.php:428
150
+ msgid "Entry schedule"
151
+ msgstr ""
152
+
153
+ #: wp-crontrol.php:411
154
+ msgid "Modify Cron Entry &raquo;"
155
+ msgstr ""
156
+
157
+ #: wp-crontrol.php:416
158
+ msgid "Add new cron entry"
159
+ msgstr ""
160
+
161
+ #: wp-crontrol.php:417
162
+ msgid ""
163
+ "Cron entries trigger actions in your code. After adding a new cron entry "
164
+ "here, you will need to add a corresponding action hook somewhere in code, "
165
+ "perhaps the <code>functions.php</code> file in your theme."
166
+ msgstr ""
167
+
168
+ #: wp-crontrol.php:440
169
+ msgid "Add Cron Entry &raquo;"
170
+ msgstr ""
171
+
172
+ #: wp-crontrol.php:471
173
+ msgid "now"
174
+ msgstr ""
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === WP-Crontrol ===
2
  Contributors: scompt
3
  Donate link: http://scompt.com/projects/wp-crontrol
4
- Tags: admin, cron
5
  Requires at least: 2.1
6
- Tested up to: 2.3
7
- Stable tag: trunk
8
 
9
  WP-Crontrol lets you take control over what's happening in the WP-Cron system.
10
 
@@ -14,26 +14,74 @@ WP-Crontrol lets you take control over what's happening in the WP-Cron system.
14
 
15
  == Installation ==
16
 
17
- 1. Upload the `zensor` directory to the `/wp-content/plugins/` directory
18
  1. Activate the plugin through the 'Plugins' menu in WordPress
19
- 1. Goto the Manage->Zensor panel and Approve/Reject the existing posts and pages
 
20
 
21
  == Frequently Asked Questions ==
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  = How do I ask a frequently asked question? =
24
 
25
- Email me.
26
 
27
  == Screenshots ==
28
 
29
- 1. None yet
 
30
 
31
  == Future Plans ==
32
 
33
- * Make better
 
 
 
34
 
35
  == Version History ==
36
 
37
  = Version 0.1 =
38
 
39
- * Super basic, look at what's in WP-Cron functionality.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  === WP-Crontrol ===
2
  Contributors: scompt
3
  Donate link: http://scompt.com/projects/wp-crontrol
4
+ Tags: admin, cron, plugin, control
5
  Requires at least: 2.1
6
+ Tested up to: 2.5
7
+ Stable tag: 0.3
8
 
9
  WP-Crontrol lets you take control over what's happening in the WP-Cron system.
10
 
14
 
15
  == Installation ==
16
 
17
+ 1. Upload the `wp-crontrol` directory to the `/wp-content/plugins/` directory
18
  1. Activate the plugin through the 'Plugins' menu in WordPress
19
+ 1. Goto the Options->Crontrol panel to add some new cron schedules.
20
+ 1. Goto the Manage->Crontrol panel to see what cron entries are scheduled and to add some new ones.
21
 
22
  == Frequently Asked Questions ==
23
 
24
+ = What's the use of adding new cron schedules? =
25
+
26
+ Cron schedules are used by WordPress and WordPress plugins to allow you to schedule commands to be executed at regular intervals. Intervals must be provided by the WordPress core or a plugin in order to be used. An example of a plugin that uses these schedules is [WordPress Database Backup](http://www.ilfilosofo.com/blog/wp-db-backup/). Out of the box, only daily and hourly backups are supported. In order to do a weekly backup, a weekly cron schedule must be entered into WP-Crontrol first and then the backup plugin can take advantage of it as an interval.
27
+
28
+ = How do I create a new cron entry? =
29
+
30
+ There are two steps to getting a functioning cron entry that executes regularly. The first step is telling WordPress about the hook. This is the part that WP-Crontrol was created to provide. The second step is calling your function when your hook is executed. You've got to do that on your own, but I'll explain how below.
31
+
32
+ *Step One: Adding the hook*
33
+
34
+ In the Manage->Crontrol admin panel, enter the details of the hook. You're best off having a hookname that conforms to normal PHP variable naming conventions. This could save you trouble later. Other than that, the hookname can be whatever you want it to be. Next run is the next time that the hook will execute. This can be entered in using [GNU Date Input Formats](http://www.gnu.org/software/tar/manual/html_node/tar_113.html), but often *now* is good enough. The entry schedule is how often your hook will be executed. If you don't see a good interval, then add one in the Options->Crontrol admin panel.
35
+
36
+ *Step Two: Writing the function*
37
+
38
+ This part takes place in PHP code (for example, in the `functions.php` file from your theme). To execute your hook, WordPress runs an [action](http://codex.wordpress.org/Plugin_API#Actions). For this reason, we need to now tell WordPress which function to execute when this action is run. The following line accomplishes that:
39
+
40
+ `add_action('my_hookname', 'my_function');`
41
+
42
+ The next step is to write your function. Here's a simple example:
43
+
44
+ `function my_function() {
45
+ wp_mail('scompt@scompt.com', 'WP-Crontrol', 'WP-Crontrol rocks!');
46
+ }`
47
+
48
+ = Do I really need the entire `wp-crontrol` directory? =
49
+
50
+ Nope! The only file that you really need is `wp-crontrol.php`. Toss this file in your `wp-content/plugins` directory and you're good to go.
51
+
52
  = How do I ask a frequently asked question? =
53
 
54
+ Email [me](mailto:scompt@scompt.com).
55
 
56
  == Screenshots ==
57
 
58
+ 1. New cron entries can be added, modified, and deleted. In addition, they can be executed on-demand.
59
+ 1. New cron schedules can be added to WordPress, giving plugin developers more options when scheduling commands.
60
 
61
  == Future Plans ==
62
 
63
+ = Coming up in Version 0.4! =
64
+
65
+ * Ability to add PHP code to be executed for the hook name
66
+ * German localization
67
 
68
  == Version History ==
69
 
70
  = Version 0.1 =
71
 
72
+ * Super basic, look at what's in WP-Cron functionality.
73
+
74
+ = Version 0.2 =
75
+
76
+ * Fully documented the code.
77
+ * Fixed the bug that the activate action wouldn't be run if the plugin wasn't in a subdirectory.
78
+ * Now will play nicely in case any other plugins specify additional cron schedules.
79
+ * Minor cosmetic fixes.
80
+
81
+ = Version 0.3 =
82
+
83
+ * Internationalization
84
+ * Editing/deleting/execution of cron entries
85
+ * More text, status messages, etc.
86
+ * Allow a user to enter a schedule entry in a human manner
87
+ * Looks better on WordPress 2.5
screenshot-1.png ADDED
Binary file
screenshot-2.png ADDED
Binary file
trunk/COPYING ADDED
@@ -0,0 +1,280 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 Library 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
trunk/gettext/crontrol-de_DE.mo ADDED
Binary file
trunk/gettext/crontrol-de_DE.po ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # German translations for PACKAGE package
2
+ # German messages for PACKAGE.
3
+ # Copyright (C) 2008 THE PACKAGE'S COPYRIGHT HOLDER
4
+ # This file is distributed under the same license as the PACKAGE package.
5
+ # Edward Dale <>, 2008.
6
+ #
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: PACKAGE VERSION\n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2008-04-25 17:22+0200\n"
12
+ "PO-Revision-Date: 2008-04-25 17:27+0200\n"
13
+ "Last-Translator: Edward Dale <>\n"
14
+ "Language-Team: German\n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=UTF-8\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
+
20
+ #: wp-crontrol.php:102 wp-crontrol.php:111
21
+ msgid "You are not allowed to add new cron events."
22
+ msgstr ""
23
+
24
+ #: wp-crontrol.php:122
25
+ msgid "You are not allowed to add new cron schedules."
26
+ msgstr ""
27
+
28
+ #: wp-crontrol.php:147
29
+ msgid "You are not allowed to delete cron schedules."
30
+ msgstr ""
31
+
32
+ #: wp-crontrol.php:154
33
+ msgid "You are not allowed to delete cron events."
34
+ msgstr ""
35
+
36
+ #: wp-crontrol.php:161
37
+ msgid "You are not allowed to run cron events."
38
+ msgstr ""
39
+
40
+ #: wp-crontrol.php:218
41
+ msgid "Twice Daily"
42
+ msgstr ""
43
+
44
+ #: wp-crontrol.php:258
45
+ msgid "Successfully deleted the cron schedule <b>%s</b>"
46
+ msgstr "Cron Zeitplan <b>%s</b> erfolgreich gel&ouml;scht"
47
+
48
+ #: wp-crontrol.php:269
49
+ msgid "Cron Schedules"
50
+ msgstr "Cron Zeitpl&auml;ne"
51
+
52
+ #: wp-crontrol.php:270
53
+ msgid ""
54
+ "Cron schedules are the time intervals that are available to WordPress and "
55
+ "plugin developers to schedule events. You can only delete cron schedules "
56
+ "that you have created with WP-Crontrol."
57
+ msgstr ""
58
+
59
+ #: wp-crontrol.php:275
60
+ msgid "Name"
61
+ msgstr "Name"
62
+
63
+ #: wp-crontrol.php:276 wp-crontrol.php:311
64
+ msgid "Interval"
65
+ msgstr "Intervall"
66
+
67
+ #: wp-crontrol.php:277
68
+ msgid "Display Name"
69
+ msgstr ""
70
+
71
+ #: wp-crontrol.php:278 wp-crontrol.php:354
72
+ msgid "Actions"
73
+ msgstr ""
74
+
75
+ #: wp-crontrol.php:301
76
+ msgid "Add new cron schedule"
77
+ msgstr ""
78
+
79
+ #: wp-crontrol.php:302
80
+ msgid ""
81
+ "Adding a new cron schedule will allow you to schedule events that re-occur "
82
+ "at the given interval."
83
+ msgstr ""
84
+
85
+ #: wp-crontrol.php:307
86
+ msgid "Internal name"
87
+ msgstr ""
88
+
89
+ #: wp-crontrol.php:315
90
+ msgid "Display name"
91
+ msgstr ""
92
+
93
+ #: wp-crontrol.php:319
94
+ msgid "Add Cron Schedule &raquo;"
95
+ msgstr ""
96
+
97
+ #: wp-crontrol.php:331
98
+ msgid "Successfully executed the cron entry <b>%s</b>"
99
+ msgstr "Cron Eintrag <b>%s</b> erfolgreich ausgef&uuml;hrt"
100
+
101
+ #: wp-crontrol.php:332
102
+ msgid "Successfully edited the cron entry <b>%s</b>"
103
+ msgstr "Cron Eintrag <b>%s</b> erfolgreich bearbeitet"
104
+
105
+ #: wp-crontrol.php:333
106
+ msgid "Successfully created the cron entry <b>%s</b>"
107
+ msgstr "Cron Eintrag <b>%s</b> erfolgreich geschaffen"
108
+
109
+ #: wp-crontrol.php:334
110
+ msgid "Successfully deleted the cron entry <b>%s</b>"
111
+ msgstr "Cron Eintrag <b>%s</b> erfolgreich gel&ouml;scht"
112
+
113
+ #: wp-crontrol.php:345
114
+ msgid "WP-Cron Entries"
115
+ msgstr "WP-Cron Eintr&auml;ge"
116
+
117
+ #: wp-crontrol.php:351
118
+ msgid "Hook Name"
119
+ msgstr ""
120
+
121
+ #: wp-crontrol.php:352
122
+ msgid "Next Run"
123
+ msgstr ""
124
+
125
+ #: wp-crontrol.php:353
126
+ msgid "Recurrence"
127
+ msgstr ""
128
+
129
+ #: wp-crontrol.php:386
130
+ msgid "Edit cron entry"
131
+ msgstr ""
132
+
133
+ #: wp-crontrol.php:386
134
+ msgid "Add new"
135
+ msgstr ""
136
+
137
+ #: wp-crontrol.php:392 wp-crontrol.php:422
138
+ msgid "Hook name"
139
+ msgstr ""
140
+
141
+ #: wp-crontrol.php:395 wp-crontrol.php:425
142
+ msgid "Next run"
143
+ msgstr ""
144
+
145
+ #: wp-crontrol.php:398 wp-crontrol.php:428
146
+ msgid "Entry schedule"
147
+ msgstr ""
148
+
149
+ #: wp-crontrol.php:411
150
+ msgid "Modify Cron Entry &raquo;"
151
+ msgstr ""
152
+
153
+ #: wp-crontrol.php:416
154
+ msgid "Add new cron entry"
155
+ msgstr ""
156
+
157
+ #: wp-crontrol.php:417
158
+ msgid ""
159
+ "Cron entries trigger actions in your code. After adding a new cron entry "
160
+ "here, you will need to add a corresponding action hook somewhere in code, "
161
+ "perhaps the <code>functions.php</code> file in your theme."
162
+ msgstr ""
163
+
164
+ #: wp-crontrol.php:440
165
+ msgid "Add Cron Entry &raquo;"
166
+ msgstr ""
167
+
168
+ #: wp-crontrol.php:471
169
+ msgid "now"
170
+ msgstr "jetzt"
trunk/gettext/crontrol.pot ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: PACKAGE VERSION\n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2008-04-25 17:22+0200\n"
12
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=CHARSET\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+
19
+ #: wp-crontrol.php:102 wp-crontrol.php:111
20
+ msgid "You are not allowed to add new cron events."
21
+ msgstr ""
22
+
23
+ #: wp-crontrol.php:122
24
+ msgid "You are not allowed to add new cron schedules."
25
+ msgstr ""
26
+
27
+ #: wp-crontrol.php:147
28
+ msgid "You are not allowed to delete cron schedules."
29
+ msgstr ""
30
+
31
+ #: wp-crontrol.php:154
32
+ msgid "You are not allowed to delete cron events."
33
+ msgstr ""
34
+
35
+ #: wp-crontrol.php:161
36
+ msgid "You are not allowed to run cron events."
37
+ msgstr ""
38
+
39
+ #: wp-crontrol.php:218
40
+ msgid "Twice Daily"
41
+ msgstr ""
42
+
43
+ #: wp-crontrol.php:258
44
+ #, possible-php-format
45
+ msgid "Successfully deleted the cron schedule <b>%s</b>"
46
+ msgstr ""
47
+
48
+ #: wp-crontrol.php:269
49
+ msgid "Cron Schedules"
50
+ msgstr ""
51
+
52
+ #: wp-crontrol.php:270
53
+ msgid ""
54
+ "Cron schedules are the time intervals that are available to WordPress and "
55
+ "plugin developers to schedule events. You can only delete cron schedules "
56
+ "that you have created with WP-Crontrol."
57
+ msgstr ""
58
+
59
+ #: wp-crontrol.php:275
60
+ msgid "Name"
61
+ msgstr ""
62
+
63
+ #: wp-crontrol.php:276 wp-crontrol.php:311
64
+ msgid "Interval"
65
+ msgstr ""
66
+
67
+ #: wp-crontrol.php:277
68
+ msgid "Display Name"
69
+ msgstr ""
70
+
71
+ #: wp-crontrol.php:278 wp-crontrol.php:354
72
+ msgid "Actions"
73
+ msgstr ""
74
+
75
+ #: wp-crontrol.php:301
76
+ msgid "Add new cron schedule"
77
+ msgstr ""
78
+
79
+ #: wp-crontrol.php:302
80
+ msgid ""
81
+ "Adding a new cron schedule will allow you to schedule events that re-occur "
82
+ "at the given interval."
83
+ msgstr ""
84
+
85
+ #: wp-crontrol.php:307
86
+ msgid "Internal name"
87
+ msgstr ""
88
+
89
+ #: wp-crontrol.php:315
90
+ msgid "Display name"
91
+ msgstr ""
92
+
93
+ #: wp-crontrol.php:319
94
+ msgid "Add Cron Schedule &raquo;"
95
+ msgstr ""
96
+
97
+ #: wp-crontrol.php:331
98
+ #, possible-php-format
99
+ msgid "Successfully executed the cron entry <b>%s</b>"
100
+ msgstr ""
101
+
102
+ #: wp-crontrol.php:332
103
+ #, possible-php-format
104
+ msgid "Successfully edited the cron entry <b>%s</b>"
105
+ msgstr ""
106
+
107
+ #: wp-crontrol.php:333
108
+ #, possible-php-format
109
+ msgid "Successfully created the cron entry <b>%s</b>"
110
+ msgstr ""
111
+
112
+ #: wp-crontrol.php:334
113
+ #, possible-php-format
114
+ msgid "Successfully deleted the cron entry <b>%s</b>"
115
+ msgstr ""
116
+
117
+ #: wp-crontrol.php:345
118
+ msgid "WP-Cron Entries"
119
+ msgstr ""
120
+
121
+ #: wp-crontrol.php:351
122
+ msgid "Hook Name"
123
+ msgstr ""
124
+
125
+ #: wp-crontrol.php:352
126
+ msgid "Next Run"
127
+ msgstr ""
128
+
129
+ #: wp-crontrol.php:353
130
+ msgid "Recurrence"
131
+ msgstr ""
132
+
133
+ #: wp-crontrol.php:386
134
+ msgid "Edit cron entry"
135
+ msgstr ""
136
+
137
+ #: wp-crontrol.php:386
138
+ msgid "Add new"
139
+ msgstr ""
140
+
141
+ #: wp-crontrol.php:392 wp-crontrol.php:422
142
+ msgid "Hook name"
143
+ msgstr ""
144
+
145
+ #: wp-crontrol.php:395 wp-crontrol.php:425
146
+ msgid "Next run"
147
+ msgstr ""
148
+
149
+ #: wp-crontrol.php:398 wp-crontrol.php:428
150
+ msgid "Entry schedule"
151
+ msgstr ""
152
+
153
+ #: wp-crontrol.php:411
154
+ msgid "Modify Cron Entry &raquo;"
155
+ msgstr ""
156
+
157
+ #: wp-crontrol.php:416
158
+ msgid "Add new cron entry"
159
+ msgstr ""
160
+
161
+ #: wp-crontrol.php:417
162
+ msgid ""
163
+ "Cron entries trigger actions in your code. After adding a new cron entry "
164
+ "here, you will need to add a corresponding action hook somewhere in code, "
165
+ "perhaps the <code>functions.php</code> file in your theme."
166
+ msgstr ""
167
+
168
+ #: wp-crontrol.php:440
169
+ msgid "Add Cron Entry &raquo;"
170
+ msgstr ""
171
+
172
+ #: wp-crontrol.php:471
173
+ msgid "now"
174
+ msgstr ""
trunk/readme.txt ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === WP-Crontrol ===
2
+ Contributors: scompt
3
+ Donate link: http://scompt.com/projects/wp-crontrol
4
+ Tags: admin, cron, plugin, control
5
+ Requires at least: 2.1
6
+ Tested up to: 2.5
7
+ Stable tag: 0.3
8
+
9
+ WP-Crontrol lets you take control over what's happening in the WP-Cron system.
10
+
11
+ == Description ==
12
+
13
+ WP-Crontrol lets you take control over what's happening in the WP-Cron system.
14
+
15
+ == Installation ==
16
+
17
+ 1. Upload the `wp-crontrol` directory to the `/wp-content/plugins/` directory
18
+ 1. Activate the plugin through the 'Plugins' menu in WordPress
19
+ 1. Goto the Options->Crontrol panel to add some new cron schedules.
20
+ 1. Goto the Manage->Crontrol panel to see what cron entries are scheduled and to add some new ones.
21
+
22
+ == Frequently Asked Questions ==
23
+
24
+ = What's the use of adding new cron schedules? =
25
+
26
+ Cron schedules are used by WordPress and WordPress plugins to allow you to schedule commands to be executed at regular intervals. Intervals must be provided by the WordPress core or a plugin in order to be used. An example of a plugin that uses these schedules is [WordPress Database Backup](http://www.ilfilosofo.com/blog/wp-db-backup/). Out of the box, only daily and hourly backups are supported. In order to do a weekly backup, a weekly cron schedule must be entered into WP-Crontrol first and then the backup plugin can take advantage of it as an interval.
27
+
28
+ = How do I create a new cron entry? =
29
+
30
+ There are two steps to getting a functioning cron entry that executes regularly. The first step is telling WordPress about the hook. This is the part that WP-Crontrol was created to provide. The second step is calling your function when your hook is executed. You've got to do that on your own, but I'll explain how below.
31
+
32
+ *Step One: Adding the hook*
33
+
34
+ In the Manage->Crontrol admin panel, enter the details of the hook. You're best off having a hookname that conforms to normal PHP variable naming conventions. This could save you trouble later. Other than that, the hookname can be whatever you want it to be. Next run is the next time that the hook will execute. This can be entered in using [GNU Date Input Formats](http://www.gnu.org/software/tar/manual/html_node/tar_113.html), but often *now* is good enough. The entry schedule is how often your hook will be executed. If you don't see a good interval, then add one in the Options->Crontrol admin panel.
35
+
36
+ *Step Two: Writing the function*
37
+
38
+ This part takes place in PHP code (for example, in the `functions.php` file from your theme). To execute your hook, WordPress runs an [action](http://codex.wordpress.org/Plugin_API#Actions). For this reason, we need to now tell WordPress which function to execute when this action is run. The following line accomplishes that:
39
+
40
+ `add_action('my_hookname', 'my_function');`
41
+
42
+ The next step is to write your function. Here's a simple example:
43
+
44
+ `function my_function() {
45
+ wp_mail('scompt@scompt.com', 'WP-Crontrol', 'WP-Crontrol rocks!');
46
+ }`
47
+
48
+ = Do I really need the entire `wp-crontrol` directory? =
49
+
50
+ Nope! The only file that you really need is `wp-crontrol.php`. Toss this file in your `wp-content/plugins` directory and you're good to go.
51
+
52
+ = How do I ask a frequently asked question? =
53
+
54
+ Email [me](mailto:scompt@scompt.com).
55
+
56
+ == Screenshots ==
57
+
58
+ 1. New cron entries can be added, modified, and deleted. In addition, they can be executed on-demand.
59
+ 1. New cron schedules can be added to WordPress, giving plugin developers more options when scheduling commands.
60
+
61
+ == Future Plans ==
62
+
63
+ = Coming up in Version 0.4! =
64
+
65
+ * Ability to add PHP code to be executed for the hook name
66
+ * German localization
67
+
68
+ == Version History ==
69
+
70
+ = Version 0.1 =
71
+
72
+ * Super basic, look at what's in WP-Cron functionality.
73
+
74
+ = Version 0.2 =
75
+
76
+ * Fully documented the code.
77
+ * Fixed the bug that the activate action wouldn't be run if the plugin wasn't in a subdirectory.
78
+ * Now will play nicely in case any other plugins specify additional cron schedules.
79
+ * Minor cosmetic fixes.
80
+
81
+ = Version 0.3 =
82
+
83
+ * Internationalization
84
+ * Editing/deleting/execution of cron entries
85
+ * More text, status messages, etc.
86
+ * Allow a user to enter a schedule entry in a human manner
87
+ * Looks better on WordPress 2.5
trunk/screenshot-1.png ADDED
Binary file
trunk/screenshot-2.png ADDED
Binary file
trunk/wp-crontrol.php ADDED
@@ -0,0 +1,552 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Plugin Name: WP-Crontrol
4
+ * Plugin URI: http://www.scompt.com/projects/wp-crontrol
5
+ * Description: WP-Crontrol lets you take control over what's happening in the WP-Cron system.
6
+ * Author: Edward Dale
7
+ * Version: 0.3
8
+ * Author URI: http://www.scompt.com
9
+ */
10
+
11
+ /**
12
+ * WP-Crontrol lets you take control over what's happening in the WP-Cron system.
13
+ *
14
+ * LICENSE
15
+ * This file is part of WP-Crontrol.
16
+ *
17
+ * WP-Crontrol is free software; you can redistribute it and/or
18
+ * modify it under the terms of the GNU General Public License
19
+ * as published by the Free Software Foundation; either version 2
20
+ * of the License, or (at your option) any later version.
21
+ *
22
+ * This program is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
+ * GNU General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU General Public License
28
+ * along with this program; if not, write to the Free Software
29
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30
+ *
31
+ * @package WP-Crontrol
32
+ * @author Edward Dale <scompt@scompt.com>
33
+ * @copyright Copyright 2007 Edward Dale
34
+ * @license http://www.gnu.org/licenses/gpl.txt GPL 2.0
35
+ * @version $Id: wp-crontrol.php 42732 2008-04-25 19:41:50Z scompt $
36
+ * @link http://www.scompt.com/projects/wp-crontrol
37
+ * @since 0.2
38
+ */
39
+ class Crontrol {
40
+
41
+ /**
42
+ * Hook onto all of the actions and filters needed by the plugin.
43
+ */
44
+ function Crontrol() {
45
+ if( function_exists('add_action') ) {
46
+ add_action('init', array(&$this, 'init'));
47
+ add_action('init', array(&$this, 'handle_posts'));
48
+ add_action('admin_menu', array(&$this, 'admin_menu'));
49
+
50
+ // Make sure the activation works from subdirectories as well as
51
+ // directly in the plugin directory.
52
+ $activate_action = str_replace(ABSPATH.PLUGINDIR.'/', 'activate_', __FILE__);
53
+ add_action($activate_action, array(&$this, 'activate'));
54
+
55
+ add_filter('cron_schedules', array(&$this, 'cron_schedules'));
56
+ add_action('wp_ajax_delete-sched', array(&$this, 'handle_ajax'));
57
+ add_action('wp_ajax_delete-cron', array(&$this, 'handle_ajax'));
58
+ }
59
+ }
60
+
61
+ /**
62
+ * Run using the 'init' action.
63
+ */
64
+ function init() {
65
+ load_plugin_textdomain('crontrol', str_replace(ABSPATH, '', dirname(__FILE__).'/gettext'));
66
+ }
67
+
68
+ /**
69
+ * Run using the 'admin_print_scripts' action. Added in the 'admin_menu'
70
+ * hook.
71
+ */
72
+ function scripts() {
73
+ wp_enqueue_script( 'listman');
74
+ }
75
+
76
+ /**
77
+ * Handles any ajax requests made by the plugin. Run using
78
+ * the 'wp_ajax_*' actions.
79
+ */
80
+ function handle_ajax() {
81
+ switch( $_POST['action'] ) {
82
+ case 'delete-sched':
83
+ if( !current_user_can('manage_options') ) die('-1');
84
+ $to_delete = $_POST['id'];
85
+ $this->delete_schedule($to_delete);
86
+ exit('1');
87
+ break;
88
+ case 'delete-cron':
89
+ if( !current_user_can('manage_options') ) die('-1');
90
+ $to_delete = $_POST['id'];
91
+ $this->delete_cron($to_delete);
92
+ exit('1');
93
+ break;
94
+ }
95
+ }
96
+
97
+ /**
98
+ * Handles any POSTs made by the plugin. Run using the 'init' action.
99
+ */
100
+ function handle_posts() {
101
+ if( isset($_POST['new_cron']) ) {
102
+ if( !current_user_can('manage_options') ) die(__('You are not allowed to add new cron events.', 'crontrol'));
103
+ check_admin_referer("new-cron");
104
+ $next_run = $_POST['nextrun'];
105
+ $schedule = $_POST['schedule'];
106
+ $hookname = $_POST['hookname'];
107
+ $this->add_cron($next_run, $schedule, $hookname);
108
+ wp_redirect("edit.php?page=crontrol_admin_manage_page&crontrol_message=5&crontrol_name=$hookname");
109
+
110
+ } else if( isset($_POST['edit_cron']) ) {
111
+ if( !current_user_can('manage_options') ) die(__('You are not allowed to add new cron events.', 'crontrol'));
112
+ $next_run = $_POST['nextrun'];
113
+ $schedule = $_POST['schedule'];
114
+ $hookname = $_POST['hookname'];
115
+ $original_hookname = $_POST['original_hookname'];
116
+ check_admin_referer("edit-cron_{$original_hookname}");
117
+ $this->delete_cron($original_hookname);
118
+ $this->add_cron($next_run, $schedule, $hookname);
119
+ wp_redirect("edit.php?page=crontrol_admin_manage_page&crontrol_message=4&crontrol_name=$hookname");
120
+
121
+ } else if( isset($_POST['new_schedule']) ) {
122
+ if( !current_user_can('manage_options') ) die(__('You are not allowed to add new cron schedules.', 'crontrol'));
123
+ check_admin_referer("new-sched");
124
+ $name = $_POST['internal_name'];
125
+ $interval = $_POST['interval'];
126
+ $display = $_POST['display_name'];
127
+
128
+ // The user entered something that wasn't a number.
129
+ // Try to convert it with strtotime
130
+ if( !is_numeric($interval) ) {
131
+ $now = time();
132
+ $future = strtotime($interval, $now);
133
+ if( $future===FALSE || $future == -1 || $now>$future) {
134
+ wp_redirect("options-general.php?page=crontrol_admin_options_page&crontrol_message=7&crontrol_name=".urlencode($interval));
135
+ return;
136
+ }
137
+ $interval = $future-$now;
138
+ } else if( $interval<=0 ) {
139
+ wp_redirect("options-general.php?page=crontrol_admin_options_page&crontrol_message=7&crontrol_name=".urlencode($interval));
140
+ return;
141
+ }
142
+
143
+ $this->add_schedule($name, $interval, $display);
144
+ wp_redirect("options-general.php?page=crontrol_admin_options_page&crontrol_message=3&crontrol_name=$name");
145
+
146
+ } else if( isset($_GET['action']) && $_GET['action']=='delete-sched') {
147
+ if( !current_user_can('manage_options') ) die(__('You are not allowed to delete cron schedules.', 'crontrol'));
148
+ $id = $_GET['id'];
149
+ check_admin_referer("delete-sched_$id");
150
+ $this->delete_schedule($id);
151
+ wp_redirect("options-general.php?page=crontrol_admin_options_page&crontrol_message=2&crontrol_name=$id");
152
+
153
+ } else if( isset($_GET['action']) && $_GET['action']=='delete-cron') {
154
+ if( !current_user_can('manage_options') ) die(__('You are not allowed to delete cron events.', 'crontrol'));
155
+ $id = $_GET['id'];
156
+ check_admin_referer("delete-cron_$id");
157
+ $this->delete_cron($id);
158
+ wp_redirect("edit.php?page=crontrol_admin_manage_page&crontrol_message=6&crontrol_name=$id");
159
+
160
+ } else if( isset($_GET['action']) && $_GET['action']=='run-cron') {
161
+ if( !current_user_can('manage_options') ) die(__('You are not allowed to run cron events.', 'crontrol'));
162
+ $id = $_GET['id'];
163
+ check_admin_referer("run-cron_$id");
164
+ $this->run_cron($id);
165
+ wp_redirect("edit.php?page=crontrol_admin_manage_page&crontrol_message=1&crontrol_name=$id");
166
+ }
167
+ }
168
+
169
+ /**
170
+ * Executes a cron entry immediately.
171
+ *
172
+ * Executes an entry by deleting it and adding it again with a
173
+ * run time of 'now'.
174
+ *
175
+ * @param string $hookname The hookname of the cron entry to run
176
+ */
177
+ function run_cron($hookname) {
178
+ $sched = wp_get_schedule($hookname);
179
+ wp_clear_scheduled_hook($hookname);
180
+ $this->add_cron('now', $sched, $hookname);
181
+
182
+ }
183
+
184
+ /**
185
+ * Adds a new cron entry.
186
+ *
187
+ * @param string $next_run A human-readable (strtotime) time that the entry should be run at
188
+ * @param string $schedule The recurrence of the cron entry
189
+ * @param string $hookname The name of the hook to execute
190
+ */
191
+ function add_cron($next_run, $schedule, $hookname) {
192
+ $next_run = strtotime($next_run);
193
+ if( $next_run===FALSE || $next_run==-1 ) $next_run=time();
194
+ if( !wp_schedule_event( $next_run, $schedule, $hookname ) ) {
195
+ $error=True;
196
+ }
197
+ }
198
+
199
+ /**
200
+ * Deletes a cron entry.
201
+ *
202
+ * @param string $name The hookname of the entry to delete.
203
+ */
204
+ function delete_cron($to_delete) {
205
+ wp_clear_scheduled_hook($to_delete);
206
+ }
207
+
208
+ /**
209
+ * Adds a new custom cron schedule.
210
+ *
211
+ * @param string $name The internal name of the schedule
212
+ * @param int $interval The interval between executions of the new schedule
213
+ * @param string $display The display name of the schedule
214
+ */
215
+ function add_schedule($name, $interval, $display) {
216
+ $old_scheds = get_option('crontrol_schedules');
217
+ $old_scheds[$name] = array('interval'=>$interval, 'display'=>$display);
218
+ update_option('crontrol_schedules', $old_scheds);
219
+ }
220
+
221
+ /**
222
+ * Deletes a custom cron schedule.
223
+ *
224
+ * @param string $name The internal_name of the schedule to delete.
225
+ */
226
+ function delete_schedule($name) {
227
+ $scheds = get_option('crontrol_schedules');
228
+ unset($scheds[$name]);
229
+ update_option('crontrol_schedules', $scheds);
230
+ }
231
+
232
+ /**
233
+ * Sets up the plugin environment upon first activation.
234
+ *
235
+ * Run using the 'activate_' action.
236
+ */
237
+ function activate() {
238
+ $extra_scheds = array('twicedaily'=>array('interval'=>43200, 'display'=>__('Twice Daily', 'crontrol')));
239
+ add_option('crontrol_schedules', $extra_scheds);
240
+
241
+ // if there's never been a cron entry, _get_cron_array will return FALSE
242
+ if( _get_cron_array() === FALSE ) {
243
+ _set_cron_array(array());
244
+ }
245
+ }
246
+
247
+ /**
248
+ * Adds options & management pages to the admin menu.
249
+ *
250
+ * Run using the 'admin_menu' action.
251
+ */
252
+ function admin_menu() {
253
+ $page = add_options_page('Crontrol', 'Crontrol', 'manage_options', 'crontrol_admin_options_page', array(&$this, 'admin_options_page') );
254
+ add_action("admin_print_scripts-$page", array(&$this, 'scripts') );
255
+
256
+ $page = add_management_page('Crontrol', "Crontrol", 'manage_options', 'crontrol_admin_manage_page', array(&$this, 'admin_manage_page') );
257
+ add_action("admin_print_scripts-$page", array(&$this, 'scripts') );
258
+ }
259
+
260
+ /**
261
+ * Gives WordPress the plugin's set of cron schedules.
262
+ *
263
+ * Called by the 'cron_schedules' filter.
264
+ *
265
+ * @param array $scheds The current cron schedules. Usually an empty array.
266
+ * @return array The existing cron schedules along with the plugin's schedules.
267
+ */
268
+ function cron_schedules($scheds) {
269
+ $new_scheds = get_option('crontrol_schedules');
270
+ return array_merge($new_scheds, $scheds);
271
+ }
272
+
273
+ /**
274
+ * Displays the options page for the plugin.
275
+ */
276
+ function admin_options_page() {
277
+ $schedules = wp_get_schedules();
278
+ $custom_schedules = get_option('crontrol_schedules');
279
+ $custom_keys = array_keys($custom_schedules);
280
+ uasort($schedules, create_function('$a,$b', 'return $a["interval"]-$b["interval"];'));
281
+
282
+ if( isset($_GET['crontrol_message']) ) {
283
+ $messages = array( '2' => __("Successfully deleted the cron schedule <b>%s</b>", 'crontrol'),
284
+ '3' => __("Successfully added the cron schedule <b>%s</b>", 'crontrol'),
285
+ '7' => __("Cron schedule not added because there was a problem parsing <b>%s</b>", 'crontrol'));
286
+ $hook = $_GET['crontrol_name'];
287
+ $msg = sprintf($messages[$_GET['crontrol_message']], $hook);
288
+
289
+ echo "<div id=\"message\" class=\"updated fade\"><p>$msg</p></div>";
290
+ }
291
+
292
+ ?>
293
+ <div class="wrap">
294
+ <h2><?php _e("Cron Schedules", "crontrol"); ?></h2>
295
+ <p><?php _e('Cron schedules are the time intervals that are available to WordPress and plugin developers to schedule events. You can only delete cron schedules that you have created with WP-Crontrol.', 'crontrol'); ?></p>
296
+ <div id="ajax-response"></div>
297
+ <table class="widefat" id="the-list">
298
+ <thead>
299
+ <tr>
300
+ <th><?php _e('Name', 'crontrol'); ?></th>
301
+ <th><?php _e('Interval', 'crontrol'); ?></th>
302
+ <th><?php _e('Display Name', 'crontrol'); ?></th>
303
+ <th><?php _e('Actions', 'crontrol'); ?></th>
304
+ </tr>
305
+ </thead>
306
+ <tbody>
307
+ <?php
308
+ if( empty($schedules) ) {
309
+ ?>
310
+ <tr colspan="4"><td><?php _e('You currently have no cron schedules. Add one below!', 'crontrol') ?></td></tr>
311
+ <?php
312
+ } else {
313
+ $class = "";
314
+ foreach( $schedules as $name=>$data ) {
315
+ echo "<tr id=\"sched-$name\" class=\"$class\">";
316
+ echo "<td>$name</td>";
317
+ echo "<td>{$data['interval']} (".$this->interval($data['interval']).")</td>";
318
+ echo "<td>{$data['display']}</td>";
319
+ if( in_array($name, $custom_keys) ) {
320
+ echo "<td><a href='" . wp_nonce_url( "options-general.php?page=crontrol_admin_options_page&amp;action=delete-sched&amp;id=$name", 'delete-sched_' . $name ) . "' onclick=\"return deleteSomething( 'sched', '$name', '" . js_escape(sprintf( __("You are about to delete the schedule '%s'.\n'OK' to delete, 'Cancel' to stop.", 'crontrol' ), $name)) . "' );\" class='delete'>".__( 'Delete' )."</a></td>";
321
+ } else {
322
+ echo "<td>&nbsp;</td>\n";
323
+ }
324
+ echo "</tr>";
325
+ $class = empty($class)?"alternate":"";
326
+ }
327
+ }
328
+ ?>
329
+ </tbody>
330
+ </table>
331
+ </div>
332
+ <div class="wrap narrow">
333
+ <h2><?php _e('Add new cron schedule', 'crontrol'); ?></h2>
334
+ <p><?php _e('Adding a new cron schedule will allow you to schedule events that re-occur at the given interval.', 'crontrol'); ?></p>
335
+ <form method="post" action="options-general.php?page=crontrol_admin_options_page">
336
+ <table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
337
+ <tbody>
338
+ <tr>
339
+ <th width="33%" valign="top" scope="row"><label for="internal_name"><?php _e('Internal name', 'crontrol'); ?>:</label></th>
340
+ <td width="67%"><input type="text" size="40" value="" id="internal_name" name="internal_name"/></td>
341
+ </tr>
342
+ <tr>
343
+ <th width="33%" valign="top" scope="row"><label for="interval"><?php _e('Interval', 'crontrol'); ?>:</label></th>
344
+ <td width="67%"><input type="text" size="40" value="" id="interval" name="interval"/></td>
345
+ </tr>
346
+ <tr>
347
+ <th width="33%" valign="top" scope="row"><label for="display_name"><?php _e('Display name', 'crontrol'); ?>:</label></th>
348
+ <td width="67%"><input type="text" size="40" value="" id="display_name" name="display_name"/></td>
349
+ </tr>
350
+ </tbody></table>
351
+ <p class="submit"><input id="schedadd-submit" type="submit" value="<?php _e('Add Cron Schedule &raquo;', 'crontrol'); ?>" name="new_schedule"/></p>
352
+ <?php wp_nonce_field('new-sched') ?>
353
+ </form>
354
+ </div>
355
+ <?php
356
+ }
357
+
358
+ /**
359
+ * Displays the manage page for the plugin.
360
+ */
361
+ function admin_manage_page() {
362
+ if( isset($_GET['crontrol_message']) ) {
363
+ $messages = array( '1' => __('Successfully executed the cron entry <b>%s</b>', 'crontrol'),
364
+ '4' => __('Successfully edited the cron entry <b>%s</b>', 'crontrol'),
365
+ '5' => __('Successfully created the cron entry <b>%s</b>', 'crontrol'),
366
+ '6' => __('Successfully deleted the cron entry <b>%s</b>', 'crontrol'));
367
+ $hook = $_GET['crontrol_name'];
368
+ $msg = sprintf($messages[$_GET['crontrol_message']], $hook);
369
+
370
+ echo "<div id=\"message\" class=\"updated fade\"><p>$msg</p></div>";
371
+ }
372
+ $crons = _get_cron_array();
373
+ $schedules = wp_get_schedules();
374
+ $doing_edit = (isset( $_GET['action']) && $_GET['action']=='edit-cron') ? $_GET['id'] : false ;
375
+ ?>
376
+ <div class="wrap">
377
+ <h2><?php _e('WP-Cron Entries', 'crontrol'); ?></h2>
378
+ <p></p>
379
+ <div id="ajax-response"></div>
380
+ <table class="widefat" id="the-list">
381
+ <thead>
382
+ <tr>
383
+ <th><?php _e('Hook Name', 'crontrol'); ?></th>
384
+ <th><?php _e('Next Run', 'crontrol'); ?></th>
385
+ <th><?php _e('Recurrence', 'crontrol'); ?></th>
386
+ <th colspan="3"><?php _e('Actions', 'crontrol'); ?></th>
387
+ </tr>
388
+ </thead>
389
+ <tbody>
390
+ <?php
391
+ if( empty($crons) ) {
392
+ ?>
393
+ <tr colspan="6"><td><?php _e('You currently have no cron entries. Add one below!', 'crontrol') ?></td></tr>
394
+ <?php
395
+ } else {
396
+ $class = "";
397
+ foreach( $crons as $time=>$cron ) {
398
+ foreach( $cron as $hook=>$data) {
399
+ $data = array_shift($data);
400
+ if( $doing_edit && $doing_edit==$hook ) {
401
+ $doing_edit = array('hookname'=>$hook,
402
+ 'nextrun'=>$time,
403
+ 'schedule'=>$data['schedule']);
404
+ }
405
+
406
+ echo "<tr id=\"cron-$hook\" class=\"$class\">";
407
+ echo "<td>$hook</td>";
408
+ echo "<td>".strftime("%D %T", $time)." (".$this->time_since(time(), $time).")</td>";
409
+ echo "<td>{$data['interval']} (".$this->interval($data['interval']).")</td>";
410
+ echo "<td><a class='view' href='edit.php?page=crontrol_admin_manage_page&amp;action=edit-cron&amp;id=$hook'>Edit</a></td>";
411
+ echo "<td><a class='view' href='".wp_nonce_url("edit.php?page=crontrol_admin_manage_page&amp;action=run-cron&amp;id=$hook", 'run-cron_' . $hook)."' onclick=\"return confirm('". js_escape(sprintf(__("You are about to execute a cron entry.\nPress 'OK' to continue or 'Cancel' to stop.", 'crontrol')))."');\">Do Now</a></td>";
412
+ echo "<td><a class='delete' href='".wp_nonce_url("edit.php?page=crontrol_admin_manage_page&amp;action=delete-cron&amp;id=$hook", 'delete-cron_' . $hook)."' onclick=\"return deleteSomething( 'cron', '$hook', '" . js_escape(sprintf( __("You are about to delete the cron entry '%s'.\n'OK' to delete, 'Cancel' to stop.", 'crontrol'), $hook)) . "' );\">Delete</a></td>";
413
+ echo "</tr>";
414
+ $class = empty($class)?"alternate":"";
415
+ }
416
+ }
417
+ }
418
+ ?>
419
+ </tbody>
420
+ </table>
421
+ </div>
422
+ <?php if( is_array( $doing_edit ) ): ?>
423
+ <div class="wrap narrow">
424
+ <h2><?php _e('Edit cron entry', 'crontrol'); ?> (<a href="edit.php?page=crontrol_admin_manage_page"><?php _e('Add new', 'crontrol'); ?></a>)</h2>
425
+ <form method="post">
426
+ <?php wp_nonce_field('edit-cron_'.$doing_edit['hookname']) ?>
427
+ <input name="original_hookname" type="hidden" value="<?php echo $doing_edit['hookname'] ?>" />
428
+ <table width="100%" cellspacing="2" cellpadding="5" class="editform">
429
+ <tbody><tr>
430
+ <th width="33%" valign="top" scope="row"><label for="hookname"><?php _e('Hook name', 'crontrol'); ?>:</label></th>
431
+ <td width="67%"><input type="text" size="40" id="hookname" name="hookname" value="<?php echo $doing_edit['hookname'] ?>"/></td>
432
+ </tr><tr>
433
+ <th width="33%" valign="top" scope="row"><label for="nextrun"><?php _e('Next run', 'crontrol'); ?>:</label></th>
434
+ <td width="67%"><input type="text" size="40" id="nextrun" name="nextrun" value="<?php echo strftime("%D %T", $doing_edit['nextrun']) ?>"/></td>
435
+ </tr><tr>
436
+ <th valign="top" scope="row"><label for="schedule"><?php _e('Entry schedule', 'crontrol'); ?>:</label></th>
437
+ <td>
438
+ <select class="postform" name="schedule">
439
+ <?php
440
+ foreach( $schedules as $sched_name=>$sched_data ) {
441
+ $selected = $doing_edit['schedule']==$sched_name ? 'selected="selected"' : '';
442
+ echo "<option $selected value=\"$sched_name\">{$sched_data['display']} (".$this->interval($sched_data['interval']).")</option>\n";
443
+ }
444
+ ?>
445
+ </select>
446
+ </td>
447
+ </tr>
448
+ </tbody></table>
449
+ <p class="submit"><input type="submit" value="<?php _e('Modify Cron Entry &raquo;', 'crontrol'); ?>" name="edit_cron"/></p>
450
+ </form>
451
+ </div>
452
+ <?php else: ?>
453
+ <div class="wrap narrow">
454
+ <h2><?php _e('Add new cron entry', 'crontrol'); ?></h2>
455
+ <p><?php _e('Cron entries trigger actions in your code. After adding a new cron entry here, you will need to add a corresponding action hook somewhere in code, perhaps the <code>functions.php</code> file in your theme.', 'crontrol'); ?></p>
456
+ <form method="post">
457
+ <?php wp_nonce_field('new-cron') ?>
458
+ <table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
459
+ <tbody><tr>
460
+ <th width="33%" valign="top" scope="row"><label for="hookname"><?php _e('Hook name', 'crontrol'); ?>:</label></th>
461
+ <td width="67%"><input type="text" size="40" value="" id="hookname" name="hookname"/></td>
462
+ </tr><tr>
463
+ <th width="33%" valign="top" scope="row"><label for="nextrun"><?php _e('Next run', 'crontrol'); ?>:</label></th>
464
+ <td width="67%"><input type="text" size="40" value="now" id="nextrun" name="nextrun"/></td>
465
+ </tr><tr>
466
+ <th valign="top" scope="row"><label for="schedule"><?php _e('Entry schedule', 'crontrol'); ?>:</label></th>
467
+ <td>
468
+ <select class="postform" name="schedule">
469
+ <?php
470
+ foreach( $schedules as $sched_name=>$sched_data ) {
471
+ echo "<option value=\"$sched_name\">{$sched_data['display']} (".$this->interval($sched_data['interval']).")</option>\n";
472
+ }
473
+ ?>
474
+ </select>
475
+ </td>
476
+ </tr>
477
+ </tbody></table>
478
+ <p class="submit"><input type="submit" value="<?php _e('Add Cron Entry &raquo;', 'crontrol'); ?>" name="new_cron"/></p>
479
+ </form>
480
+ </div>
481
+ <?php endif;
482
+ }
483
+
484
+ /**
485
+ * Pretty-prints the difference in two times.
486
+ *
487
+ * @param time $older_date
488
+ * @param time $newer_date
489
+ * @return string The pretty time_since value
490
+ * @link http://binarybonsai.com/code/timesince.txt
491
+ */
492
+ function time_since($older_date, $newer_date) {
493
+ return $this->interval( $newer_date - $older_date );
494
+ }
495
+
496
+ function interval( $since ) {
497
+ // array of time period chunks
498
+ $chunks = array(
499
+ array(60 * 60 * 24 * 365 , 'year'),
500
+ array(60 * 60 * 24 * 30 , 'month'),
501
+ array(60 * 60 * 24 * 7, 'week'),
502
+ array(60 * 60 * 24 , 'day'),
503
+ array(60 * 60 , 'hour'),
504
+ array(60 , 'minute'),
505
+ array( 1 , 'second'),
506
+ );
507
+
508
+ if( $since <= 0 ) {
509
+ return __('now', 'crontrol');
510
+ }
511
+
512
+ // we only want to output two chunks of time here, eg:
513
+ // x years, xx months
514
+ // x days, xx hours
515
+ // so there's only two bits of calculation below:
516
+
517
+ // step one: the first chunk
518
+ for ($i = 0, $j = count($chunks); $i < $j; $i++)
519
+ {
520
+ $seconds = $chunks[$i][0];
521
+ $name = $chunks[$i][1];
522
+
523
+ // finding the biggest chunk (if the chunk fits, break)
524
+ if (($count = floor($since / $seconds)) != 0)
525
+ {
526
+ break;
527
+ }
528
+ }
529
+
530
+ // set output var
531
+ $output = ($count == 1) ? '1 '.$name : "$count {$name}s";
532
+
533
+ // step two: the second chunk
534
+ if ($i + 1 < $j)
535
+ {
536
+ $seconds2 = $chunks[$i + 1][0];
537
+ $name2 = $chunks[$i + 1][1];
538
+
539
+ if (($count2 = floor(($since - ($seconds * $count)) / $seconds2)) != 0)
540
+ {
541
+ // add to output var
542
+ $output .= ($count2 == 1) ? ', 1 '.$name2 : ", $count2 {$name2}s";
543
+ }
544
+ }
545
+
546
+ return $output;
547
+ }
548
+ }
549
+
550
+ // Get this show on the road
551
+ new Crontrol();
552
+ ?>
wp-crontrol.php CHANGED
@@ -4,17 +4,53 @@
4
  * Plugin URI: http://www.scompt.com/projects/wp-crontrol
5
  * Description: WP-Crontrol lets you take control over what's happening in the WP-Cron system.
6
  * Author: Edward Dale
7
- * Version: 0.1
8
  * Author URI: http://www.scompt.com
9
  */
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  class Crontrol {
 
 
 
 
12
  function Crontrol() {
13
  if( function_exists('add_action') ) {
14
  add_action('init', array(&$this, 'init'));
15
  add_action('init', array(&$this, 'handle_posts'));
16
  add_action('admin_menu', array(&$this, 'admin_menu'));
17
- add_action('activate_wp-crontrol.php', array(&$this, 'activate'));
 
 
 
 
18
 
19
  add_filter('cron_schedules', array(&$this, 'cron_schedules'));
20
  add_action('wp_ajax_delete-sched', array(&$this, 'handle_ajax'));
@@ -22,228 +58,455 @@ class Crontrol {
22
  }
23
  }
24
 
 
 
 
25
  function init() {
26
- load_plugin_textdomain('crontrol', PLUGINDIR.'/wp-crontrol/gettext');
27
  }
 
 
 
 
 
28
  function scripts() {
29
  wp_enqueue_script( 'listman');
30
  }
31
 
 
 
 
 
32
  function handle_ajax() {
33
  switch( $_POST['action'] ) {
34
  case 'delete-sched':
 
35
  $to_delete = $_POST['id'];
36
  $this->delete_schedule($to_delete);
37
  exit('1');
38
  break;
39
  case 'delete-cron':
 
 
 
 
40
  break;
41
  }
42
  }
43
 
 
 
 
44
  function handle_posts() {
45
  if( isset($_POST['new_cron']) ) {
46
- wp_schedule_event(time(), $_POST['schedule'], $_POST['hookname']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
 
48
  } else if( isset($_POST['new_schedule']) ) {
 
49
  check_admin_referer("new-sched");
50
  $name = $_POST['internal_name'];
51
  $interval = $_POST['interval'];
52
  $display = $_POST['display_name'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  $this->add_schedule($name, $interval, $display);
54
- wp_redirect('options-general.php?page=crontrol_admin_options_page');
55
 
56
  } else if( isset($_GET['action']) && $_GET['action']=='delete-sched') {
 
57
  $id = $_GET['id'];
58
  check_admin_referer("delete-sched_$id");
59
  $this->delete_schedule($id);
60
- wp_redirect('options-general.php?page=crontrol_admin_options_page');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  }
62
  }
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  function add_schedule($name, $interval, $display) {
65
  $old_scheds = get_option('crontrol_schedules');
66
- $old_scheds[$_POST['internal_name']] = array('interval'=>$_POST['interval'], 'display'=>$_POST['display_name']);
67
  update_option('crontrol_schedules', $old_scheds);
68
  }
 
 
 
 
 
 
69
  function delete_schedule($name) {
70
  $scheds = get_option('crontrol_schedules');
71
  unset($scheds[$name]);
72
  update_option('crontrol_schedules', $scheds);
73
  }
74
 
 
 
 
 
 
75
  function activate() {
76
- $extra_scheds = array('twicedaily'=>array('interval'=>43200, 'display'=>'Twice Daily'));
77
  add_option('crontrol_schedules', $extra_scheds);
 
 
 
 
 
78
  }
79
 
 
 
 
 
 
80
  function admin_menu() {
81
- // Add a Zensor menu underneath the options and management page
82
  $page = add_options_page('Crontrol', 'Crontrol', 'manage_options', 'crontrol_admin_options_page', array(&$this, 'admin_options_page') );
83
  add_action("admin_print_scripts-$page", array(&$this, 'scripts') );
84
 
85
- $page = add_management_page('Crontrol', "Crontrol", '1', 'crontrol_admin_manage_page', array(&$this, 'admin_manage_page') );
86
-
87
- // Add some scripts and stylesheets to the admin section
88
- // add_action("admin_print_scripts-$page", array(&$this, 'scripts') );
89
- // add_action("admin_head", array(&$this, 'styles') );
90
  }
91
 
 
 
 
 
 
 
 
 
92
  function cron_schedules($scheds) {
93
  $new_scheds = get_option('crontrol_schedules');
94
- return $new_scheds;
95
  }
96
 
 
 
 
97
  function admin_options_page() {
98
  $schedules = wp_get_schedules();
99
  $custom_schedules = get_option('crontrol_schedules');
100
  $custom_keys = array_keys($custom_schedules);
101
  uasort($schedules, create_function('$a,$b', 'return $a["interval"]-$b["interval"];'));
102
 
 
 
 
 
 
 
 
 
 
 
103
  ?>
104
  <div class="wrap">
105
- <h2>Cron Schedules (<a href="#new">add new</a>)</h2>
106
- <p></p>
107
- <div id="ajax-response"></div>
108
  <table class="widefat" id="the-list">
109
  <thead>
110
  <tr>
111
- <th>Name</th>
112
- <th>Interval</th>
113
- <th>Display Name</th>
114
- <th>Actions</th>
115
  </tr>
116
  </thead>
117
  <tbody>
118
  <?php
119
- $class = "";
120
- foreach( $schedules as $name=>$data ) {
121
- echo "<tr id=\"sched-$name\" class=\"$class\">";
122
- echo "<td>$name</td>";
123
- echo "<td>{$data['interval']} (".$this->time_since(time(), time()+$data['interval']).")</td>";
124
- echo "<td>{$data['display']}</td>";
125
- if( in_array($name, $custom_keys) ) {
126
- echo "<td><a href='" . wp_nonce_url( "options-general.php?page=crontrol_admin_options_page&amp;action=delete-sched&amp;id=$name", 'delete-sched_' . $name ) . "' onclick=\"return deleteSomething( 'sched', '$name', '" . js_escape(sprintf( __("You are about to delete the schedule '%s'.\n'OK' to delete, 'Cancel' to stop." ), $name)) . "' );\" class='delete'>".__( 'Delete' )."</a></td>";
 
 
 
 
 
 
 
 
 
 
127
  }
128
- echo "</tr>";
129
- $class = empty($class)?"alternate":"";
130
- }
131
-
132
  ?>
133
  </tbody>
134
  </table>
135
  </div>
136
  <div class="wrap narrow">
137
- <a name="new" id="new"></a>
138
- <h2>Add new cron schedule</h2>
139
-
140
  <form method="post" action="options-general.php?page=crontrol_admin_options_page">
141
- <table width="100%" cellspacing="2" cellpadding="5" class="editform">
142
  <tbody>
143
  <tr>
144
- <th width="33%" valign="top" scope="row"><label for="internal_name">Internal name:</label></th>
145
  <td width="67%"><input type="text" size="40" value="" id="internal_name" name="internal_name"/></td>
146
  </tr>
147
  <tr>
148
- <th width="33%" valign="top" scope="row"><label for="interval">Interval:</label></th>
149
  <td width="67%"><input type="text" size="40" value="" id="interval" name="interval"/></td>
150
  </tr>
151
  <tr>
152
- <th width="33%" valign="top" scope="row"><label for="display_name">Display name:</label></th>
153
  <td width="67%"><input type="text" size="40" value="" id="display_name" name="display_name"/></td>
154
  </tr>
155
  </tbody></table>
156
- <p class="submit"><input id="schedadd-submit" type="submit" value="Add Cron Schedule &raquo;" name="new_schedule"/></p>
157
  <?php wp_nonce_field('new-sched') ?>
158
  </form>
159
  </div>
160
  <?php
161
  }
162
-
 
 
 
163
  function admin_manage_page() {
 
 
 
 
 
 
 
 
 
 
164
  $crons = _get_cron_array();
165
  $schedules = wp_get_schedules();
166
-
167
  ?>
168
  <div class="wrap">
169
- <h2>WP-Cron Entries (<a href="#new">add new</a>)</h2>
170
  <p></p>
171
- <table class="widefat">
 
172
  <thead>
173
  <tr>
174
- <th>Hook Name</th>
175
- <th>Next Run</th>
176
- <th>Recurrence</th>
177
- <th>Actions</th>
178
  </tr>
179
  </thead>
180
  <tbody>
181
  <?php
182
- $class = "";
183
- foreach( $crons as $time=>$cron ) {
184
- foreach( $cron as $hook=>$data) {
185
- $data = array_shift($data);
186
- echo "<tr class=\"$class\">";
187
- echo "<td>$hook</td>";
188
- echo "<td>".strftime("%D %T", $time)." (".$this->time_since(time(), $time).")</td>";
189
- echo "<td>{$data['interval']} (".$this->time_since(time(), time()+$data['interval']).")</td>";
190
- echo "<td></td>";
191
- echo "</tr>";
192
- $class = empty($class)?"alternate":"";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  }
194
  }
195
  ?>
196
  </tbody>
197
  </table>
198
  </div>
 
199
  <div class="wrap narrow">
200
- <a name="new" id="new"></a>
201
- <h2>Add new cron entry</h2>
202
  <form method="post">
 
 
203
  <table width="100%" cellspacing="2" cellpadding="5" class="editform">
204
  <tbody><tr>
205
- <th width="33%" valign="top" scope="row"><label for="hookname">Hook name:</label></th>
206
- <td width="67%"><input type="text" size="40" value="" id="hookname" name="hookname"/></td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  </tr>
208
- <tr>
209
- <th valign="top" scope="row"><label for="schedule">Entry schedule:</label></th>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  <td>
211
  <select class="postform" name="schedule">
212
  <?php
213
  foreach( $schedules as $sched_name=>$sched_data ) {
214
- echo "<option value=\"$sched_name\">{$sched_data['display']} (".$this->time_since(time(), time()+$sched_data['interval']).")</option>\n";
215
  }
216
  ?>
217
  </select>
218
  </td>
219
  </tr>
220
  </tbody></table>
221
- <p class="submit"><input type="submit" value="Add Cron Entry &raquo;" name="new_cron"/></p>
222
  </form>
223
- </div>
224
- <?php
225
  }
226
 
227
  /**
228
- * From: http://binarybonsai.com/code/timesince.txt
 
 
 
 
 
229
  */
230
- function time_since($older_date, $newer_date)
231
- {
232
- // array of time period chunks
 
 
 
233
  $chunks = array(
234
- array(60 * 60 * 24 * 365 , 'year'),
235
- array(60 * 60 * 24 * 30 , 'month'),
236
- array(60 * 60 * 24 * 7, 'week'),
237
- array(60 * 60 * 24 , 'day'),
238
- array(60 * 60 , 'hour'),
239
- array(60 , 'minute'),
240
- array( 1 , 'second'),
241
  );
242
 
243
- // difference in seconds
244
- $since = $newer_date - $older_date;
245
  if( $since <= 0 ) {
246
- return "now";
247
  }
248
 
249
  // we only want to output two chunks of time here, eg:
@@ -281,9 +544,9 @@ class Crontrol {
281
  }
282
 
283
  return $output;
284
- }
285
-
286
  }
287
 
 
288
  new Crontrol();
289
  ?>
4
  * Plugin URI: http://www.scompt.com/projects/wp-crontrol
5
  * Description: WP-Crontrol lets you take control over what's happening in the WP-Cron system.
6
  * Author: Edward Dale
7
+ * Version: 0.2
8
  * Author URI: http://www.scompt.com
9
  */
10
 
11
+ /**
12
+ * WP-Crontrol lets you take control over what's happening in the WP-Cron system.
13
+ *
14
+ * LICENSE
15
+ * This file is part of WP-Crontrol.
16
+ *
17
+ * WP-Crontrol is free software; you can redistribute it and/or
18
+ * modify it under the terms of the GNU General Public License
19
+ * as published by the Free Software Foundation; either version 2
20
+ * of the License, or (at your option) any later version.
21
+ *
22
+ * This program is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
+ * GNU General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU General Public License
28
+ * along with this program; if not, write to the Free Software
29
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30
+ *
31
+ * @package WP-Crontrol
32
+ * @author Edward Dale <scompt@scompt.com>
33
+ * @copyright Copyright 2007 Edward Dale
34
+ * @license http://www.gnu.org/licenses/gpl.txt GPL 2.0
35
+ * @version $Id: wp-crontrol.php 42706 2008-04-25 16:46:42Z scompt $
36
+ * @link http://www.scompt.com/projects/wp-crontrol
37
+ * @since 0.2
38
+ */
39
  class Crontrol {
40
+
41
+ /**
42
+ * Hook onto all of the actions and filters needed by the plugin.
43
+ */
44
  function Crontrol() {
45
  if( function_exists('add_action') ) {
46
  add_action('init', array(&$this, 'init'));
47
  add_action('init', array(&$this, 'handle_posts'));
48
  add_action('admin_menu', array(&$this, 'admin_menu'));
49
+
50
+ // Make sure the activation works from subdirectories as well as
51
+ // directly in the plugin directory.
52
+ $activate_action = str_replace(ABSPATH.PLUGINDIR.'/', 'activate_', __FILE__);
53
+ add_action($activate_action, array(&$this, 'activate'));
54
 
55
  add_filter('cron_schedules', array(&$this, 'cron_schedules'));
56
  add_action('wp_ajax_delete-sched', array(&$this, 'handle_ajax'));
58
  }
59
  }
60
 
61
+ /**
62
+ * Run using the 'init' action.
63
+ */
64
  function init() {
65
+ load_plugin_textdomain('crontrol', str_replace(ABSPATH, '', dirname(__FILE__).'/gettext'));
66
  }
67
+
68
+ /**
69
+ * Run using the 'admin_print_scripts' action. Added in the 'admin_menu'
70
+ * hook.
71
+ */
72
  function scripts() {
73
  wp_enqueue_script( 'listman');
74
  }
75
 
76
+ /**
77
+ * Handles any ajax requests made by the plugin. Run using
78
+ * the 'wp_ajax_*' actions.
79
+ */
80
  function handle_ajax() {
81
  switch( $_POST['action'] ) {
82
  case 'delete-sched':
83
+ if( !current_user_can('manage_options') ) die('-1');
84
  $to_delete = $_POST['id'];
85
  $this->delete_schedule($to_delete);
86
  exit('1');
87
  break;
88
  case 'delete-cron':
89
+ if( !current_user_can('manage_options') ) die('-1');
90
+ $to_delete = $_POST['id'];
91
+ $this->delete_cron($to_delete);
92
+ exit('1');
93
  break;
94
  }
95
  }
96
 
97
+ /**
98
+ * Handles any POSTs made by the plugin. Run using the 'init' action.
99
+ */
100
  function handle_posts() {
101
  if( isset($_POST['new_cron']) ) {
102
+ if( !current_user_can('manage_options') ) die(__('You are not allowed to add new cron events.', 'crontrol'));
103
+ check_admin_referer("new-cron");
104
+ $next_run = $_POST['nextrun'];
105
+ $schedule = $_POST['schedule'];
106
+ $hookname = $_POST['hookname'];
107
+ $this->add_cron($next_run, $schedule, $hookname);
108
+ wp_redirect("edit.php?page=crontrol_admin_manage_page&crontrol_message=5&crontrol_name=$hookname");
109
+
110
+ } else if( isset($_POST['edit_cron']) ) {
111
+ if( !current_user_can('manage_options') ) die(__('You are not allowed to add new cron events.', 'crontrol'));
112
+ $next_run = $_POST['nextrun'];
113
+ $schedule = $_POST['schedule'];
114
+ $hookname = $_POST['hookname'];
115
+ $original_hookname = $_POST['original_hookname'];
116
+ check_admin_referer("edit-cron_{$original_hookname}");
117
+ $this->delete_cron($original_hookname);
118
+ $this->add_cron($next_run, $schedule, $hookname);
119
+ wp_redirect("edit.php?page=crontrol_admin_manage_page&crontrol_message=4&crontrol_name=$hookname");
120
 
121
  } else if( isset($_POST['new_schedule']) ) {
122
+ if( !current_user_can('manage_options') ) die(__('You are not allowed to add new cron schedules.', 'crontrol'));
123
  check_admin_referer("new-sched");
124
  $name = $_POST['internal_name'];
125
  $interval = $_POST['interval'];
126
  $display = $_POST['display_name'];
127
+
128
+ // The user entered something that wasn't a number.
129
+ // Try to convert it with strtotime
130
+ if( !is_numeric($interval) ) {
131
+ $now = time();
132
+ $future = strtotime($interval, $now);
133
+ if( $future===FALSE || $future == -1 || $now>$future) {
134
+ wp_redirect("options-general.php?page=crontrol_admin_options_page&crontrol_message=7&crontrol_name=".urlencode($interval));
135
+ return;
136
+ }
137
+ $interval = $future-$now;
138
+ } else if( $interval<=0 ) {
139
+ wp_redirect("options-general.php?page=crontrol_admin_options_page&crontrol_message=7&crontrol_name=".urlencode($interval));
140
+ return;
141
+ }
142
+
143
  $this->add_schedule($name, $interval, $display);
144
+ wp_redirect("options-general.php?page=crontrol_admin_options_page&crontrol_message=3&crontrol_name=$name");
145
 
146
  } else if( isset($_GET['action']) && $_GET['action']=='delete-sched') {
147
+ if( !current_user_can('manage_options') ) die(__('You are not allowed to delete cron schedules.', 'crontrol'));
148
  $id = $_GET['id'];
149
  check_admin_referer("delete-sched_$id");
150
  $this->delete_schedule($id);
151
+ wp_redirect("options-general.php?page=crontrol_admin_options_page&crontrol_message=2&crontrol_name=$id");
152
+
153
+ } else if( isset($_GET['action']) && $_GET['action']=='delete-cron') {
154
+ if( !current_user_can('manage_options') ) die(__('You are not allowed to delete cron events.', 'crontrol'));
155
+ $id = $_GET['id'];
156
+ check_admin_referer("delete-cron_$id");
157
+ $this->delete_cron($id);
158
+ wp_redirect("edit.php?page=crontrol_admin_manage_page&crontrol_message=6&crontrol_name=$id");
159
+
160
+ } else if( isset($_GET['action']) && $_GET['action']=='run-cron') {
161
+ if( !current_user_can('manage_options') ) die(__('You are not allowed to run cron events.', 'crontrol'));
162
+ $id = $_GET['id'];
163
+ check_admin_referer("run-cron_$id");
164
+ $this->run_cron($id);
165
+ wp_redirect("edit.php?page=crontrol_admin_manage_page&crontrol_message=1&crontrol_name=$id");
166
  }
167
  }
168
 
169
+ /**
170
+ * Executes a cron entry immediately.
171
+ *
172
+ * Executes an entry by deleting it and adding it again with a
173
+ * run time of 'now'.
174
+ *
175
+ * @param string $hookname The hookname of the cron entry to run
176
+ */
177
+ function run_cron($hookname) {
178
+ $sched = wp_get_schedule($hookname);
179
+ wp_clear_scheduled_hook($hookname);
180
+ $this->add_cron('now', $sched, $hookname);
181
+
182
+ }
183
+
184
+ /**
185
+ * Adds a new cron entry.
186
+ *
187
+ * @param string $next_run A human-readable (strtotime) time that the entry should be run at
188
+ * @param string $schedule The recurrence of the cron entry
189
+ * @param string $hookname The name of the hook to execute
190
+ */
191
+ function add_cron($next_run, $schedule, $hookname) {
192
+ $next_run = strtotime($next_run);
193
+ if( $next_run===FALSE || $next_run==-1 ) $next_run=time();
194
+ if( !wp_schedule_event( $next_run, $schedule, $hookname ) ) {
195
+ $error=True;
196
+ }
197
+ }
198
+
199
+ /**
200
+ * Deletes a cron entry.
201
+ *
202
+ * @param string $name The hookname of the entry to delete.
203
+ */
204
+ function delete_cron($to_delete) {
205
+ wp_clear_scheduled_hook($to_delete);
206
+ }
207
+
208
+ /**
209
+ * Adds a new custom cron schedule.
210
+ *
211
+ * @param string $name The internal name of the schedule
212
+ * @param int $interval The interval between executions of the new schedule
213
+ * @param string $display The display name of the schedule
214
+ */
215
  function add_schedule($name, $interval, $display) {
216
  $old_scheds = get_option('crontrol_schedules');
217
+ $old_scheds[$name] = array('interval'=>$interval, 'display'=>$display);
218
  update_option('crontrol_schedules', $old_scheds);
219
  }
220
+
221
+ /**
222
+ * Deletes a custom cron schedule.
223
+ *
224
+ * @param string $name The internal_name of the schedule to delete.
225
+ */
226
  function delete_schedule($name) {
227
  $scheds = get_option('crontrol_schedules');
228
  unset($scheds[$name]);
229
  update_option('crontrol_schedules', $scheds);
230
  }
231
 
232
+ /**
233
+ * Sets up the plugin environment upon first activation.
234
+ *
235
+ * Run using the 'activate_' action.
236
+ */
237
  function activate() {
238
+ $extra_scheds = array('twicedaily'=>array('interval'=>43200, 'display'=>__('Twice Daily', 'crontrol')));
239
  add_option('crontrol_schedules', $extra_scheds);
240
+
241
+ // if there's never been a cron entry, _get_cron_array will return FALSE
242
+ if( _get_cron_array() === FALSE ) {
243
+ _set_cron_array(array());
244
+ }
245
  }
246
 
247
+ /**
248
+ * Adds options & management pages to the admin menu.
249
+ *
250
+ * Run using the 'admin_menu' action.
251
+ */
252
  function admin_menu() {
 
253
  $page = add_options_page('Crontrol', 'Crontrol', 'manage_options', 'crontrol_admin_options_page', array(&$this, 'admin_options_page') );
254
  add_action("admin_print_scripts-$page", array(&$this, 'scripts') );
255
 
256
+ $page = add_management_page('Crontrol', "Crontrol", 'manage_options', 'crontrol_admin_manage_page', array(&$this, 'admin_manage_page') );
257
+ add_action("admin_print_scripts-$page", array(&$this, 'scripts') );
 
 
 
258
  }
259
 
260
+ /**
261
+ * Gives WordPress the plugin's set of cron schedules.
262
+ *
263
+ * Called by the 'cron_schedules' filter.
264
+ *
265
+ * @param array $scheds The current cron schedules. Usually an empty array.
266
+ * @return array The existing cron schedules along with the plugin's schedules.
267
+ */
268
  function cron_schedules($scheds) {
269
  $new_scheds = get_option('crontrol_schedules');
270
+ return array_merge($new_scheds, $scheds);
271
  }
272
 
273
+ /**
274
+ * Displays the options page for the plugin.
275
+ */
276
  function admin_options_page() {
277
  $schedules = wp_get_schedules();
278
  $custom_schedules = get_option('crontrol_schedules');
279
  $custom_keys = array_keys($custom_schedules);
280
  uasort($schedules, create_function('$a,$b', 'return $a["interval"]-$b["interval"];'));
281
 
282
+ if( isset($_GET['crontrol_message']) ) {
283
+ $messages = array( '2' => __("Successfully deleted the cron schedule <b>%s</b>", 'crontrol'),
284
+ '3' => __("Successfully added the cron schedule <b>%s</b>", 'crontrol'),
285
+ '7' => __("Cron schedule not added because there was a problem parsing <b>%s</b>", 'crontrol'));
286
+ $hook = $_GET['crontrol_name'];
287
+ $msg = sprintf($messages[$_GET['crontrol_message']], $hook);
288
+
289
+ echo "<div id=\"message\" class=\"updated fade\"><p>$msg</p></div>";
290
+ }
291
+
292
  ?>
293
  <div class="wrap">
294
+ <h2><?php _e("Cron Schedules", "crontrol"); ?></h2>
295
+ <p><?php _e('Cron schedules are the time intervals that are available to WordPress and plugin developers to schedule events. You can only delete cron schedules that you have created with WP-Crontrol.', 'crontrol'); ?></p>
296
+ <div id="ajax-response"></div>
297
  <table class="widefat" id="the-list">
298
  <thead>
299
  <tr>
300
+ <th><?php _e('Name', 'crontrol'); ?></th>
301
+ <th><?php _e('Interval', 'crontrol'); ?></th>
302
+ <th><?php _e('Display Name', 'crontrol'); ?></th>
303
+ <th><?php _e('Actions', 'crontrol'); ?></th>
304
  </tr>
305
  </thead>
306
  <tbody>
307
  <?php
308
+ if( empty($schedules) ) {
309
+ ?>
310
+ <tr colspan="4"><td><?php _e('You currently have no cron schedules. Add one below!', 'crontrol') ?></td></tr>
311
+ <?php
312
+ } else {
313
+ $class = "";
314
+ foreach( $schedules as $name=>$data ) {
315
+ echo "<tr id=\"sched-$name\" class=\"$class\">";
316
+ echo "<td>$name</td>";
317
+ echo "<td>{$data['interval']} (".$this->interval($data['interval']).")</td>";
318
+ echo "<td>{$data['display']}</td>";
319
+ if( in_array($name, $custom_keys) ) {
320
+ echo "<td><a href='" . wp_nonce_url( "options-general.php?page=crontrol_admin_options_page&amp;action=delete-sched&amp;id=$name", 'delete-sched_' . $name ) . "' onclick=\"return deleteSomething( 'sched', '$name', '" . js_escape(sprintf( __("You are about to delete the schedule '%s'.\n'OK' to delete, 'Cancel' to stop.", 'crontrol' ), $name)) . "' );\" class='delete'>".__( 'Delete' )."</a></td>";
321
+ } else {
322
+ echo "<td>&nbsp;</td>\n";
323
+ }
324
+ echo "</tr>";
325
+ $class = empty($class)?"alternate":"";
326
  }
327
+ }
 
 
 
328
  ?>
329
  </tbody>
330
  </table>
331
  </div>
332
  <div class="wrap narrow">
333
+ <h2><?php _e('Add new cron schedule', 'crontrol'); ?></h2>
334
+ <p><?php _e('Adding a new cron schedule will allow you to schedule events that re-occur at the given interval.', 'crontrol'); ?></p>
 
335
  <form method="post" action="options-general.php?page=crontrol_admin_options_page">
336
+ <table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
337
  <tbody>
338
  <tr>
339
+ <th width="33%" valign="top" scope="row"><label for="internal_name"><?php _e('Internal name', 'crontrol'); ?>:</label></th>
340
  <td width="67%"><input type="text" size="40" value="" id="internal_name" name="internal_name"/></td>
341
  </tr>
342
  <tr>
343
+ <th width="33%" valign="top" scope="row"><label for="interval"><?php _e('Interval', 'crontrol'); ?>:</label></th>
344
  <td width="67%"><input type="text" size="40" value="" id="interval" name="interval"/></td>
345
  </tr>
346
  <tr>
347
+ <th width="33%" valign="top" scope="row"><label for="display_name"><?php _e('Display name', 'crontrol'); ?>:</label></th>
348
  <td width="67%"><input type="text" size="40" value="" id="display_name" name="display_name"/></td>
349
  </tr>
350
  </tbody></table>
351
+ <p class="submit"><input id="schedadd-submit" type="submit" value="<?php _e('Add Cron Schedule &raquo;', 'crontrol'); ?>" name="new_schedule"/></p>
352
  <?php wp_nonce_field('new-sched') ?>
353
  </form>
354
  </div>
355
  <?php
356
  }
357
+
358
+ /**
359
+ * Displays the manage page for the plugin.
360
+ */
361
  function admin_manage_page() {
362
+ if( isset($_GET['crontrol_message']) ) {
363
+ $messages = array( '1' => __('Successfully executed the cron entry <b>%s</b>', 'crontrol'),
364
+ '4' => __('Successfully edited the cron entry <b>%s</b>', 'crontrol'),
365
+ '5' => __('Successfully created the cron entry <b>%s</b>', 'crontrol'),
366
+ '6' => __('Successfully deleted the cron entry <b>%s</b>', 'crontrol'));
367
+ $hook = $_GET['crontrol_name'];
368
+ $msg = sprintf($messages[$_GET['crontrol_message']], $hook);
369
+
370
+ echo "<div id=\"message\" class=\"updated fade\"><p>$msg</p></div>";
371
+ }
372
  $crons = _get_cron_array();
373
  $schedules = wp_get_schedules();
374
+ $doing_edit = (isset( $_GET['action']) && $_GET['action']=='edit-cron') ? $_GET['id'] : false ;
375
  ?>
376
  <div class="wrap">
377
+ <h2><?php _e('WP-Cron Entries', 'crontrol'); ?></h2>
378
  <p></p>
379
+ <div id="ajax-response"></div>
380
+ <table class="widefat" id="the-list">
381
  <thead>
382
  <tr>
383
+ <th><?php _e('Hook Name', 'crontrol'); ?></th>
384
+ <th><?php _e('Next Run', 'crontrol'); ?></th>
385
+ <th><?php _e('Recurrence', 'crontrol'); ?></th>
386
+ <th colspan="3"><?php _e('Actions', 'crontrol'); ?></th>
387
  </tr>
388
  </thead>
389
  <tbody>
390
  <?php
391
+ if( empty($crons) ) {
392
+ ?>
393
+ <tr colspan="6"><td><?php _e('You currently have no cron entries. Add one below!', 'crontrol') ?></td></tr>
394
+ <?php
395
+ } else {
396
+ $class = "";
397
+ foreach( $crons as $time=>$cron ) {
398
+ foreach( $cron as $hook=>$data) {
399
+ $data = array_shift($data);
400
+ if( $doing_edit && $doing_edit==$hook ) {
401
+ $doing_edit = array('hookname'=>$hook,
402
+ 'nextrun'=>$time,
403
+ 'schedule'=>$data['schedule']);
404
+ }
405
+
406
+ echo "<tr id=\"cron-$hook\" class=\"$class\">";
407
+ echo "<td>$hook</td>";
408
+ echo "<td>".strftime("%D %T", $time)." (".$this->time_since(time(), $time).")</td>";
409
+ echo "<td>{$data['interval']} (".$this->interval($data['interval']).")</td>";
410
+ echo "<td><a class='view' href='edit.php?page=crontrol_admin_manage_page&amp;action=edit-cron&amp;id=$hook'>Edit</a></td>";
411
+ echo "<td><a class='view' href='".wp_nonce_url("edit.php?page=crontrol_admin_manage_page&amp;action=run-cron&amp;id=$hook", 'run-cron_' . $hook)."' onclick=\"return confirm('". js_escape(sprintf(__("You are about to execute a cron entry.\nPress 'OK' to continue or 'Cancel' to stop.", 'crontrol')))."');\">Do Now</a></td>";
412
+ echo "<td><a class='delete' href='".wp_nonce_url("edit.php?page=crontrol_admin_manage_page&amp;action=delete-cron&amp;id=$hook", 'delete-cron_' . $hook)."' onclick=\"return deleteSomething( 'cron', '$hook', '" . js_escape(sprintf( __("You are about to delete the cron entry '%s'.\n'OK' to delete, 'Cancel' to stop.", 'crontrol'), $hook)) . "' );\">Delete</a></td>";
413
+ echo "</tr>";
414
+ $class = empty($class)?"alternate":"";
415
+ }
416
  }
417
  }
418
  ?>
419
  </tbody>
420
  </table>
421
  </div>
422
+ <?php if( is_array( $doing_edit ) ): ?>
423
  <div class="wrap narrow">
424
+ <h2><?php _e('Edit cron entry', 'crontrol'); ?> (<a href="edit.php?page=crontrol_admin_manage_page"><?php _e('Add new', 'crontrol'); ?></a>)</h2>
 
425
  <form method="post">
426
+ <?php wp_nonce_field('edit-cron_'.$doing_edit['hookname']) ?>
427
+ <input name="original_hookname" type="hidden" value="<?php echo $doing_edit['hookname'] ?>" />
428
  <table width="100%" cellspacing="2" cellpadding="5" class="editform">
429
  <tbody><tr>
430
+ <th width="33%" valign="top" scope="row"><label for="hookname"><?php _e('Hook name', 'crontrol'); ?>:</label></th>
431
+ <td width="67%"><input type="text" size="40" id="hookname" name="hookname" value="<?php echo $doing_edit['hookname'] ?>"/></td>
432
+ </tr><tr>
433
+ <th width="33%" valign="top" scope="row"><label for="nextrun"><?php _e('Next run', 'crontrol'); ?>:</label></th>
434
+ <td width="67%"><input type="text" size="40" id="nextrun" name="nextrun" value="<?php echo strftime("%D %T", $doing_edit['nextrun']) ?>"/></td>
435
+ </tr><tr>
436
+ <th valign="top" scope="row"><label for="schedule"><?php _e('Entry schedule', 'crontrol'); ?>:</label></th>
437
+ <td>
438
+ <select class="postform" name="schedule">
439
+ <?php
440
+ foreach( $schedules as $sched_name=>$sched_data ) {
441
+ $selected = $doing_edit['schedule']==$sched_name ? 'selected="selected"' : '';
442
+ echo "<option $selected value=\"$sched_name\">{$sched_data['display']} (".$this->interval($sched_data['interval']).")</option>\n";
443
+ }
444
+ ?>
445
+ </select>
446
+ </td>
447
  </tr>
448
+ </tbody></table>
449
+ <p class="submit"><input type="submit" value="<?php _e('Modify Cron Entry &raquo;', 'crontrol'); ?>" name="edit_cron"/></p>
450
+ </form>
451
+ </div>
452
+ <?php else: ?>
453
+ <div class="wrap narrow">
454
+ <h2><?php _e('Add new cron entry', 'crontrol'); ?></h2>
455
+ <p><?php _e('Cron entries trigger actions in your code. After adding a new cron entry here, you will need to add a corresponding action hook somewhere in code, perhaps the <code>functions.php</code> file in your theme.', 'crontrol'); ?></p>
456
+ <form method="post">
457
+ <?php wp_nonce_field('new-cron') ?>
458
+ <table width="100%" cellspacing="2" cellpadding="5" class="editform form-table">
459
+ <tbody><tr>
460
+ <th width="33%" valign="top" scope="row"><label for="hookname"><?php _e('Hook name', 'crontrol'); ?>:</label></th>
461
+ <td width="67%"><input type="text" size="40" value="" id="hookname" name="hookname"/></td>
462
+ </tr><tr>
463
+ <th width="33%" valign="top" scope="row"><label for="nextrun"><?php _e('Next run', 'crontrol'); ?>:</label></th>
464
+ <td width="67%"><input type="text" size="40" value="now" id="nextrun" name="nextrun"/></td>
465
+ </tr><tr>
466
+ <th valign="top" scope="row"><label for="schedule"><?php _e('Entry schedule', 'crontrol'); ?>:</label></th>
467
  <td>
468
  <select class="postform" name="schedule">
469
  <?php
470
  foreach( $schedules as $sched_name=>$sched_data ) {
471
+ echo "<option value=\"$sched_name\">{$sched_data['display']} (".$this->interval($sched_data['interval']).")</option>\n";
472
  }
473
  ?>
474
  </select>
475
  </td>
476
  </tr>
477
  </tbody></table>
478
+ <p class="submit"><input type="submit" value="<?php _e('Add Cron Entry &raquo;', 'crontrol'); ?>" name="new_cron"/></p>
479
  </form>
480
+ </div>
481
+ <?php endif;
482
  }
483
 
484
  /**
485
+ * Pretty-prints the difference in two times.
486
+ *
487
+ * @param time $older_date
488
+ * @param time $newer_date
489
+ * @return string The pretty time_since value
490
+ * @link http://binarybonsai.com/code/timesince.txt
491
  */
492
+ function time_since($older_date, $newer_date) {
493
+ return $this->interval( $newer_date - $older_date );
494
+ }
495
+
496
+ function interval( $since ) {
497
+ // array of time period chunks
498
  $chunks = array(
499
+ array(60 * 60 * 24 * 365 , 'year'),
500
+ array(60 * 60 * 24 * 30 , 'month'),
501
+ array(60 * 60 * 24 * 7, 'week'),
502
+ array(60 * 60 * 24 , 'day'),
503
+ array(60 * 60 , 'hour'),
504
+ array(60 , 'minute'),
505
+ array( 1 , 'second'),
506
  );
507
 
 
 
508
  if( $since <= 0 ) {
509
+ return __('now', 'crontrol');
510
  }
511
 
512
  // we only want to output two chunks of time here, eg:
544
  }
545
 
546
  return $output;
547
+ }
 
548
  }
549
 
550
+ // Get this show on the road
551
  new Crontrol();
552
  ?>