Version Description
Fixed invalid html Fixed i18n issues with dates Fixed problem when using "Network Activate" - reworked plugin activation process Replaced "Upgrade" tab with new "Diagnostics" tab Reworked expire logic to limit the number of sql queries needed Added debugging
Download this release
Release Info
Developer | axelseaa |
Plugin | Post Expirator |
Version | 1.6 |
Comparing to | |
See all releases |
Code changes from version 1.5.4 to 1.6
- languages/post-expirator.pot +192 -75
- post-expirator-debug.php +65 -0
- post-expirator.php +297 -164
- readme.txt +21 -3
- style.css +14 -0
languages/post-expirator.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the same license as the Post Expirator package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Post Expirator 1.
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-expirator\n"
|
7 |
-
"POT-Creation-Date: 2012-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -12,160 +12,172 @@ msgstr ""
|
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
|
15 |
-
#: post-expirator.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
msgid "l F jS, Y"
|
17 |
msgstr ""
|
18 |
|
19 |
-
#: post-expirator.php:
|
20 |
msgid "g:ia"
|
21 |
msgstr ""
|
22 |
|
23 |
-
#: post-expirator.php:
|
24 |
msgid "Post expires at EXPIRATIONTIME on EXPIRATIONDATE"
|
25 |
msgstr ""
|
26 |
|
27 |
-
#: post-expirator.php:
|
28 |
msgid "Once a Minute"
|
29 |
msgstr ""
|
30 |
|
31 |
-
#: post-expirator.php:
|
32 |
-
msgid "Post Expirator cron
|
33 |
msgstr ""
|
34 |
|
35 |
-
#: post-expirator.php:
|
36 |
msgid "Click here to reset"
|
37 |
msgstr ""
|
38 |
|
39 |
-
#: post-expirator.php:
|
40 |
msgid "Expires"
|
41 |
msgstr ""
|
42 |
|
43 |
-
#: post-expirator.php:
|
44 |
msgid "Never"
|
45 |
msgstr ""
|
46 |
|
47 |
-
#. #-#-#-#-# plugin.pot (Post Expirator 1.
|
48 |
#. Plugin Name of the plugin/theme
|
49 |
-
#: post-expirator.php:
|
50 |
msgid "Post Expirator"
|
51 |
msgstr ""
|
52 |
|
53 |
-
#: post-expirator.php:
|
54 |
msgid "Enable Post Expiration"
|
55 |
msgstr ""
|
56 |
|
57 |
-
#: post-expirator.php:
|
58 |
msgid "Year"
|
59 |
msgstr ""
|
60 |
|
61 |
-
#: post-expirator.php:
|
62 |
msgid "Month"
|
63 |
msgstr ""
|
64 |
|
65 |
-
#: post-expirator.php:
|
66 |
msgid "Day"
|
67 |
msgstr ""
|
68 |
|
69 |
-
#: post-expirator.php:
|
70 |
msgid "Hour"
|
71 |
msgstr ""
|
72 |
|
73 |
-
#: post-expirator.php:
|
74 |
msgid "Minute"
|
75 |
msgstr ""
|
76 |
|
77 |
-
#: post-expirator.php:
|
78 |
-
msgid "H"
|
79 |
-
msgstr ""
|
80 |
-
|
81 |
-
#: post-expirator.php:273
|
82 |
msgid "Expiration Categories"
|
83 |
msgstr ""
|
84 |
|
85 |
-
#: post-expirator.php:
|
86 |
msgid ""
|
87 |
"Setting an expiration category will change the category at expiration time, "
|
88 |
"and override the default post action"
|
89 |
msgstr ""
|
90 |
|
91 |
-
#: post-expirator.php:
|
92 |
-
msgid "
|
93 |
msgstr ""
|
94 |
|
95 |
-
#: post-expirator.php:
|
96 |
-
msgid "
|
|
|
|
|
|
|
|
|
97 |
msgstr ""
|
98 |
|
99 |
-
#: post-expirator.php:
|
100 |
-
msgid "
|
101 |
msgstr ""
|
102 |
|
103 |
-
#: post-expirator.php:
|
104 |
msgid "Saved Options!"
|
105 |
msgstr ""
|
106 |
|
107 |
-
#: post-expirator.php:
|
108 |
msgid ""
|
109 |
"The post expirator plugin sets a custom meta value, and then optionally "
|
110 |
"allows you to select if you want the post changed to a draft status or "
|
111 |
"deleted when it expires."
|
112 |
msgstr ""
|
113 |
|
114 |
-
#: post-expirator.php:
|
115 |
msgid "Valid [postexpirator] attributes:"
|
116 |
msgstr ""
|
117 |
|
118 |
-
#: post-expirator.php:
|
119 |
msgid "type - defaults to full - valid options are full,date,time"
|
120 |
msgstr ""
|
121 |
|
122 |
-
#: post-expirator.php:
|
123 |
msgid ""
|
124 |
"dateformat - format set here will override the value set on the settings page"
|
125 |
msgstr ""
|
126 |
|
127 |
-
#: post-expirator.php:
|
128 |
msgid ""
|
129 |
"timeformat - format set here will override the value set on the settings page"
|
130 |
msgstr ""
|
131 |
|
132 |
-
#: post-expirator.php:
|
133 |
msgid "Defaults"
|
134 |
msgstr ""
|
135 |
|
136 |
-
#: post-expirator.php:
|
137 |
msgid "Set Post To:"
|
138 |
msgstr ""
|
139 |
|
140 |
-
#: post-expirator.php:
|
141 |
msgid "Draft"
|
142 |
msgstr ""
|
143 |
|
144 |
-
#: post-expirator.php:
|
145 |
msgid "Delete"
|
146 |
msgstr ""
|
147 |
|
148 |
-
#: post-expirator.php:
|
149 |
msgid ""
|
150 |
"Select whether the post should be deleted or changed to a draft at "
|
151 |
"expiration time."
|
152 |
msgstr ""
|
153 |
|
154 |
-
#: post-expirator.php:
|
155 |
msgid "Set Page To:"
|
156 |
msgstr ""
|
157 |
|
158 |
-
#: post-expirator.php:
|
159 |
msgid ""
|
160 |
"Select whether the page should be deleted or changed to a draft at "
|
161 |
"expiration time."
|
162 |
msgstr ""
|
163 |
|
164 |
-
#: post-expirator.php:
|
165 |
msgid "Date Format:"
|
166 |
msgstr ""
|
167 |
|
168 |
-
#: post-expirator.php:
|
169 |
msgid ""
|
170 |
"The default format to use when displaying the expiration date within a post "
|
171 |
"using the [postexpirator] shortcode or within the footer. For information "
|
@@ -173,11 +185,11 @@ msgid ""
|
|
173 |
"function.date.php\" target=\"_blank\">PHP Date Function</a>."
|
174 |
msgstr ""
|
175 |
|
176 |
-
#: post-expirator.php:
|
177 |
msgid "Time Format:"
|
178 |
msgstr ""
|
179 |
|
180 |
-
#: post-expirator.php:
|
181 |
msgid ""
|
182 |
"The default format to use when displaying the expiration time within a post "
|
183 |
"using the [postexpirator] shortcode or within the footer. For information "
|
@@ -185,107 +197,212 @@ msgid ""
|
|
185 |
"function.date.php\" target=\"_blank\">PHP Date Function</a>."
|
186 |
msgstr ""
|
187 |
|
188 |
-
#: post-expirator.php:
|
189 |
msgid "Category Expiration"
|
190 |
msgstr ""
|
191 |
|
192 |
-
#: post-expirator.php:
|
193 |
msgid "Enable Post Expiration to Category?"
|
194 |
msgstr ""
|
195 |
|
196 |
-
#: post-expirator.php:
|
197 |
msgid "Enabled"
|
198 |
msgstr ""
|
199 |
|
200 |
-
#: post-expirator.php:
|
201 |
msgid "Disabled"
|
202 |
msgstr ""
|
203 |
|
204 |
-
#: post-expirator.php:
|
205 |
msgid "This will enable or disable the ability to expire a post to a category."
|
206 |
msgstr ""
|
207 |
|
208 |
-
#: post-expirator.php:
|
209 |
msgid "Default Expiration Category"
|
210 |
msgstr ""
|
211 |
|
212 |
-
#: post-expirator.php:
|
213 |
msgid "Set's the default expiration category for the post."
|
214 |
msgstr ""
|
215 |
|
216 |
-
#: post-expirator.php:
|
217 |
msgid "Post Footer Display"
|
218 |
msgstr ""
|
219 |
|
220 |
-
#: post-expirator.php:
|
221 |
msgid ""
|
222 |
"Enabling this below will display the expiration date automatically at the "
|
223 |
"end of any post which is set to expire."
|
224 |
msgstr ""
|
225 |
|
226 |
-
#: post-expirator.php:
|
227 |
msgid "Show in post footer?"
|
228 |
msgstr ""
|
229 |
|
230 |
-
#: post-expirator.php:
|
231 |
msgid ""
|
232 |
"This will enable or disable displaying the post expiration date in the post "
|
233 |
"footer."
|
234 |
msgstr ""
|
235 |
|
236 |
-
#: post-expirator.php:
|
237 |
msgid "Footer Contents:"
|
238 |
msgstr ""
|
239 |
|
240 |
-
#: post-expirator.php:
|
241 |
msgid ""
|
242 |
"Enter the text you would like to appear at the bottom of every post that "
|
243 |
"will expire. The following placeholders will be replaced with the post "
|
244 |
"expiration date in the following format:"
|
245 |
msgstr ""
|
246 |
|
247 |
-
#: post-expirator.php:
|
248 |
msgid "Footer Style:"
|
249 |
msgstr ""
|
250 |
|
251 |
-
#: post-expirator.php:
|
252 |
msgid "This post will expire on"
|
253 |
msgstr ""
|
254 |
|
255 |
-
#: post-expirator.php:
|
256 |
msgid "The inline css which will be used to style the footer text."
|
257 |
msgstr ""
|
258 |
|
259 |
-
#: post-expirator.php:
|
260 |
msgid "Save"
|
261 |
msgstr ""
|
262 |
|
263 |
-
#: post-expirator.php:
|
264 |
-
msgid "Cron
|
265 |
msgstr ""
|
266 |
|
267 |
-
#: post-expirator.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
msgid "OK"
|
269 |
msgstr ""
|
270 |
|
271 |
-
#: post-expirator.php:
|
272 |
msgid "RESET NEEDED"
|
273 |
msgstr ""
|
274 |
|
275 |
-
#: post-expirator.php:
|
276 |
-
msgid "
|
277 |
msgstr ""
|
278 |
|
279 |
-
#: post-expirator.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
msgid "Reset"
|
281 |
msgstr ""
|
282 |
|
283 |
-
#: post-expirator.php:
|
284 |
msgid "Status:"
|
285 |
msgstr ""
|
286 |
|
287 |
-
#: post-expirator.php:
|
288 |
-
msgid "Resets the cron
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
289 |
msgstr ""
|
290 |
|
291 |
#. Plugin URI of the plugin/theme
|
2 |
# This file is distributed under the same license as the Post Expirator package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Post Expirator 1.6\n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/post-expirator\n"
|
7 |
+
"POT-Creation-Date: 2012-06-19 02:54:45+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
|
15 |
+
#: post-expirator-debug.php:48
|
16 |
+
msgid "Debugging table is currently empty."
|
17 |
+
msgstr ""
|
18 |
+
|
19 |
+
#: post-expirator-debug.php:52
|
20 |
+
msgid "Timestamp"
|
21 |
+
msgstr ""
|
22 |
+
|
23 |
+
#: post-expirator-debug.php:53
|
24 |
+
msgid "Message"
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: post-expirator.php:20
|
28 |
msgid "l F jS, Y"
|
29 |
msgstr ""
|
30 |
|
31 |
+
#: post-expirator.php:21
|
32 |
msgid "g:ia"
|
33 |
msgstr ""
|
34 |
|
35 |
+
#: post-expirator.php:22
|
36 |
msgid "Post expires at EXPIRATIONTIME on EXPIRATIONDATE"
|
37 |
msgstr ""
|
38 |
|
39 |
+
#: post-expirator.php:43
|
40 |
msgid "Once a Minute"
|
41 |
msgstr ""
|
42 |
|
43 |
+
#: post-expirator.php:55
|
44 |
+
msgid "Post Expirator cron events need to be reset. "
|
45 |
msgstr ""
|
46 |
|
47 |
+
#: post-expirator.php:57
|
48 |
msgid "Click here to reset"
|
49 |
msgstr ""
|
50 |
|
51 |
+
#: post-expirator.php:135
|
52 |
msgid "Expires"
|
53 |
msgstr ""
|
54 |
|
55 |
+
#: post-expirator.php:151
|
56 |
msgid "Never"
|
57 |
msgstr ""
|
58 |
|
59 |
+
#. #-#-#-#-# plugin.pot (Post Expirator 1.6) #-#-#-#-#
|
60 |
#. Plugin Name of the plugin/theme
|
61 |
+
#: post-expirator.php:163 post-expirator.php:165 post-expirator.php:398
|
62 |
msgid "Post Expirator"
|
63 |
msgstr ""
|
64 |
|
65 |
+
#: post-expirator.php:197
|
66 |
msgid "Enable Post Expiration"
|
67 |
msgstr ""
|
68 |
|
69 |
+
#: post-expirator.php:199
|
70 |
msgid "Year"
|
71 |
msgstr ""
|
72 |
|
73 |
+
#: post-expirator.php:200
|
74 |
msgid "Month"
|
75 |
msgstr ""
|
76 |
|
77 |
+
#: post-expirator.php:201
|
78 |
msgid "Day"
|
79 |
msgstr ""
|
80 |
|
81 |
+
#: post-expirator.php:233
|
82 |
msgid "Hour"
|
83 |
msgstr ""
|
84 |
|
85 |
+
#: post-expirator.php:234
|
86 |
msgid "Minute"
|
87 |
msgstr ""
|
88 |
|
89 |
+
#: post-expirator.php:256
|
|
|
|
|
|
|
|
|
90 |
msgid "Expiration Categories"
|
91 |
msgstr ""
|
92 |
|
93 |
+
#: post-expirator.php:266
|
94 |
msgid ""
|
95 |
"Setting an expiration category will change the category at expiration time, "
|
96 |
"and override the default post action"
|
97 |
msgstr ""
|
98 |
|
99 |
+
#: post-expirator.php:368
|
100 |
+
msgid "General Settings"
|
101 |
msgstr ""
|
102 |
|
103 |
+
#: post-expirator.php:369
|
104 |
+
msgid "Diagnostics"
|
105 |
+
msgstr ""
|
106 |
+
|
107 |
+
#: post-expirator.php:370
|
108 |
+
msgid "View Debug Logs"
|
109 |
msgstr ""
|
110 |
|
111 |
+
#: post-expirator.php:381 post-expirator.php:398
|
112 |
+
msgid "Post Expirator Options"
|
113 |
msgstr ""
|
114 |
|
115 |
+
#: post-expirator.php:418
|
116 |
msgid "Saved Options!"
|
117 |
msgstr ""
|
118 |
|
119 |
+
#: post-expirator.php:479
|
120 |
msgid ""
|
121 |
"The post expirator plugin sets a custom meta value, and then optionally "
|
122 |
"allows you to select if you want the post changed to a draft status or "
|
123 |
"deleted when it expires."
|
124 |
msgstr ""
|
125 |
|
126 |
+
#: post-expirator.php:482
|
127 |
msgid "Valid [postexpirator] attributes:"
|
128 |
msgstr ""
|
129 |
|
130 |
+
#: post-expirator.php:484
|
131 |
msgid "type - defaults to full - valid options are full,date,time"
|
132 |
msgstr ""
|
133 |
|
134 |
+
#: post-expirator.php:485
|
135 |
msgid ""
|
136 |
"dateformat - format set here will override the value set on the settings page"
|
137 |
msgstr ""
|
138 |
|
139 |
+
#: post-expirator.php:486
|
140 |
msgid ""
|
141 |
"timeformat - format set here will override the value set on the settings page"
|
142 |
msgstr ""
|
143 |
|
144 |
+
#: post-expirator.php:490
|
145 |
msgid "Defaults"
|
146 |
msgstr ""
|
147 |
|
148 |
+
#: post-expirator.php:493
|
149 |
msgid "Set Post To:"
|
150 |
msgstr ""
|
151 |
|
152 |
+
#: post-expirator.php:496 post-expirator.php:507
|
153 |
msgid "Draft"
|
154 |
msgstr ""
|
155 |
|
156 |
+
#: post-expirator.php:497 post-expirator.php:508
|
157 |
msgid "Delete"
|
158 |
msgstr ""
|
159 |
|
160 |
+
#: post-expirator.php:500
|
161 |
msgid ""
|
162 |
"Select whether the post should be deleted or changed to a draft at "
|
163 |
"expiration time."
|
164 |
msgstr ""
|
165 |
|
166 |
+
#: post-expirator.php:504
|
167 |
msgid "Set Page To:"
|
168 |
msgstr ""
|
169 |
|
170 |
+
#: post-expirator.php:511
|
171 |
msgid ""
|
172 |
"Select whether the page should be deleted or changed to a draft at "
|
173 |
"expiration time."
|
174 |
msgstr ""
|
175 |
|
176 |
+
#: post-expirator.php:515
|
177 |
msgid "Date Format:"
|
178 |
msgstr ""
|
179 |
|
180 |
+
#: post-expirator.php:519
|
181 |
msgid ""
|
182 |
"The default format to use when displaying the expiration date within a post "
|
183 |
"using the [postexpirator] shortcode or within the footer. For information "
|
185 |
"function.date.php\" target=\"_blank\">PHP Date Function</a>."
|
186 |
msgstr ""
|
187 |
|
188 |
+
#: post-expirator.php:523
|
189 |
msgid "Time Format:"
|
190 |
msgstr ""
|
191 |
|
192 |
+
#: post-expirator.php:527
|
193 |
msgid ""
|
194 |
"The default format to use when displaying the expiration time within a post "
|
195 |
"using the [postexpirator] shortcode or within the footer. For information "
|
197 |
"function.date.php\" target=\"_blank\">PHP Date Function</a>."
|
198 |
msgstr ""
|
199 |
|
200 |
+
#: post-expirator.php:531
|
201 |
msgid "Category Expiration"
|
202 |
msgstr ""
|
203 |
|
204 |
+
#: post-expirator.php:534
|
205 |
msgid "Enable Post Expiration to Category?"
|
206 |
msgstr ""
|
207 |
|
208 |
+
#: post-expirator.php:536 post-expirator.php:565
|
209 |
msgid "Enabled"
|
210 |
msgstr ""
|
211 |
|
212 |
+
#: post-expirator.php:537 post-expirator.php:566
|
213 |
msgid "Disabled"
|
214 |
msgstr ""
|
215 |
|
216 |
+
#: post-expirator.php:539
|
217 |
msgid "This will enable or disable the ability to expire a post to a category."
|
218 |
msgstr ""
|
219 |
|
220 |
+
#: post-expirator.php:543
|
221 |
msgid "Default Expiration Category"
|
222 |
msgstr ""
|
223 |
|
224 |
+
#: post-expirator.php:554
|
225 |
msgid "Set's the default expiration category for the post."
|
226 |
msgstr ""
|
227 |
|
228 |
+
#: post-expirator.php:559
|
229 |
msgid "Post Footer Display"
|
230 |
msgstr ""
|
231 |
|
232 |
+
#: post-expirator.php:560
|
233 |
msgid ""
|
234 |
"Enabling this below will display the expiration date automatically at the "
|
235 |
"end of any post which is set to expire."
|
236 |
msgstr ""
|
237 |
|
238 |
+
#: post-expirator.php:563
|
239 |
msgid "Show in post footer?"
|
240 |
msgstr ""
|
241 |
|
242 |
+
#: post-expirator.php:568
|
243 |
msgid ""
|
244 |
"This will enable or disable displaying the post expiration date in the post "
|
245 |
"footer."
|
246 |
msgstr ""
|
247 |
|
248 |
+
#: post-expirator.php:572
|
249 |
msgid "Footer Contents:"
|
250 |
msgstr ""
|
251 |
|
252 |
+
#: post-expirator.php:576
|
253 |
msgid ""
|
254 |
"Enter the text you would like to appear at the bottom of every post that "
|
255 |
"will expire. The following placeholders will be replaced with the post "
|
256 |
"expiration date in the following format:"
|
257 |
msgstr ""
|
258 |
|
259 |
+
#: post-expirator.php:585
|
260 |
msgid "Footer Style:"
|
261 |
msgstr ""
|
262 |
|
263 |
+
#: post-expirator.php:588
|
264 |
msgid "This post will expire on"
|
265 |
msgstr ""
|
266 |
|
267 |
+
#: post-expirator.php:590
|
268 |
msgid "The inline css which will be used to style the footer text."
|
269 |
msgstr ""
|
270 |
|
271 |
+
#: post-expirator.php:595
|
272 |
msgid "Save"
|
273 |
msgstr ""
|
274 |
|
275 |
+
#: post-expirator.php:655
|
276 |
+
msgid "Cron Events Reset! (Reload page to remove warning)"
|
277 |
msgstr ""
|
278 |
|
279 |
+
#: post-expirator.php:658
|
280 |
+
msgid "Debugging Disabled"
|
281 |
+
msgstr ""
|
282 |
+
|
283 |
+
#: post-expirator.php:661
|
284 |
+
msgid "Debugging Enabled"
|
285 |
+
msgstr ""
|
286 |
+
|
287 |
+
#: post-expirator.php:666
|
288 |
+
msgid "Debugging Table Emptied"
|
289 |
+
msgstr ""
|
290 |
+
|
291 |
+
#: post-expirator.php:670 post-expirator.php:674
|
292 |
msgid "OK"
|
293 |
msgstr ""
|
294 |
|
295 |
+
#: post-expirator.php:671
|
296 |
msgid "RESET NEEDED"
|
297 |
msgstr ""
|
298 |
|
299 |
+
#: post-expirator.php:675
|
300 |
+
msgid "ERROR WITH FILTER"
|
301 |
msgstr ""
|
302 |
|
303 |
+
#: post-expirator.php:681
|
304 |
+
msgid "Cron Settings"
|
305 |
+
msgstr ""
|
306 |
+
|
307 |
+
#: post-expirator.php:684
|
308 |
+
msgid "Reset Cron Event:"
|
309 |
+
msgstr ""
|
310 |
+
|
311 |
+
#: post-expirator.php:686
|
312 |
msgid "Reset"
|
313 |
msgstr ""
|
314 |
|
315 |
+
#: post-expirator.php:687 post-expirator.php:695
|
316 |
msgid "Status:"
|
317 |
msgstr ""
|
318 |
|
319 |
+
#: post-expirator.php:689
|
320 |
+
msgid "Resets the cron event and removes any old or stray entries."
|
321 |
+
msgstr ""
|
322 |
+
|
323 |
+
#: post-expirator.php:693
|
324 |
+
msgid "Reset Cron Schedule:"
|
325 |
+
msgstr ""
|
326 |
+
|
327 |
+
#: post-expirator.php:697
|
328 |
+
msgid "Displays the cron minute schedule status for post expirator."
|
329 |
+
msgstr ""
|
330 |
+
|
331 |
+
#: post-expirator.php:702
|
332 |
+
msgid "Advanced Diagnostics"
|
333 |
+
msgstr ""
|
334 |
+
|
335 |
+
#: post-expirator.php:705
|
336 |
+
msgid "Post Expirator Debug Logging:"
|
337 |
+
msgstr ""
|
338 |
+
|
339 |
+
#: post-expirator.php:709
|
340 |
+
msgid "Status: Enabled"
|
341 |
+
msgstr ""
|
342 |
+
|
343 |
+
#: post-expirator.php:710
|
344 |
+
msgid "Disable Debugging"
|
345 |
+
msgstr ""
|
346 |
+
|
347 |
+
#: post-expirator.php:712
|
348 |
+
msgid "Status: Disabled"
|
349 |
+
msgstr ""
|
350 |
+
|
351 |
+
#: post-expirator.php:713
|
352 |
+
msgid "Enable Debugging"
|
353 |
+
msgstr ""
|
354 |
+
|
355 |
+
#: post-expirator.php:721
|
356 |
+
msgid "Purge Debug Log:"
|
357 |
+
msgstr ""
|
358 |
+
|
359 |
+
#: post-expirator.php:723
|
360 |
+
msgid "Purge Debug Log"
|
361 |
+
msgstr ""
|
362 |
+
|
363 |
+
#: post-expirator.php:727
|
364 |
+
msgid "Current Cron Schedule:"
|
365 |
+
msgstr ""
|
366 |
+
|
367 |
+
#: post-expirator.php:729
|
368 |
+
msgid ""
|
369 |
+
"The below table will show all currently scheduled cron events with the next "
|
370 |
+
"run time."
|
371 |
+
msgstr ""
|
372 |
+
|
373 |
+
#: post-expirator.php:730
|
374 |
+
msgid ""
|
375 |
+
"Single site (non multisite) users should see an event named "
|
376 |
+
"expirationdate_delete with a schedule of postexpiratorminute."
|
377 |
+
msgstr ""
|
378 |
+
|
379 |
+
#: post-expirator.php:731
|
380 |
+
msgid ""
|
381 |
+
"Multisite users should see an event named expirationdate_delete_blogid "
|
382 |
+
"(where the blogid is replaced with the numeric id of the blog) with a "
|
383 |
+
"schedule of postexpiratorminute"
|
384 |
+
msgstr ""
|
385 |
+
|
386 |
+
#: post-expirator.php:734
|
387 |
+
msgid "Date"
|
388 |
+
msgstr ""
|
389 |
+
|
390 |
+
#: post-expirator.php:735
|
391 |
+
msgid "Event"
|
392 |
+
msgstr ""
|
393 |
+
|
394 |
+
#: post-expirator.php:736
|
395 |
+
msgid "Schedule"
|
396 |
+
msgstr ""
|
397 |
+
|
398 |
+
#: post-expirator.php:737
|
399 |
+
msgid "Interval (seconds)"
|
400 |
+
msgstr ""
|
401 |
+
|
402 |
+
#: post-expirator.php:763
|
403 |
+
msgid ""
|
404 |
+
"Below is a dump of the debugging table, this should be useful for "
|
405 |
+
"troubleshooting."
|
406 |
msgstr ""
|
407 |
|
408 |
#. Plugin URI of the plugin/theme
|
post-expirator-debug.php
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class postExpiratorDebug {
|
4 |
+
|
5 |
+
function __construct() {
|
6 |
+
global $wpdb;
|
7 |
+
$this->debug_table = $wpdb->prefix . 'postexpirator_debug';
|
8 |
+
$this->createDBTable();
|
9 |
+
}
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Create Database Table to store debugging information if it does not already exist.
|
13 |
+
*/
|
14 |
+
private function createDBTable() {
|
15 |
+
global $wpdb;
|
16 |
+
|
17 |
+
if ($wpdb->get_var("SHOW TABLES LIKE '".$this->debug_table."'") != $this->debug_table) {
|
18 |
+
$sql = "CREATE TABLE `".$this->debug_table."` (
|
19 |
+
`id` INT(9) NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
20 |
+
`timestamp` TIMESTAMP NOT NULL,
|
21 |
+
`blog` INT(9) NOT NULL,
|
22 |
+
`message` text NOT NULL
|
23 |
+
);";
|
24 |
+
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
25 |
+
dbDelta($sql);
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
public function removeDBTable() {
|
30 |
+
global $wpdb;
|
31 |
+
$wpdb->query($wpdb->prepare("DROP TABLE IF EXISTS ".$this->debug_table));
|
32 |
+
}
|
33 |
+
|
34 |
+
public function save($data) {
|
35 |
+
global $wpdb;
|
36 |
+
if (is_multisite()) {
|
37 |
+
global $current_blog;
|
38 |
+
$blog = $current_blog->blog_id;
|
39 |
+
} else $blog = 0;
|
40 |
+
$sql = "INSERT INTO `{$this->debug_table}` (`timestamp`,`message`,`blog`) VALUES (FROM_UNIXTIME({$data['timestamp']}),'{$data['message']}','$blog')";
|
41 |
+
$wpdb->query($wpdb->prepare($sql));
|
42 |
+
}
|
43 |
+
|
44 |
+
public function getTable() {
|
45 |
+
global $wpdb;
|
46 |
+
$results = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$this->debug_table} ORDER BY `id` DESC"));
|
47 |
+
if (empty($results)) {
|
48 |
+
print '<p>'.__('Debugging table is currently empty.','post-expirator').'</p>';
|
49 |
+
return;
|
50 |
+
}
|
51 |
+
print '<table class="post-expirator-debug">';
|
52 |
+
print '<tr><th class="post-expirator-timestamp">'.__('Timestamp','post-expirator').'</th>';
|
53 |
+
print '<th>'.__('Message','post-expirator').'</th></tr>';
|
54 |
+
foreach ($results as $result) {
|
55 |
+
print '<tr><td>'.$result->timestamp.'</td>';
|
56 |
+
print '<td>'.$result->message.'</td></tr>';
|
57 |
+
}
|
58 |
+
print '</table>';
|
59 |
+
}
|
60 |
+
|
61 |
+
public function purge() {
|
62 |
+
global $wpdb;
|
63 |
+
$wpdb->query($wpdb->prepare("TRUNCATE TABLE {$this->debug_table}"));
|
64 |
+
}
|
65 |
+
}
|
post-expirator.php
CHANGED
@@ -4,12 +4,14 @@ Plugin Name: Post Expirator
|
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/post-expirator/
|
5 |
Description: Allows you to add an expiration date (minute) to posts which you can configure to either delete the post, change it to a draft, or update the post categories at expiration time.
|
6 |
Author: Aaron Axelsen
|
7 |
-
Version: 1.
|
8 |
Author URI: http://postexpirator.tuxdocs.net/
|
9 |
Translation: Thierry (http://palijn.info)
|
10 |
Text Domain: post-expirator
|
11 |
*/
|
12 |
|
|
|
|
|
13 |
/* Load translation, if it exists */
|
14 |
$plugin_dir = basename(dirname(__FILE__));
|
15 |
load_plugin_textdomain( 'post-expirator', null, $plugin_dir.'/languages/' );
|
@@ -22,10 +24,7 @@ $expirationdateDefaultFooterStyle = 'font-style: italic;';
|
|
22 |
|
23 |
// Detect WPMU/MultiSite
|
24 |
function postExpirator_is_wpmu() {
|
25 |
-
|
26 |
-
return is_multisite();
|
27 |
-
else
|
28 |
-
return file_exists(ABSPATH."/wpmu-settings.php");
|
29 |
}
|
30 |
|
31 |
// Timezone Setup
|
@@ -51,10 +50,10 @@ add_filter('cron_schedules','postExpiratorAddCronMinutes');
|
|
51 |
* Add admin notice hook if cron schedule needs to be reset
|
52 |
*/
|
53 |
function postExpirationAdminNotice() {
|
54 |
-
if (
|
55 |
-
echo '<div class="error fade
|
56 |
-
_e('Post Expirator cron
|
57 |
-
echo('<a href="'.admin_url('options-general.php?page=post-expirator.php&tab=
|
58 |
_e('Click here to reset','post-expirator');
|
59 |
echo('</a></strong></p></div>');
|
60 |
}
|
@@ -68,11 +67,28 @@ function expirationdate_delete_expired_posts() {
|
|
68 |
global $wpdb;
|
69 |
postExpiratorTimezoneSetup();
|
70 |
$time_delete = time();
|
71 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
if (!empty($result)) foreach ($result as $a) {
|
73 |
// Check to see if already proccessed
|
74 |
-
|
75 |
-
if (!empty($processed) && $processed == 1) continue;
|
76 |
|
77 |
$post_result = $wpdb->get_var('select post_type from ' . $wpdb->posts .' where ID = '. $a->post_id);
|
78 |
if ($post_result == 'post') {
|
@@ -88,72 +104,35 @@ function expirationdate_delete_expired_posts() {
|
|
88 |
$cat = get_post_meta($a->post_id,'_expiration-date-category');
|
89 |
if (($catEnabled === false || $catEnabled == 1) && (isset($cat) && !empty($cat[0]))) {
|
90 |
wp_update_post(array('ID' => $a->post_id, 'post_category' => $cat[0]));
|
|
|
91 |
} else {
|
92 |
-
if ($expiredStatus == 'delete')
|
93 |
wp_delete_post($a->post_id);
|
94 |
-
|
|
|
95 |
wp_update_post(array('ID' => $a->post_id, 'post_status' => 'draft'));
|
96 |
delete_post_meta($a->post_id, 'expiration-date');
|
97 |
update_post_meta($a->post_id, 'expiration-date', $a->meta_value);
|
|
|
98 |
}
|
99 |
}
|
100 |
|
101 |
// Mark as Processed
|
102 |
update_post_meta($a->post_id, '_expiration-date-processed', 1);
|
|
|
103 |
}
|
|
|
104 |
}
|
105 |
if (postExpirator_is_wpmu())
|
106 |
add_action ('expirationdate_delete_'.$current_blog->blog_id, 'expirationdate_delete_expired_posts');
|
107 |
else
|
108 |
add_action ('expirationdate_delete', 'expirationdate_delete_expired_posts');
|
109 |
|
110 |
-
/**
|
111 |
-
* Called at plugin activation
|
112 |
-
*/
|
113 |
-
function expirationdate_activate () {
|
114 |
-
global $current_blog,$expirationdateDefaultDateFormat,$expirationdateDefaultTimeFormat,$expirationdateDefaultFooterContents,$expirationdateDefaultFooterStyle;
|
115 |
-
update_option('expirationdateExpiredPostStatus','Draft');
|
116 |
-
update_option('expirationdateExpiredPageStatus','Draft');
|
117 |
-
update_option('expirationdateDefaultDateFormat',$expirationdateDefaultDateFormat);
|
118 |
-
update_option('expirationdateDefaultTimeFormat',$expirationdateDefaultTimeFormat);
|
119 |
-
update_option('expirationdateFooterContents',$expirationdateDefaultFooterContents);
|
120 |
-
update_option('expirationdateFooterStyle',$expirationdateDefaultFooterStyle);
|
121 |
-
update_option('expirationdateDisplayFooter',0);
|
122 |
-
update_option('expirationdateCategory',1);
|
123 |
-
postExpiratorTimezoneSetup();
|
124 |
-
|
125 |
-
if (postExpirator_is_wpmu())
|
126 |
-
wp_schedule_event(mktime(date('H'),0,0,date('m'),date('d'),date('Y')), 'postexpiratorminute', 'expirationdate_delete_'.$current_blog->blog_id);
|
127 |
-
else
|
128 |
-
wp_schedule_event(mktime(date('H'),0,0,date('m'),date('d'),date('Y')), 'postexpiratorminute', 'expirationdate_delete');
|
129 |
-
}
|
130 |
-
register_activation_hook (__FILE__, 'expirationdate_activate');
|
131 |
-
|
132 |
-
/**
|
133 |
-
* Called at plugin deactivation
|
134 |
-
*/
|
135 |
-
function expirationdate_deactivate () {
|
136 |
-
global $current_blog;
|
137 |
-
delete_option('expirationdateExpiredPostStatus');
|
138 |
-
delete_option('expirationdateExpiredPageStatus');
|
139 |
-
delete_option('expirationdateDefaultDateFormat');
|
140 |
-
delete_option('expirationdateDefaultTimeFormat');
|
141 |
-
delete_option('expirationdateDisplayFooter');
|
142 |
-
delete_option('expirationdateFooterContents');
|
143 |
-
delete_option('expirationdateFooterStyle');
|
144 |
-
delete_option('expirationdateCategory');
|
145 |
-
if (postExpirator_is_wpmu())
|
146 |
-
wp_clear_scheduled_hook('expirationdate_delete_'.$current_blog->blog_id);
|
147 |
-
else
|
148 |
-
wp_clear_scheduled_hook('expirationdate_delete');
|
149 |
-
}
|
150 |
-
register_deactivation_hook (__FILE__, 'expirationdate_deactivate');
|
151 |
-
|
152 |
/**
|
153 |
* adds an 'Expires' column to the post display table.
|
154 |
*/
|
155 |
function expirationdate_add_column ($columns) {
|
156 |
-
$columns['expirationdate'] = __('Expires','post-expirator').'<br/><span
|
157 |
return $columns;
|
158 |
}
|
159 |
add_filter ('manage_posts_columns', 'expirationdate_add_column');
|
@@ -200,7 +179,7 @@ function expirationdate_meta_box($post) {
|
|
200 |
$defaulthour = date('H');
|
201 |
$defaultyear = date('Y');
|
202 |
$defaultminute = date('i');
|
203 |
-
$disabled = 'disabled="disabled"';
|
204 |
$categories = get_option('expirationdateCategoryDefaults');
|
205 |
} else {
|
206 |
$defaultmonth = date('F',$expirationdatets);
|
@@ -217,53 +196,57 @@ function expirationdate_meta_box($post) {
|
|
217 |
$rv[] = '<p><input type="checkbox" name="enable-expirationdate" id="enable-expirationdate" value="checked"'.$enabled.' onclick="expirationdate_ajax_add_meta(\'enable-expirationdate\')" />';
|
218 |
$rv[] = '<label for="enable-expirationdate">'.__('Enable Post Expiration','post-expirator').'</label></p>';
|
219 |
$rv[] = '<table><tr>';
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
$rv[] = '</tr><tr>';
|
224 |
$rv[] = '<td>';
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
$
|
235 |
-
|
236 |
-
|
|
|
237 |
$rv[] = '</td><td>';
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
$
|
245 |
-
|
|
|
|
|
246 |
$rv[] = '</select>';
|
247 |
$rv[] = '</td><td>';
|
248 |
-
|
249 |
$rv[] = '</td></tr><tr>';
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
$rv[] = '<td>@</td><td>';
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
|
|
267 |
$rv[] = '</td></tr></table>';
|
268 |
echo implode("\n",$rv);
|
269 |
|
@@ -285,32 +268,15 @@ function expirationdate_meta_box($post) {
|
|
285 |
echo '<div id="expirationdate_ajax_result"></div>';
|
286 |
}
|
287 |
|
288 |
-
/**
|
289 |
-
* PHP Code to be executed by ajax function call - currently nothing happens
|
290 |
-
*/
|
291 |
-
function expirationdate_ajax_process() {
|
292 |
-
// Gather Values
|
293 |
-
$enable = $_POST['enable'];
|
294 |
-
|
295 |
-
die(0);
|
296 |
-
}
|
297 |
-
add_action ('wp_ajax_expirationdate_ajax','expirationdate_ajax_process');
|
298 |
-
|
299 |
-
|
300 |
/**
|
301 |
* Add's ajax javascript
|
302 |
*/
|
303 |
function expirationdate_js_admin_header() {
|
304 |
-
// use JavaScript SACK library for Ajax
|
305 |
-
wp_print_scripts( array( 'sack' ));
|
306 |
-
|
307 |
// Define custom JavaScript function
|
308 |
?>
|
309 |
<script type="text/javascript">
|
310 |
//<![CDATA[
|
311 |
function expirationdate_ajax_add_meta(expireenable) {
|
312 |
-
var mysack = new sack("<?php expirationdate_get_blog_url(); ?>wp-admin/admin-ajax.php");
|
313 |
-
|
314 |
var expire = document.getElementById(expireenable);
|
315 |
|
316 |
if (expire.checked == true) {
|
@@ -339,21 +305,13 @@ function expirationdate_ajax_add_meta(expireenable) {
|
|
339 |
var enable = 'false';
|
340 |
}
|
341 |
|
342 |
-
mysack.execute = 1;
|
343 |
-
mysack.method = 'POST';
|
344 |
-
mysack.setVar( "action", "expirationdate_ajax" );
|
345 |
-
mysack.setVar( "enable", enable );
|
346 |
-
mysack.encVar( "cookie", document.cookie, false );
|
347 |
-
mysack.onError = function() { alert('Ajax error in enabling post expiration' )};
|
348 |
-
mysack.runAJAX();
|
349 |
-
|
350 |
return true;
|
351 |
}
|
352 |
//]]>
|
353 |
</script>
|
354 |
<?php
|
355 |
}
|
356 |
-
add_action('
|
357 |
|
358 |
/**
|
359 |
* Get correct URL (HTTP or HTTPS)
|
@@ -405,11 +363,11 @@ add_action('save_post','expirationdate_update_post_meta');
|
|
405 |
* Build the menu for the options page
|
406 |
*/
|
407 |
function postExpiratorMenuTabs($tab) {
|
408 |
-
echo '<h2>'.__('Post Expirator Options','post-expirator').'</h2>';
|
409 |
echo '<p>';
|
410 |
if (empty($tab)) $tab = 'general';
|
411 |
echo '<a href="'.admin_url('options-general.php?page=post-expirator.php&tab=general').'"'.($tab == 'general' ? ' style="font-weight: bold; text-decoration:none;"' : '').'>'.__('General Settings','post-expirator').'</a> | ';
|
412 |
-
echo '<a href="'.admin_url('options-general.php?page=post-expirator.php&tab=
|
|
|
413 |
echo '</p><hr/>';
|
414 |
}
|
415 |
|
@@ -420,11 +378,15 @@ function postExpiratorMenu() {
|
|
420 |
$tab = $_GET['tab'];
|
421 |
|
422 |
echo '<div class="wrap">';
|
|
|
|
|
423 |
postExpiratorMenuTabs($tab);
|
424 |
if (empty($tab) || $tab == 'general') {
|
425 |
postExpiratorMenuGeneral();
|
426 |
-
} elseif ($tab == '
|
427 |
-
|
|
|
|
|
428 |
}
|
429 |
echo '</div>';
|
430 |
}
|
@@ -552,7 +514,7 @@ function postExpiratorMenuGeneral() {
|
|
552 |
<tr valign-"top">
|
553 |
<th scope="row"><label for="expired-default-date-format"><?php _e('Date Format:','post-expirator');?></label></th>
|
554 |
<td>
|
555 |
-
<input type="text" name="expired-default-date-format" id="expired-default-date-format" value="<?php echo $expirationdateDefaultDateFormat ?>" size="25" /> (<?php echo
|
556 |
<br/>
|
557 |
<?php _e('The default format to use when displaying the expiration date within a post using the [postexpirator] shortcode or within the footer. For information on valid formatting options, see: <a href="http://us2.php.net/manual/en/function.date.php" target="_blank">PHP Date Function</a>.','post-expirator'); ?>
|
558 |
</td>
|
@@ -560,7 +522,7 @@ function postExpiratorMenuGeneral() {
|
|
560 |
<tr valign-"top">
|
561 |
<th scope="row"><label for="expired-default-time-format"><?php _e('Time Format:','post-expirator');?></label></th>
|
562 |
<td>
|
563 |
-
<input type="text" name="expired-default-time-format" id="expired-default-time-format" value="<?php echo $expirationdateDefaultTimeFormat ?>" size="25" /> (<?php echo
|
564 |
<br/>
|
565 |
<?php _e('The default format to use when displaying the expiration time within a post using the [postexpirator] shortcode or within the footer. For information on valid formatting options, see: <a href="http://us2.php.net/manual/en/function.date.php" target="_blank">PHP Date Function</a>.','post-expirator'); ?>
|
566 |
</td>
|
@@ -613,9 +575,9 @@ function postExpiratorMenuGeneral() {
|
|
613 |
<br/>
|
614 |
<?php _e('Enter the text you would like to appear at the bottom of every post that will expire. The following placeholders will be replaced with the post expiration date in the following format:','post-expirator');?>
|
615 |
<ul>
|
616 |
-
<li>EXPIRATIONFULL -> <?php echo
|
617 |
-
<li>EXPIRATIONDATE -> <?php echo
|
618 |
-
<li>EXPIRATIONTIME -> <?php echo
|
619 |
</ul>
|
620 |
</td>
|
621 |
</tr>
|
@@ -623,7 +585,7 @@ function postExpiratorMenuGeneral() {
|
|
623 |
<th scope="row"><label for="expired-footer-style"><?php _e('Footer Style:','post-expirator');?></label></th>
|
624 |
<td>
|
625 |
<input type="text" name="expired-footer-style" id="expired-footer-style" value="<?php echo $expirationdateFooterStyle ?>" size="25" />
|
626 |
-
(<span style="<?php echo $expirationdateFooterStyle ?>"><?php _e('This post will expire on','post-expirator');?> <?php echo
|
627 |
<br/>
|
628 |
<?php _e('The inline css which will be used to style the footer text.','post-expirator');?>
|
629 |
</td>
|
@@ -636,63 +598,159 @@ function postExpiratorMenuGeneral() {
|
|
636 |
<?php
|
637 |
}
|
638 |
|
639 |
-
function
|
640 |
-
$names = array(
|
641 |
// WPMU
|
642 |
if (postExpirator_is_wpmu()) {
|
643 |
global $current_blog;
|
644 |
$names[] = 'expirationdate_delete_'.$current_blog->blog_id;
|
|
|
|
|
645 |
}
|
|
|
646 |
$results = array();
|
647 |
foreach ( $names as $name ) {
|
648 |
-
array_push($results,wp_get_schedule($name));
|
649 |
}
|
650 |
|
651 |
-
|
|
|
|
|
652 |
if ($result == 'hourly') return false;
|
653 |
}
|
654 |
return true;
|
655 |
}
|
656 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
657 |
/**
|
658 |
-
* Reset all cron
|
659 |
*/
|
660 |
-
function
|
661 |
-
|
662 |
-
|
|
|
|
|
|
|
|
|
663 |
global $current_blog;
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
wp_clear_scheduled_hook('expirationdate_delete_');
|
669 |
-
wp_schedule_event(mktime(date('H'),0,0,date('m'),date('d'),date('Y')), 'postexpiratorminute', 'expirationdate_delete');
|
670 |
}
|
671 |
}
|
672 |
|
673 |
-
function
|
674 |
-
if (isset($_POST['reset-cron-
|
675 |
-
|
676 |
-
echo "<div id='message' class='updated fade'><p>"; _e('Cron
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
677 |
}
|
678 |
|
679 |
-
$status =
|
680 |
-
if ($status)
|
681 |
-
|
682 |
-
|
683 |
-
|
|
|
|
|
|
|
|
|
684 |
|
685 |
?>
|
686 |
<form method="post" id="postExpiratorMenuUpgrade">
|
687 |
-
<h3><?php _e('
|
688 |
<table class="form-table">
|
689 |
<tr valign-"top">
|
690 |
-
<th scope="row"><label for="reset-cron-
|
691 |
<td>
|
692 |
-
<input type="submit" name="reset-cron-
|
693 |
<?php _e('Status:','post-expirator');?> <?php echo $cronstatus; ?>
|
694 |
<br/>
|
695 |
-
<?php _e('Resets the cron
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
696 |
</td>
|
697 |
</tr>
|
698 |
</table>
|
@@ -700,6 +758,12 @@ function postExpiratorMenuUpgrade() {
|
|
700 |
<?php
|
701 |
}
|
702 |
|
|
|
|
|
|
|
|
|
|
|
|
|
703 |
|
704 |
// [postexpirator format="l F jS, Y g:ia" tz="foo"]
|
705 |
function postexpirator_shortcode($atts) {
|
@@ -781,9 +845,9 @@ function postexpirator_add_footer($text) {
|
|
781 |
'EXPIRATIONTIME'
|
782 |
);
|
783 |
$replace = array(
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
);
|
788 |
|
789 |
$add_to_footer = '<p style="'.$expirationdateFooterStyle.'">'.str_replace($search,$replace,$expirationdateFooterContents).'</p>';
|
@@ -791,6 +855,15 @@ function postexpirator_add_footer($text) {
|
|
791 |
}
|
792 |
add_action('the_content','postexpirator_add_footer',0);
|
793 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
794 |
/**
|
795 |
* Add Stylesheet
|
796 |
*/
|
@@ -805,6 +878,66 @@ function postexpirator_css() {
|
|
805 |
}
|
806 |
add_action('admin_init','postexpirator_css');
|
807 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
808 |
class Walker_PostExpirator_Category_Checklist extends Walker {
|
809 |
var $tree_type = 'category';
|
810 |
var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/post-expirator/
|
5 |
Description: Allows you to add an expiration date (minute) to posts which you can configure to either delete the post, change it to a draft, or update the post categories at expiration time.
|
6 |
Author: Aaron Axelsen
|
7 |
+
Version: 1.6
|
8 |
Author URI: http://postexpirator.tuxdocs.net/
|
9 |
Translation: Thierry (http://palijn.info)
|
10 |
Text Domain: post-expirator
|
11 |
*/
|
12 |
|
13 |
+
define('POSTEXPIRATOR_VERSION','1.6');
|
14 |
+
|
15 |
/* Load translation, if it exists */
|
16 |
$plugin_dir = basename(dirname(__FILE__));
|
17 |
load_plugin_textdomain( 'post-expirator', null, $plugin_dir.'/languages/' );
|
24 |
|
25 |
// Detect WPMU/MultiSite
|
26 |
function postExpirator_is_wpmu() {
|
27 |
+
return is_multisite();
|
|
|
|
|
|
|
28 |
}
|
29 |
|
30 |
// Timezone Setup
|
50 |
* Add admin notice hook if cron schedule needs to be reset
|
51 |
*/
|
52 |
function postExpirationAdminNotice() {
|
53 |
+
if (postExpiratorCronEventStatus() === false) {
|
54 |
+
echo '<div class="error fade post-expirator-adminnotice"><p><strong>';
|
55 |
+
_e('Post Expirator cron events need to be reset. ','post-expirator');
|
56 |
+
echo('<a href="'.admin_url('options-general.php?page=post-expirator.php&tab=diagnostics').'" style="color: blue;">');
|
57 |
_e('Click here to reset','post-expirator');
|
58 |
echo('</a></strong></p></div>');
|
59 |
}
|
67 |
global $wpdb;
|
68 |
postExpiratorTimezoneSetup();
|
69 |
$time_delete = time();
|
70 |
+
$sql = 'select post_id, meta_value from ' . $wpdb->postmeta . ' as postmeta, '.$wpdb->posts.' as posts where postmeta.post_id = posts.ID AND posts.post_status = "publish" AND postmeta.meta_key = "expiration-date" AND postmeta.meta_value <= "' . $time_delete . '"';
|
71 |
+
$result = $wpdb->get_results($sql);
|
72 |
+
|
73 |
+
$debugEnabled = postExpiratorDebugEnabled();
|
74 |
+
if ($debugEnabled) {
|
75 |
+
// Load Debug Class
|
76 |
+
require_once(plugin_dir_path(__FILE__).'post-expirator-debug.php');
|
77 |
+
|
78 |
+
$debug = new postExpiratorDebug();
|
79 |
+
$startts = mktime();
|
80 |
+
$debug->save(array('timestamp' => $startts,'message' => 'START'));
|
81 |
+
$debug->save(array('timestamp' => $startts,'message' => 'SQL EXPIRE: '.$sql));
|
82 |
+
}
|
83 |
+
|
84 |
+
$processsql = 'select post_id from '.$wpdb->postmeta.' where meta_key = "_expiration-date-processed" AND meta_value = "1"';
|
85 |
+
if ($debugEnabled) $debug->save(array('timestamp' => mktime(),'message' => 'SQL PROCESSED: '.$processsql));
|
86 |
+
$processresult = $wpdb->get_col($processsql);
|
87 |
+
if ($debugEnabled) $debug->save(array('timestamp' => mktime(),'message' => 'PROCESSED POST IDS: '.print_r($processresult,true)));
|
88 |
+
|
89 |
if (!empty($result)) foreach ($result as $a) {
|
90 |
// Check to see if already proccessed
|
91 |
+
if (in_array($a->post_id,$processresult)) continue;
|
|
|
92 |
|
93 |
$post_result = $wpdb->get_var('select post_type from ' . $wpdb->posts .' where ID = '. $a->post_id);
|
94 |
if ($post_result == 'post') {
|
104 |
$cat = get_post_meta($a->post_id,'_expiration-date-category');
|
105 |
if (($catEnabled === false || $catEnabled == 1) && (isset($cat) && !empty($cat[0]))) {
|
106 |
wp_update_post(array('ID' => $a->post_id, 'post_category' => $cat[0]));
|
107 |
+
if ($debugEnabled) $debug->save(array('timestamp' => mktime(),'message' => 'EXPIRE: ID:'.$a->post_id.' CATEGORY:'.print_r($cat[0],true)));
|
108 |
} else {
|
109 |
+
if ($expiredStatus == 'delete') {
|
110 |
wp_delete_post($a->post_id);
|
111 |
+
if ($debugEnabled) $debug->save(array('timestamp' => mktime(),'message' => 'EXPIRE: ID:'.$a->post_id.' DELETE'));
|
112 |
+
} else {
|
113 |
wp_update_post(array('ID' => $a->post_id, 'post_status' => 'draft'));
|
114 |
delete_post_meta($a->post_id, 'expiration-date');
|
115 |
update_post_meta($a->post_id, 'expiration-date', $a->meta_value);
|
116 |
+
if ($debugEnabled) $debug->save(array('timestamp' => mktime(),'message' => 'EXPIRE: ID:'.$a->post_id.' DRAFT'));
|
117 |
}
|
118 |
}
|
119 |
|
120 |
// Mark as Processed
|
121 |
update_post_meta($a->post_id, '_expiration-date-processed', 1);
|
122 |
+
if ($debugEnabled) $debug->save(array('timestamp' => mktime(),'message' => 'PROCESSED: ID:'.$a->post_id));
|
123 |
}
|
124 |
+
if ($debugEnabled) $debug->save(array('timestamp' => mktime(),'message' => 'END - DURATION: '.(mktime() - $startts)));
|
125 |
}
|
126 |
if (postExpirator_is_wpmu())
|
127 |
add_action ('expirationdate_delete_'.$current_blog->blog_id, 'expirationdate_delete_expired_posts');
|
128 |
else
|
129 |
add_action ('expirationdate_delete', 'expirationdate_delete_expired_posts');
|
130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
/**
|
132 |
* adds an 'Expires' column to the post display table.
|
133 |
*/
|
134 |
function expirationdate_add_column ($columns) {
|
135 |
+
$columns['expirationdate'] = __('Expires','post-expirator').'<br/><span class="post-expirator-addcolumn">(YYYY/MM/DD HH:MM)</span>';
|
136 |
return $columns;
|
137 |
}
|
138 |
add_filter ('manage_posts_columns', 'expirationdate_add_column');
|
179 |
$defaulthour = date('H');
|
180 |
$defaultyear = date('Y');
|
181 |
$defaultminute = date('i');
|
182 |
+
$disabled = ' disabled="disabled"';
|
183 |
$categories = get_option('expirationdateCategoryDefaults');
|
184 |
} else {
|
185 |
$defaultmonth = date('F',$expirationdatets);
|
196 |
$rv[] = '<p><input type="checkbox" name="enable-expirationdate" id="enable-expirationdate" value="checked"'.$enabled.' onclick="expirationdate_ajax_add_meta(\'enable-expirationdate\')" />';
|
197 |
$rv[] = '<label for="enable-expirationdate">'.__('Enable Post Expiration','post-expirator').'</label></p>';
|
198 |
$rv[] = '<table><tr>';
|
199 |
+
$rv[] = '<th style="text-align: left;">'.__('Year','post-expirator').'</th>';
|
200 |
+
$rv[] = '<th style="text-align: left;">'.__('Month','post-expirator').'</th>';
|
201 |
+
$rv[] = '<th style="text-align: left;">'.__('Day','post-expirator').'</th>';
|
202 |
$rv[] = '</tr><tr>';
|
203 |
$rv[] = '<td>';
|
204 |
+
$rv[] = '<select name="expirationdate_year" id="expirationdate_year"'.$disabled.'>';
|
205 |
+
$currentyear = date('Y');
|
206 |
+
|
207 |
+
if ($defaultyear < $currentyear) $currentyear = $defaultyear;
|
208 |
+
|
209 |
+
for($i = $currentyear; $i < $currentyear + 8; $i++) {
|
210 |
+
if ($i == $defaultyear)
|
211 |
+
$selected = ' selected="selected"';
|
212 |
+
else
|
213 |
+
$selected = '';
|
214 |
+
$rv[] = '<option'.$selected.'>'.($i).'</option>';
|
215 |
+
}
|
216 |
+
$rv[] = '</select>';
|
217 |
$rv[] = '</td><td>';
|
218 |
+
$rv[] = '<select name="expirationdate_month" id="expirationdate_month"'.$disabled.'>';
|
219 |
+
|
220 |
+
for($i = 1; $i <= 12; $i++) {
|
221 |
+
if ($defaultmonth == date('F',mktime(0, 0, 0, $i, 1, date("Y"))))
|
222 |
+
$selected = ' selected="selected"';
|
223 |
+
else
|
224 |
+
$selected = '';
|
225 |
+
$rv[] = '<option value="'.date('m',mktime(0, 0, 0, $i, 1, date("Y"))).'"'.$selected.'>'.date_i18n('F',mktime(0, 0, 0, $i, 1, date("Y"))).'</option>';
|
226 |
+
}
|
227 |
+
|
228 |
$rv[] = '</select>';
|
229 |
$rv[] = '</td><td>';
|
230 |
+
$rv[] = '<input type="text" id="expirationdate_day" name="expirationdate_day" value="'.$defaultday.'" size="2"'.$disabled.' />,';
|
231 |
$rv[] = '</td></tr><tr>';
|
232 |
+
$rv[] = '<th style="text-align: left;"></th>';
|
233 |
+
$rv[] = '<th style="text-align: left;">'.__('Hour','post-expirator').'('.date('T',mktime(0, 0, 0, $i, 1, date("Y"))).')</th>';
|
234 |
+
$rv[] = '<th style="text-align: left;">'.__('Minute','post-expirator').'</th>';
|
235 |
+
$rv[] = '</tr><tr>';
|
236 |
$rv[] = '<td>@</td><td>';
|
237 |
+
$rv[] = '<select name="expirationdate_hour" id="expirationdate_hour"'.$disabled.'>';
|
238 |
+
|
239 |
+
for($i = 1; $i <= 24; $i++) {
|
240 |
+
if ($defaulthour == date('H',mktime($i, 0, 0, date("n"), date("j"), date("Y"))))
|
241 |
+
$selected = ' selected="selected"';
|
242 |
+
else
|
243 |
+
$selected = '';
|
244 |
+
$rv[] = '<option value="'.date('H',mktime($i, 0, 0, date("n"), date("j"), date("Y"))).'"'.$selected.'>'.date_i18n('H',mktime($i, 0, 0, date("n"), date("j"), date("Y"))).'</option>';
|
245 |
+
}
|
246 |
+
|
247 |
+
$rv[] = '</select></td><td>';
|
248 |
+
$rv[] = '<input type="text" id="expirationdate_minute" name="expirationdate_minute" value="'.$defaultminute.'" size="2"'.$disabled.' />';
|
249 |
+
$rv[] = '<input type="hidden" name="expirationdate_formcheck" value="true" />';
|
250 |
$rv[] = '</td></tr></table>';
|
251 |
echo implode("\n",$rv);
|
252 |
|
268 |
echo '<div id="expirationdate_ajax_result"></div>';
|
269 |
}
|
270 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
/**
|
272 |
* Add's ajax javascript
|
273 |
*/
|
274 |
function expirationdate_js_admin_header() {
|
|
|
|
|
|
|
275 |
// Define custom JavaScript function
|
276 |
?>
|
277 |
<script type="text/javascript">
|
278 |
//<![CDATA[
|
279 |
function expirationdate_ajax_add_meta(expireenable) {
|
|
|
|
|
280 |
var expire = document.getElementById(expireenable);
|
281 |
|
282 |
if (expire.checked == true) {
|
305 |
var enable = 'false';
|
306 |
}
|
307 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
return true;
|
309 |
}
|
310 |
//]]>
|
311 |
</script>
|
312 |
<?php
|
313 |
}
|
314 |
+
add_action('admin_head', 'expirationdate_js_admin_header' );
|
315 |
|
316 |
/**
|
317 |
* Get correct URL (HTTP or HTTPS)
|
363 |
* Build the menu for the options page
|
364 |
*/
|
365 |
function postExpiratorMenuTabs($tab) {
|
|
|
366 |
echo '<p>';
|
367 |
if (empty($tab)) $tab = 'general';
|
368 |
echo '<a href="'.admin_url('options-general.php?page=post-expirator.php&tab=general').'"'.($tab == 'general' ? ' style="font-weight: bold; text-decoration:none;"' : '').'>'.__('General Settings','post-expirator').'</a> | ';
|
369 |
+
echo '<a href="'.admin_url('options-general.php?page=post-expirator.php&tab=diagnostics').'"'.($tab == 'diagnostics' ? ' style="font-weight: bold; text-decoration:none;"' : '').'>'.__('Diagnostics','post-expirator').'</a>';
|
370 |
+
echo ' | <a href="'.admin_url('options-general.php?page=post-expirator.php&tab=viewdebug').'"'.($tab == 'viewdebug' ? ' style="font-weight: bold; text-decoration:none;"' : '').'>'.__('View Debug Logs','post-expirator').'</a>';
|
371 |
echo '</p><hr/>';
|
372 |
}
|
373 |
|
378 |
$tab = $_GET['tab'];
|
379 |
|
380 |
echo '<div class="wrap">';
|
381 |
+
echo '<h2>'.__('Post Expirator Options','post-expirator').'</h2>';
|
382 |
+
|
383 |
postExpiratorMenuTabs($tab);
|
384 |
if (empty($tab) || $tab == 'general') {
|
385 |
postExpiratorMenuGeneral();
|
386 |
+
} elseif ($tab == 'diagnostics') {
|
387 |
+
postExpiratorMenuDiagnostics();
|
388 |
+
} elseif ($tab == 'viewdebug') {
|
389 |
+
postExpiratorMenuViewdebug();
|
390 |
}
|
391 |
echo '</div>';
|
392 |
}
|
514 |
<tr valign-"top">
|
515 |
<th scope="row"><label for="expired-default-date-format"><?php _e('Date Format:','post-expirator');?></label></th>
|
516 |
<td>
|
517 |
+
<input type="text" name="expired-default-date-format" id="expired-default-date-format" value="<?php echo $expirationdateDefaultDateFormat ?>" size="25" /> (<?php echo date_i18n("$expirationdateDefaultDateFormat") ?>)
|
518 |
<br/>
|
519 |
<?php _e('The default format to use when displaying the expiration date within a post using the [postexpirator] shortcode or within the footer. For information on valid formatting options, see: <a href="http://us2.php.net/manual/en/function.date.php" target="_blank">PHP Date Function</a>.','post-expirator'); ?>
|
520 |
</td>
|
522 |
<tr valign-"top">
|
523 |
<th scope="row"><label for="expired-default-time-format"><?php _e('Time Format:','post-expirator');?></label></th>
|
524 |
<td>
|
525 |
+
<input type="text" name="expired-default-time-format" id="expired-default-time-format" value="<?php echo $expirationdateDefaultTimeFormat ?>" size="25" /> (<?php echo date_i18n("$expirationdateDefaultTimeFormat") ?>)
|
526 |
<br/>
|
527 |
<?php _e('The default format to use when displaying the expiration time within a post using the [postexpirator] shortcode or within the footer. For information on valid formatting options, see: <a href="http://us2.php.net/manual/en/function.date.php" target="_blank">PHP Date Function</a>.','post-expirator'); ?>
|
528 |
</td>
|
575 |
<br/>
|
576 |
<?php _e('Enter the text you would like to appear at the bottom of every post that will expire. The following placeholders will be replaced with the post expiration date in the following format:','post-expirator');?>
|
577 |
<ul>
|
578 |
+
<li>EXPIRATIONFULL -> <?php echo date_i18n("$expirationdateDefaultDateFormat $expirationdateDefaultTimeFormat") ?></li>
|
579 |
+
<li>EXPIRATIONDATE -> <?php echo date_i18n("$expirationdateDefaultDateFormat") ?></li>
|
580 |
+
<li>EXPIRATIONTIME -> <?php echo date_i18n("$expirationdateDefaultTimeFormat") ?></li>
|
581 |
</ul>
|
582 |
</td>
|
583 |
</tr>
|
585 |
<th scope="row"><label for="expired-footer-style"><?php _e('Footer Style:','post-expirator');?></label></th>
|
586 |
<td>
|
587 |
<input type="text" name="expired-footer-style" id="expired-footer-style" value="<?php echo $expirationdateFooterStyle ?>" size="25" />
|
588 |
+
(<span style="<?php echo $expirationdateFooterStyle ?>"><?php _e('This post will expire on','post-expirator');?> <?php echo date_i18n("$expirationdateDefaultDateFormat $expirationdateDefaultTimeFormat"); ?></span>)
|
589 |
<br/>
|
590 |
<?php _e('The inline css which will be used to style the footer text.','post-expirator');?>
|
591 |
</td>
|
598 |
<?php
|
599 |
}
|
600 |
|
601 |
+
function postExpiratorCronEventStatus() {
|
602 |
+
$names = array();
|
603 |
// WPMU
|
604 |
if (postExpirator_is_wpmu()) {
|
605 |
global $current_blog;
|
606 |
$names[] = 'expirationdate_delete_'.$current_blog->blog_id;
|
607 |
+
} else {
|
608 |
+
$names[] = 'expirationdate_delete';
|
609 |
}
|
610 |
+
|
611 |
$results = array();
|
612 |
foreach ( $names as $name ) {
|
613 |
+
if (wp_get_schedule($name) !== false) array_push($results,wp_get_schedule($name));
|
614 |
}
|
615 |
|
616 |
+
if (empty($results)) return false;
|
617 |
+
|
618 |
+
foreach ( $results as $result ) {
|
619 |
if ($result == 'hourly') return false;
|
620 |
}
|
621 |
return true;
|
622 |
}
|
623 |
|
624 |
+
function postExpiratorCronScheduleStatus() {
|
625 |
+
$schedules = wp_get_schedules();
|
626 |
+
|
627 |
+
if (isset($schedules['postexpiratorminute'])) {
|
628 |
+
if ($schedules['postexpiratorminute']['interval'] == '60')
|
629 |
+
return true;
|
630 |
+
}
|
631 |
+
return false;
|
632 |
+
}
|
633 |
+
|
634 |
/**
|
635 |
+
* Reset all cron events for Post Expirator Plugin
|
636 |
*/
|
637 |
+
function postExpiratorResetCronEvent() {
|
638 |
+
postExpiratorTimezoneSetup();
|
639 |
+
|
640 |
+
wp_clear_scheduled_hook('expirationdate_delete');
|
641 |
+
wp_clear_scheduled_hook('expirationdate_delete_');
|
642 |
+
|
643 |
+
if (postExpirator_is_wpmu()) {
|
644 |
global $current_blog;
|
645 |
+
wp_clear_scheduled_hook('expirationdate_delete_'.$current_blog->blog_id);
|
646 |
+
wp_schedule_event(mktime(date('H'),0,0,date('m'),date('d'),date('Y')), 'postexpiratorminute', 'expirationdate_delete_'.$current_blog->blog_id);
|
647 |
+
} else {
|
648 |
+
wp_schedule_event(mktime(date('H'),0,0,date('m'),date('d'),date('Y')), 'postexpiratorminute', 'expirationdate_delete');
|
|
|
|
|
649 |
}
|
650 |
}
|
651 |
|
652 |
+
function postExpiratorMenuDiagnostics() {
|
653 |
+
if (isset($_POST['reset-cron-event'])) {
|
654 |
+
postExpiratorResetCronEvent();
|
655 |
+
echo "<div id='message' class='updated fade'><p>"; _e('Cron Events Reset! (Reload page to remove warning)','post-expirator'); echo "</p></div>";
|
656 |
+
} elseif (isset($_POST['debugging-disable'])) {
|
657 |
+
update_option('expirationdateDebug',0);
|
658 |
+
echo "<div id='message' class='updated fade'><p>"; _e('Debugging Disabled','post-expirator'); echo "</p></div>";
|
659 |
+
} elseif (isset($_POST['debugging-enable'])) {
|
660 |
+
update_option('expirationdateDebug',1);
|
661 |
+
echo "<div id='message' class='updated fade'><p>"; _e('Debugging Enabled','post-expirator'); echo "</p></div>";
|
662 |
+
} elseif (isset($_POST['purge-debug'])) {
|
663 |
+
require_once(plugin_dir_path(__FILE__).'post-expirator-debug.php');
|
664 |
+
$debug = new postExpiratorDebug();
|
665 |
+
$debug->purge();
|
666 |
+
echo "<div id='message' class='updated fade'><p>"; _e('Debugging Table Emptied','post-expirator'); echo "</p></div>";
|
667 |
}
|
668 |
|
669 |
+
$status = postExpiratorCronEventStatus();
|
670 |
+
if ($status) $cronstatus = '<span style="color:green">'.__('OK','post-expirator').'</span>';
|
671 |
+
else $cronstatus = '<span style="color:red">'.__('RESET NEEDED','post-expirator').'</span>';
|
672 |
+
|
673 |
+
$schedule = postExpiratorCronScheduleStatus();
|
674 |
+
if ($schedule) $cronschedulestatus = '<span style="color:green">'.__('OK','post-expirator').'</span>';
|
675 |
+
else $cronschedulestatus = '<span style="color:red">'.__('ERROR WITH FILTER','post-expirator').'</span>';
|
676 |
+
|
677 |
+
$debug = postExpiratorDebugEnabled();
|
678 |
|
679 |
?>
|
680 |
<form method="post" id="postExpiratorMenuUpgrade">
|
681 |
+
<h3><?php _e('Cron Settings','post-expirator');?></h3>
|
682 |
<table class="form-table">
|
683 |
<tr valign-"top">
|
684 |
+
<th scope="row"><label for="reset-cron-event"><?php _e('Reset Cron Event:','post-expirator');?></label></th>
|
685 |
<td>
|
686 |
+
<input type="submit" name="reset-cron-event" id="reset-cron-event" value="<?php _e('Reset','post-expirator');?>" />
|
687 |
<?php _e('Status:','post-expirator');?> <?php echo $cronstatus; ?>
|
688 |
<br/>
|
689 |
+
<?php _e('Resets the cron event and removes any old or stray entries.','post-expirator');?>
|
690 |
+
</td>
|
691 |
+
</tr>
|
692 |
+
<tr valign-"top">
|
693 |
+
<th scope="row"><label for="reset-cron-schedule"><?php _e('Reset Cron Schedule:','post-expirator');?></label></th>
|
694 |
+
<td>
|
695 |
+
<?php _e('Status:','post-expirator');?> <?php echo $cronschedulestatus; ?>
|
696 |
+
<br/>
|
697 |
+
<?php _e('Displays the cron minute schedule status for post expirator.','post-expirator');?>
|
698 |
+
</td>
|
699 |
+
</tr>
|
700 |
+
</table>
|
701 |
+
|
702 |
+
<h3><?php _e('Advanced Diagnostics','post-expirator');?></h3>
|
703 |
+
<table class="form-table">
|
704 |
+
<tr valign-"top">
|
705 |
+
<th scope="row"><label for="postexpirator-log"><?php _e('Post Expirator Debug Logging:','post-expirator');?></label></th>
|
706 |
+
<td>
|
707 |
+
<?php
|
708 |
+
if ($debug) {
|
709 |
+
echo __('Status: Enabled','post-expirator').'<br/>';
|
710 |
+
echo '<input type="submit" name="debugging-disable" id="debugging-disable" value="'.__('Disable Debugging','post-expirator').'" />';
|
711 |
+
} else {
|
712 |
+
echo __('Status: Disabled','post-expirator').'<br/>';
|
713 |
+
echo '<input type="submit" name="debugging-enable" id="debugging-enable" value="'.__('Enable Debugging','post-expirator').'" />';
|
714 |
+
}
|
715 |
+
?>
|
716 |
+
<br/>
|
717 |
+
<a href="<?php echo admin_url('options-general.php?page=post-expirator.php&tab=viewdebug') ?>">View Debug Logs</a>
|
718 |
+
</td>
|
719 |
+
</tr>
|
720 |
+
<tr valign-"top">
|
721 |
+
<th scope="row"><?php _e('Purge Debug Log:','post-expirator');?></th>
|
722 |
+
<td>
|
723 |
+
<input type="submit" name="purge-debug" id="purge-debug" value="<?php _e('Purge Debug Log','post-expirator');?>" />
|
724 |
+
</td>
|
725 |
+
</tr/>
|
726 |
+
<tr valign-"top">
|
727 |
+
<th scope="row"><label for="cron-schedule"><?php _e('Current Cron Schedule:','post-expirator');?></label></th>
|
728 |
+
<td>
|
729 |
+
<?php _e('The below table will show all currently scheduled cron events with the next run time.','post-expirator');?><br/>
|
730 |
+
<?php _e('Single site (non multisite) users should see an event named expirationdate_delete with a schedule of postexpiratorminute.','post-expirator');?><br/>
|
731 |
+
<?php if (postExpirator_is_wpmu()) _e('Multisite users should see an event named expirationdate_delete_blogid (where the blogid is replaced with the numeric id of the blog) with a schedule of postexpiratorminute','post-expirator');?>
|
732 |
+
<table>
|
733 |
+
<tr>
|
734 |
+
<th><?php _e('Date','post-expirator');?></th>
|
735 |
+
<th><?php _e('Event','post-expirator');?></th>
|
736 |
+
<th><?php _e('Schedule','post-expirator');?></th>
|
737 |
+
<th><?php _e('Interval (seconds)','post-expirator');?></th>
|
738 |
+
</tr>
|
739 |
+
<?php
|
740 |
+
$cron = _get_cron_array();
|
741 |
+
foreach ($cron as $key=>$value) {
|
742 |
+
foreach ($value as $eventkey=>$eventvalue) {
|
743 |
+
print '<tr>';
|
744 |
+
print '<td>'.date_i18n('r',$key).'</td>';
|
745 |
+
print '<td>'.$eventkey.'</td>';
|
746 |
+
$arrkey = array_keys($eventvalue);
|
747 |
+
print '<td>'.$eventvalue[$arrkey[0]]['schedule'].'</td>';
|
748 |
+
print '<td>'.$eventvalue[$arrkey[0]]['interval'].'</td>';
|
749 |
+
print '</tr>';
|
750 |
+
}
|
751 |
+
}
|
752 |
+
?>
|
753 |
+
</table>
|
754 |
</td>
|
755 |
</tr>
|
756 |
</table>
|
758 |
<?php
|
759 |
}
|
760 |
|
761 |
+
function postExpiratorMenuViewdebug() {
|
762 |
+
require_once(plugin_dir_path(__FILE__).'post-expirator-debug.php');
|
763 |
+
print "<p>".__('Below is a dump of the debugging table, this should be useful for troubleshooting.','post-expirator')."</p>";
|
764 |
+
$debug = new postExpiratorDebug();
|
765 |
+
$debug->getTable();
|
766 |
+
}
|
767 |
|
768 |
// [postexpirator format="l F jS, Y g:ia" tz="foo"]
|
769 |
function postexpirator_shortcode($atts) {
|
845 |
'EXPIRATIONTIME'
|
846 |
);
|
847 |
$replace = array(
|
848 |
+
date_i18n("$dateformat $timeformat",$expirationdatets),
|
849 |
+
date_i18n("$dateformat",$expirationdatets),
|
850 |
+
date_i18n("$timeformat",$expirationdatets)
|
851 |
);
|
852 |
|
853 |
$add_to_footer = '<p style="'.$expirationdateFooterStyle.'">'.str_replace($search,$replace,$expirationdateFooterContents).'</p>';
|
855 |
}
|
856 |
add_action('the_content','postexpirator_add_footer',0);
|
857 |
|
858 |
+
/**
|
859 |
+
* Check for Debug
|
860 |
+
*/
|
861 |
+
function postExpiratorDebugEnabled() {
|
862 |
+
$debug = get_option('expirationdateDebug');
|
863 |
+
if ($debug == 1) return true;
|
864 |
+
return false;
|
865 |
+
}
|
866 |
+
|
867 |
/**
|
868 |
* Add Stylesheet
|
869 |
*/
|
878 |
}
|
879 |
add_action('admin_init','postexpirator_css');
|
880 |
|
881 |
+
/**
|
882 |
+
* Post Expirator Activation/Upgrade
|
883 |
+
*/
|
884 |
+
function postexpirator_upgrade() {
|
885 |
+
// Check for current version, if not exists, run activation
|
886 |
+
$version = get_option('postexpiratorVersion');
|
887 |
+
if ($version === false) { //not installed, run default activation
|
888 |
+
postexpirator_activate();
|
889 |
+
update_option('postexpiratorVersion',POSTEXPIRATOR_VERSION);
|
890 |
+
}
|
891 |
+
}
|
892 |
+
add_action('admin_init','postexpirator_upgrade');
|
893 |
+
|
894 |
+
/**
|
895 |
+
* Called at plugin activation
|
896 |
+
*/
|
897 |
+
function postexpirator_activate () {
|
898 |
+
global $current_blog,$expirationdateDefaultDateFormat,$expirationdateDefaultTimeFormat,$expirationdateDefaultFooterContents,$expirationdateDefaultFooterStyle;
|
899 |
+
if (get_option('expirationdateExpiredPostStatus') === false) update_option('expirationdateExpiredPostStatus','Draft');
|
900 |
+
if (get_option('expirationdateExpiredPageStatus') === false) update_option('expirationdateExpiredPageStatus','Draft');
|
901 |
+
if (get_option('expirationdateDefaultDateFormat') === false) update_option('expirationdateDefaultDateFormat',$expirationdateDefaultDateFormat);
|
902 |
+
if (get_option('expirationdateDefaultTimeFormat') === false) update_option('expirationdateDefaultTimeFormat',$expirationdateDefaultTimeFormat);
|
903 |
+
if (get_option('expirationdateFooterContents') === false) update_option('expirationdateFooterContents',$expirationdateDefaultFooterContents);
|
904 |
+
if (get_option('expirationdateFooterStyle') === false) update_option('expirationdateFooterStyle',$expirationdateDefaultFooterStyle);
|
905 |
+
if (get_option('expirationdateDisplayFooter') === false) update_option('expirationdateDisplayFooter',0);
|
906 |
+
if (get_option('expirationdateCategory') === false) update_option('expirationdateCategory',1);
|
907 |
+
if (get_option('expirationdateDebug') === false) update_option('expirationdateDebug',0);
|
908 |
+
postExpiratorTimezoneSetup();
|
909 |
+
|
910 |
+
if (postExpirator_is_wpmu())
|
911 |
+
wp_schedule_event(mktime(date('H'),0,0,date('m'),date('d'),date('Y')), 'postexpiratorminute', 'expirationdate_delete_'.$current_blog->blog_id);
|
912 |
+
else
|
913 |
+
wp_schedule_event(mktime(date('H'),0,0,date('m'),date('d'),date('Y')), 'postexpiratorminute', 'expirationdate_delete');
|
914 |
+
}
|
915 |
+
|
916 |
+
/**
|
917 |
+
* Called at plugin deactivation
|
918 |
+
*/
|
919 |
+
function expirationdate_deactivate () {
|
920 |
+
global $current_blog;
|
921 |
+
delete_option('expirationdateExpiredPostStatus');
|
922 |
+
delete_option('expirationdateExpiredPageStatus');
|
923 |
+
delete_option('expirationdateDefaultDateFormat');
|
924 |
+
delete_option('expirationdateDefaultTimeFormat');
|
925 |
+
delete_option('expirationdateDisplayFooter');
|
926 |
+
delete_option('expirationdateFooterContents');
|
927 |
+
delete_option('expirationdateFooterStyle');
|
928 |
+
delete_option('expirationdateCategory');
|
929 |
+
delete_option('expirationdateDebug');
|
930 |
+
delete_option('postexpiratorVersion');
|
931 |
+
if (postExpirator_is_wpmu())
|
932 |
+
wp_clear_scheduled_hook('expirationdate_delete_'.$current_blog->blog_id);
|
933 |
+
else
|
934 |
+
wp_clear_scheduled_hook('expirationdate_delete');
|
935 |
+
require_once(plugin_dir_path(__FILE__).'post-expirator-debug.php');
|
936 |
+
$debug = new postExpiratorDebug();
|
937 |
+
$debug->removeDbTable();
|
938 |
+
}
|
939 |
+
register_deactivation_hook (__FILE__, 'expirationdate_deactivate');
|
940 |
+
|
941 |
class Walker_PostExpirator_Category_Checklist extends Walker {
|
942 |
var $tree_type = 'category';
|
943 |
var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Post Expirator ===
|
2 |
Contributors: axelseaa
|
3 |
Tags: expire, posts, pages, schedule
|
4 |
-
Requires at least: 3.
|
5 |
-
Tested up to: 3.
|
6 |
-
Stable tag: 1.
|
7 |
|
8 |
Allows you to add an expiration date to posts which you can configure to either delete the post, change it to a draft, or update the
|
9 |
post categories.
|
@@ -45,6 +45,16 @@ This section describes how to install the plugin and get it working.
|
|
45 |
|
46 |
== Changelog ==
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
**Version 1.5.4**
|
49 |
|
50 |
* Cleaned up deprecated function calls
|
@@ -123,6 +133,14 @@ NOTE: After upgrading, you may need to reset the cron schedules. Following onsc
|
|
123 |
|
124 |
== Upgrade Notice ==
|
125 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
= 1.5.4 =
|
127 |
Cleaned up deprecated function calls
|
128 |
|
1 |
=== Post Expirator ===
|
2 |
Contributors: axelseaa
|
3 |
Tags: expire, posts, pages, schedule
|
4 |
+
Requires at least: 3.2
|
5 |
+
Tested up to: 3.4
|
6 |
+
Stable tag: 1.6
|
7 |
|
8 |
Allows you to add an expiration date to posts which you can configure to either delete the post, change it to a draft, or update the
|
9 |
post categories.
|
45 |
|
46 |
== Changelog ==
|
47 |
|
48 |
+
**Version 1.6**
|
49 |
+
|
50 |
+
* Fixed invalid html
|
51 |
+
* Fixed i18n issues with dates
|
52 |
+
* Fixed problem when using "Network Activate" - reworked plugin activation process
|
53 |
+
* Replaced "Upgrade" tab with new "Diagnostics" tab
|
54 |
+
* Reworked expire logic to limit the number of sql queries needed
|
55 |
+
* Added debugging
|
56 |
+
* Various code cleanup
|
57 |
+
|
58 |
**Version 1.5.4**
|
59 |
|
60 |
* Cleaned up deprecated function calls
|
133 |
|
134 |
== Upgrade Notice ==
|
135 |
|
136 |
+
= 1.6 =
|
137 |
+
Fixed invalid html
|
138 |
+
Fixed i18n issues with dates
|
139 |
+
Fixed problem when using "Network Activate" - reworked plugin activation process
|
140 |
+
Replaced "Upgrade" tab with new "Diagnostics" tab
|
141 |
+
Reworked expire logic to limit the number of sql queries needed
|
142 |
+
Added debugging
|
143 |
+
|
144 |
= 1.5.4 =
|
145 |
Cleaned up deprecated function calls
|
146 |
|
style.css
CHANGED
@@ -1,3 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
#post-expirator-cat-list {
|
2 |
max-width: 250px;
|
3 |
}
|
@@ -7,3 +14,10 @@
|
|
7 |
#post-expirator-cat-list ul ul {
|
8 |
margin-left: 18px;
|
9 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.post-expirator-adminnotice {
|
2 |
+
background-color: red;
|
3 |
+
}
|
4 |
+
.post-expirator-addcolumn {
|
5 |
+
font-size: 0.8em;
|
6 |
+
font-weight: normal;
|
7 |
+
}
|
8 |
#post-expirator-cat-list {
|
9 |
max-width: 250px;
|
10 |
}
|
14 |
#post-expirator-cat-list ul ul {
|
15 |
margin-left: 18px;
|
16 |
}
|
17 |
+
.post-expirator-debug th {
|
18 |
+
font-weight: bold;
|
19 |
+
border-bottom: 1px solid black;
|
20 |
+
}
|
21 |
+
.post-expirator-timestamp {
|
22 |
+
width: 150px;
|
23 |
+
}
|