WP Updates Notifier - Version 1.4.1

Version Description

  • Switch from using site_url() to home_url() in email subject line so not to link to a 404 page.
Download this release

Release Info

Developer l3rady
Plugin Icon wp plugin WP Updates Notifier
Version 1.4.1
Comparing to
See all releases

Code changes from version 1.3.2 to 1.4.1

languages/wp-updates-notifier-de_DE.po CHANGED
@@ -1,260 +1,260 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: WP Updates Notifier v1.3.1\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: \n"
6
- "PO-Revision-Date: 2012-09-29 20:18:52+0000\n"
7
- "Last-Translator: \n"
8
- "Language-Team: \n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "Plural-Forms: nplurals=2; plural=n != 1;\n"
13
- "X-Poedit-Language: \n"
14
- "X-Poedit-Country: \n"
15
- "X-Poedit-SourceCharset: utf-8\n"
16
- "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
17
- "X-Poedit-Basepath: \n"
18
- "X-Poedit-Bookmarks: \n"
19
- "X-Poedit-SearchPath-0: .\n"
20
- "X-Textdomain-Support: yes"
21
-
22
- #. translators: plugin header field 'Name'
23
- #: wp-updates-notifier.php:0
24
- #: wp-updates-notifier.php:367
25
- #: wp-updates-notifier.php:400
26
- #@ wp-updates-notifier
27
- msgid "WP Updates Notifier"
28
- msgstr "Aktualisierungsalarm"
29
-
30
- #. translators: plugin header field 'PluginURI'
31
- #: wp-updates-notifier.php:0
32
- #@ wp-updates-notifier
33
- msgid "http://l3rady.com/projects/wp-updates-notifier/"
34
- msgstr ""
35
-
36
- #. translators: plugin header field 'Description'
37
- #: wp-updates-notifier.php:0
38
- #@ wp-updates-notifier
39
- msgid "Sends email to notify you if there are any updates for your WordPress site. Can notify about core, plugin and theme updates."
40
- msgstr "Sendet E-Mails, um Sie zu benachrichtigen, wenn es irgendwelche Aktualisierungen für Ihre WordPress-Website gibt. Kann über Aktualisierungen für WordPress, Plugins und Themes benachrichtigen."
41
-
42
- #. translators: plugin header field 'Author'
43
- #: wp-updates-notifier.php:0
44
- #@ wp-updates-notifier
45
- msgid "Scott Cariss"
46
- msgstr ""
47
-
48
- #. translators: plugin header field 'AuthorURI'
49
- #: wp-updates-notifier.php:0
50
- #@ wp-updates-notifier
51
- msgid "http://l3rady.com/"
52
- msgstr ""
53
-
54
- #: wp-updates-notifier.php:159
55
- #: wp-updates-notifier.php:414
56
- #@ wp-updates-notifier
57
- msgid "Settings"
58
- msgstr "Einstellungen"
59
-
60
- #: wp-updates-notifier.php:187
61
- #@ wp-updates-notifier
62
- msgid "There are updates available for your WordPress site:"
63
- msgstr "Es sind Aktualisierungen für Ihre WordPress-Webseite verfügbar:"
64
-
65
- #: wp-updates-notifier.php:188
66
- #, php-format
67
- #@ wp-updates-notifier
68
- msgid "Please visit %s to update."
69
- msgstr "Bitte besuche %s um zu updaten."
70
-
71
- #: wp-updates-notifier.php:209
72
- #, php-format
73
- #@ wp-updates-notifier
74
- msgid "WP-Core: WordPress is out of date. Please update from version %s to %s"
75
- msgstr "WordPress: WordPress ist veraltet. Bitte update von Version %s auf %s"
76
-
77
- #: wp-updates-notifier.php:247
78
- #, php-format
79
- #@ wp-updates-notifier
80
- msgid "Plugin: %s is out of date. Please update from version %s to %s"
81
- msgstr "Plugin: %s ist veraltet. Bitte aktualisiere von Version %s auf %s"
82
-
83
- #: wp-updates-notifier.php:248
84
- #, php-format
85
- #@ wp-updates-notifier
86
- msgid "Details: %s"
87
- msgstr "Details: %s"
88
-
89
- #: wp-updates-notifier.php:249
90
- #, php-format
91
- #@ wp-updates-notifier
92
- msgid "Changelog: %s%s"
93
- msgstr "Änderungen: %s%s"
94
-
95
- #: wp-updates-notifier.php:251
96
- #, php-format
97
- #@ default
98
- msgid "Compatibility with WordPress %1$s: 100%% (according to its author)"
99
- msgstr ""
100
-
101
- #: wp-updates-notifier.php:254
102
- #, php-format
103
- #@ default
104
- msgid "Compatibility with WordPress %1$s: %2$d%% (%3$d \"works\" votes out of %4$d total)"
105
- msgstr ""
106
-
107
- #: wp-updates-notifier.php:256
108
- #, php-format
109
- #@ default
110
- msgid "Compatibility with WordPress %1$s: Unknown"
111
- msgstr ""
112
-
113
- #: wp-updates-notifier.php:258
114
- #, php-format
115
- #@ wp-updates-notifier
116
- msgid "Compatibility: %s"
117
- msgstr "Kompatibilität: %s"
118
-
119
- #: wp-updates-notifier.php:295
120
- #, php-format
121
- #@ wp-updates-notifier
122
- msgid "Theme: %s is out of date. Please update from version %s to %s"
123
- msgstr "Theme: %s ist veraltet. Bitte aktualisiere von Version %s auf %s"
124
-
125
- #: wp-updates-notifier.php:357
126
- #, php-format
127
- #@ wp-updates-notifier
128
- msgid "WP Updates Notifier: Updates Available @ %s"
129
- msgstr "WP Updates Notifier: Aktualisierungen stehen bereit @ %s"
130
-
131
- #: wp-updates-notifier.php:406
132
- #@ wp-updates-notifier
133
- msgid "Save settings"
134
- msgstr "Einstellungen speichern"
135
-
136
- #: wp-updates-notifier.php:407
137
- #@ wp-updates-notifier
138
- msgid "Save settings with test email"
139
- msgstr "Einstellungen speichern und Test-E-Mail versenden"
140
-
141
- #: wp-updates-notifier.php:415
142
- #@ wp-updates-notifier
143
- msgid "Frequency to check"
144
- msgstr "Check-Häufigkeit"
145
-
146
- #: wp-updates-notifier.php:416
147
- #@ wp-updates-notifier
148
- msgid "Notify email to"
149
- msgstr "Benachrichtigungs-E-Mail an"
150
-
151
- #: wp-updates-notifier.php:417
152
- #@ wp-updates-notifier
153
- msgid "Notify email from"
154
- msgstr "Benachrichtigungs-E-Mail-Absender"
155
-
156
- #: wp-updates-notifier.php:418
157
- #@ wp-updates-notifier
158
- msgid "Notify about plugin updates?"
159
- msgstr "Über Plugin-Aktualisierungen benachrichtigen?"
160
-
161
- #: wp-updates-notifier.php:419
162
- #@ wp-updates-notifier
163
- msgid "Notify about theme updates?"
164
- msgstr "Über Theme-Aktualisierungen benachrichtigen?"
165
-
166
- #: wp-updates-notifier.php:420
167
- #@ wp-updates-notifier
168
- msgid "Hide core WP update nag from non-admin users?"
169
- msgstr "WordPress-Aktualisierungen vor Nicht-Admins verstecken?"
170
-
171
- #: wp-updates-notifier.php:429
172
- #@ wp-updates-notifier
173
- msgid "Invalid frequency entered"
174
- msgstr "Ungültige Häufigkeit eingegeben"
175
-
176
- #: wp-updates-notifier.php:439
177
- #@ wp-updates-notifier
178
- msgid "One or more email to addresses are invalid"
179
- msgstr "Eine oder mehrere E-Mail-Adressen sind ungültig"
180
-
181
- #: wp-updates-notifier.php:449
182
- #@ wp-updates-notifier
183
- msgid "No email to address entered"
184
- msgstr "Keine E-Mail-Adresse eingegeben"
185
-
186
- #: wp-updates-notifier.php:456
187
- #@ wp-updates-notifier
188
- msgid "Invalid email from entered"
189
- msgstr "Ungültige Absender-E-Mail-Adresse eingegeben"
190
-
191
- #: wp-updates-notifier.php:463
192
- #@ wp-updates-notifier
193
- msgid "Invalid plugin updates value entered"
194
- msgstr "Ungültiger Wert für Plugin-Updates eingegeben"
195
-
196
- #: wp-updates-notifier.php:470
197
- #@ wp-updates-notifier
198
- msgid "Invalid theme updates value entered"
199
- msgstr "Ungültiger Wert für Theme-Updates eingegeben"
200
-
201
- #: wp-updates-notifier.php:477
202
- #@ wp-updates-notifier
203
- msgid "Invalid hide updates value entered"
204
- msgstr "Ungültiger Wert für \\\"Updates verstecken\\\" eingegeben"
205
-
206
- #: wp-updates-notifier.php:488
207
- #@ wp-updates-notifier
208
- msgid "This is a test message from WP Updates Notifier."
209
- msgstr "Dies ist eine Test-Nachricht von WP Updates Notifier."
210
-
211
- #: wp-updates-notifier.php:496
212
- #@ wp-updates-notifier
213
- msgid "Hourly"
214
- msgstr "Stündlich"
215
-
216
- #: wp-updates-notifier.php:497
217
- #@ wp-updates-notifier
218
- msgid "Twice Daily"
219
- msgstr "Zweimal täglich"
220
-
221
- #: wp-updates-notifier.php:498
222
- #@ wp-updates-notifier
223
- msgid "Daily"
224
- msgstr "Täglich"
225
-
226
- #: wp-updates-notifier.php:504
227
- #@ wp-updates-notifier
228
- msgid "Separate multiple email address with a comma (,)"
229
- msgstr "Trenne mehrere E-Mail-Adressen durch Komma (,)"
230
-
231
- #: wp-updates-notifier.php:513
232
- #: wp-updates-notifier.php:521
233
- #: wp-updates-notifier.php:531
234
- #@ wp-updates-notifier
235
- msgid "No"
236
- msgstr "Nein"
237
-
238
- #: wp-updates-notifier.php:514
239
- #: wp-updates-notifier.php:522
240
- #: wp-updates-notifier.php:530
241
- #@ wp-updates-notifier
242
- msgid "Yes"
243
- msgstr "Ja"
244
-
245
- #: wp-updates-notifier.php:515
246
- #@ wp-updates-notifier
247
- msgid "Yes but only active plugins"
248
- msgstr "Ja, aber nur aktive Plugins"
249
-
250
- #: wp-updates-notifier.php:523
251
- #@ wp-updates-notifier
252
- msgid "Yes but only active themes"
253
- msgstr "Ja, aber nur aktives Theme"
254
-
255
- #. translators: plugin header field 'Version'
256
- #: wp-updates-notifier.php:0
257
- #@ wp-updates-notifier
258
- msgid "1.3.1"
259
- msgstr ""
260
-
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WP Updates Notifier v1.3.1\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: 2012-09-29 20:18:52+0000\n"
7
+ "Last-Translator: \n"
8
+ "Language-Team: \n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
13
+ "X-Poedit-Language: \n"
14
+ "X-Poedit-Country: \n"
15
+ "X-Poedit-SourceCharset: utf-8\n"
16
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
17
+ "X-Poedit-Basepath: \n"
18
+ "X-Poedit-Bookmarks: \n"
19
+ "X-Poedit-SearchPath-0: .\n"
20
+ "X-Textdomain-Support: yes"
21
+
22
+ #. translators: plugin header field 'Name'
23
+ #: wp-updates-notifier.php:0
24
+ #: wp-updates-notifier.php:367
25
+ #: wp-updates-notifier.php:400
26
+ #@ wp-updates-notifier
27
+ msgid "WP Updates Notifier"
28
+ msgstr "Aktualisierungsalarm"
29
+
30
+ #. translators: plugin header field 'PluginURI'
31
+ #: wp-updates-notifier.php:0
32
+ #@ wp-updates-notifier
33
+ msgid "http://l3rady.com/projects/wp-updates-notifier/"
34
+ msgstr ""
35
+
36
+ #. translators: plugin header field 'Description'
37
+ #: wp-updates-notifier.php:0
38
+ #@ wp-updates-notifier
39
+ msgid "Sends email to notify you if there are any updates for your WordPress site. Can notify about core, plugin and theme updates."
40
+ msgstr "Sendet E-Mails, um Sie zu benachrichtigen, wenn es irgendwelche Aktualisierungen für Ihre WordPress-Website gibt. Kann über Aktualisierungen für WordPress, Plugins und Themes benachrichtigen."
41
+
42
+ #. translators: plugin header field 'Author'
43
+ #: wp-updates-notifier.php:0
44
+ #@ wp-updates-notifier
45
+ msgid "Scott Cariss"
46
+ msgstr ""
47
+
48
+ #. translators: plugin header field 'AuthorURI'
49
+ #: wp-updates-notifier.php:0
50
+ #@ wp-updates-notifier
51
+ msgid "http://l3rady.com/"
52
+ msgstr ""
53
+
54
+ #: wp-updates-notifier.php:159
55
+ #: wp-updates-notifier.php:414
56
+ #@ wp-updates-notifier
57
+ msgid "Settings"
58
+ msgstr "Einstellungen"
59
+
60
+ #: wp-updates-notifier.php:187
61
+ #@ wp-updates-notifier
62
+ msgid "There are updates available for your WordPress site:"
63
+ msgstr "Es sind Aktualisierungen für Ihre WordPress-Webseite verfügbar:"
64
+
65
+ #: wp-updates-notifier.php:188
66
+ #, php-format
67
+ #@ wp-updates-notifier
68
+ msgid "Please visit %s to update."
69
+ msgstr "Bitte besuche %s um zu updaten."
70
+
71
+ #: wp-updates-notifier.php:209
72
+ #, php-format
73
+ #@ wp-updates-notifier
74
+ msgid "WP-Core: WordPress is out of date. Please update from version %s to %s"
75
+ msgstr "WordPress: WordPress ist veraltet. Bitte update von Version %s auf %s"
76
+
77
+ #: wp-updates-notifier.php:247
78
+ #, php-format
79
+ #@ wp-updates-notifier
80
+ msgid "Plugin: %s is out of date. Please update from version %s to %s"
81
+ msgstr "Plugin: %s ist veraltet. Bitte aktualisiere von Version %s auf %s"
82
+
83
+ #: wp-updates-notifier.php:248
84
+ #, php-format
85
+ #@ wp-updates-notifier
86
+ msgid "Details: %s"
87
+ msgstr "Details: %s"
88
+
89
+ #: wp-updates-notifier.php:249
90
+ #, php-format
91
+ #@ wp-updates-notifier
92
+ msgid "Changelog: %s%s"
93
+ msgstr "Änderungen: %s%s"
94
+
95
+ #: wp-updates-notifier.php:251
96
+ #, php-format
97
+ #@ default
98
+ msgid "Compatibility with WordPress %1$s: 100%% (according to its author)"
99
+ msgstr ""
100
+
101
+ #: wp-updates-notifier.php:254
102
+ #, php-format
103
+ #@ default
104
+ msgid "Compatibility with WordPress %1$s: %2$d%% (%3$d \"works\" votes out of %4$d total)"
105
+ msgstr ""
106
+
107
+ #: wp-updates-notifier.php:256
108
+ #, php-format
109
+ #@ default
110
+ msgid "Compatibility with WordPress %1$s: Unknown"
111
+ msgstr ""
112
+
113
+ #: wp-updates-notifier.php:258
114
+ #, php-format
115
+ #@ wp-updates-notifier
116
+ msgid "Compatibility: %s"
117
+ msgstr "Kompatibilität: %s"
118
+
119
+ #: wp-updates-notifier.php:295
120
+ #, php-format
121
+ #@ wp-updates-notifier
122
+ msgid "Theme: %s is out of date. Please update from version %s to %s"
123
+ msgstr "Theme: %s ist veraltet. Bitte aktualisiere von Version %s auf %s"
124
+
125
+ #: wp-updates-notifier.php:357
126
+ #, php-format
127
+ #@ wp-updates-notifier
128
+ msgid "WP Updates Notifier: Updates Available @ %s"
129
+ msgstr "WP Updates Notifier: Aktualisierungen stehen bereit @ %s"
130
+
131
+ #: wp-updates-notifier.php:406
132
+ #@ wp-updates-notifier
133
+ msgid "Save settings"
134
+ msgstr "Einstellungen speichern"
135
+
136
+ #: wp-updates-notifier.php:407
137
+ #@ wp-updates-notifier
138
+ msgid "Save settings with test email"
139
+ msgstr "Einstellungen speichern und Test-E-Mail versenden"
140
+
141
+ #: wp-updates-notifier.php:415
142
+ #@ wp-updates-notifier
143
+ msgid "Frequency to check"
144
+ msgstr "Check-Häufigkeit"
145
+
146
+ #: wp-updates-notifier.php:416
147
+ #@ wp-updates-notifier
148
+ msgid "Notify email to"
149
+ msgstr "Benachrichtigungs-E-Mail an"
150
+
151
+ #: wp-updates-notifier.php:417
152
+ #@ wp-updates-notifier
153
+ msgid "Notify email from"
154
+ msgstr "Benachrichtigungs-E-Mail-Absender"
155
+
156
+ #: wp-updates-notifier.php:418
157
+ #@ wp-updates-notifier
158
+ msgid "Notify about plugin updates?"
159
+ msgstr "Über Plugin-Aktualisierungen benachrichtigen?"
160
+
161
+ #: wp-updates-notifier.php:419
162
+ #@ wp-updates-notifier
163
+ msgid "Notify about theme updates?"
164
+ msgstr "Über Theme-Aktualisierungen benachrichtigen?"
165
+
166
+ #: wp-updates-notifier.php:420
167
+ #@ wp-updates-notifier
168
+ msgid "Hide core WP update nag from non-admin users?"
169
+ msgstr "WordPress-Aktualisierungen vor Nicht-Admins verstecken?"
170
+
171
+ #: wp-updates-notifier.php:429
172
+ #@ wp-updates-notifier
173
+ msgid "Invalid frequency entered"
174
+ msgstr "Ungültige Häufigkeit eingegeben"
175
+
176
+ #: wp-updates-notifier.php:439
177
+ #@ wp-updates-notifier
178
+ msgid "One or more email to addresses are invalid"
179
+ msgstr "Eine oder mehrere E-Mail-Adressen sind ungültig"
180
+
181
+ #: wp-updates-notifier.php:449
182
+ #@ wp-updates-notifier
183
+ msgid "No email to address entered"
184
+ msgstr "Keine E-Mail-Adresse eingegeben"
185
+
186
+ #: wp-updates-notifier.php:456
187
+ #@ wp-updates-notifier
188
+ msgid "Invalid email from entered"
189
+ msgstr "Ungültige Absender-E-Mail-Adresse eingegeben"
190
+
191
+ #: wp-updates-notifier.php:463
192
+ #@ wp-updates-notifier
193
+ msgid "Invalid plugin updates value entered"
194
+ msgstr "Ungültiger Wert für Plugin-Updates eingegeben"
195
+
196
+ #: wp-updates-notifier.php:470
197
+ #@ wp-updates-notifier
198
+ msgid "Invalid theme updates value entered"
199
+ msgstr "Ungültiger Wert für Theme-Updates eingegeben"
200
+
201
+ #: wp-updates-notifier.php:477
202
+ #@ wp-updates-notifier
203
+ msgid "Invalid hide updates value entered"
204
+ msgstr "Ungültiger Wert für \\\"Updates verstecken\\\" eingegeben"
205
+
206
+ #: wp-updates-notifier.php:488
207
+ #@ wp-updates-notifier
208
+ msgid "This is a test message from WP Updates Notifier."
209
+ msgstr "Dies ist eine Test-Nachricht von WP Updates Notifier."
210
+
211
+ #: wp-updates-notifier.php:496
212
+ #@ wp-updates-notifier
213
+ msgid "Hourly"
214
+ msgstr "Stündlich"
215
+
216
+ #: wp-updates-notifier.php:497
217
+ #@ wp-updates-notifier
218
+ msgid "Twice Daily"
219
+ msgstr "Zweimal täglich"
220
+
221
+ #: wp-updates-notifier.php:498
222
+ #@ wp-updates-notifier
223
+ msgid "Daily"
224
+ msgstr "Täglich"
225
+
226
+ #: wp-updates-notifier.php:504
227
+ #@ wp-updates-notifier
228
+ msgid "Separate multiple email address with a comma (,)"
229
+ msgstr "Trenne mehrere E-Mail-Adressen durch Komma (,)"
230
+
231
+ #: wp-updates-notifier.php:513
232
+ #: wp-updates-notifier.php:521
233
+ #: wp-updates-notifier.php:531
234
+ #@ wp-updates-notifier
235
+ msgid "No"
236
+ msgstr "Nein"
237
+
238
+ #: wp-updates-notifier.php:514
239
+ #: wp-updates-notifier.php:522
240
+ #: wp-updates-notifier.php:530
241
+ #@ wp-updates-notifier
242
+ msgid "Yes"
243
+ msgstr "Ja"
244
+
245
+ #: wp-updates-notifier.php:515
246
+ #@ wp-updates-notifier
247
+ msgid "Yes but only active plugins"
248
+ msgstr "Ja, aber nur aktive Plugins"
249
+
250
+ #: wp-updates-notifier.php:523
251
+ #@ wp-updates-notifier
252
+ msgid "Yes but only active themes"
253
+ msgstr "Ja, aber nur aktives Theme"
254
+
255
+ #. translators: plugin header field 'Version'
256
+ #: wp-updates-notifier.php:0
257
+ #@ wp-updates-notifier
258
+ msgid "1.3.1"
259
+ msgstr ""
260
+
readme.txt CHANGED
@@ -1,88 +1,99 @@
1
- === Plugin Name ===
2
- Contributors: l3rady
3
- Donate link: http://l3rady.com/donate
4
- Tags: admin, theme, monitor, plugin, notification, upgrade, security
5
- Requires at least: 3.1
6
- Tested up to: 3.4.2
7
- Stable tag: 1.3.2
8
-
9
- Sends email to notify you if there are any updates for your WordPress site. Can notify about core, plugin and theme updates.
10
-
11
- == Description ==
12
-
13
- Monitors your WordPress installation for core, plugin and theme updates and emails you when they are available. This plugin is ideal if you don't login to your WordPress admin regularly or you support a client's website.
14
-
15
- *Features*
16
-
17
- - Set the interval of how often to check for updates; hourly, twice daily or daily.
18
- - Sets WordPress to check for updates more often meaning you get to know about updates sooner.
19
- - Get emailed about core, plugin and theme updates.
20
- - Chose if you want to be notified about active only themes and plugins updates.
21
- - Remove upgrade nag message to non-admin users.
22
- - For advanced users there are a number of filters and actions you can use. More coming soon.
23
-
24
- This plugin is a fork of [Update Notifier](http://wordpress.org/extend/plugins/update-notifier/). This plugin was forked because there seemed to be no further development on the existing plugin and there was no way to contact the original author to ask about taking ownership. WP Updates Notifier has the following improvements over Updates Notifier:
25
-
26
- - Completely rewritten from the ground up using best practises for writing WordPress plugins
27
- - Code wrapped in a class so better namespace.
28
- - You can set the cron interval, allowing for more frequent checks.
29
- - Update checks trigger WordPress internal update check before notification.
30
- - Allows you to set the 'from address'.
31
- - Allows you to set multiple 'to addresses'.
32
- - Makes use of the Settings API.
33
- - A number of available hooks and filters for advanced users.
34
- - Active support and development.
35
-
36
- *Languages*
37
-
38
- - German by [Alexander Pfabel](http://alexander.pfabel.de/) - *Added 02 October 2012*
39
-
40
- == Installation ==
41
-
42
- * Unzip and upload contents to your plugins directory (usually wp-content/plugins/).
43
- * Activate plugin
44
- * Visit Settings page under Settings -> WP Updates Monitor in your WordPress Administration Area
45
- * Configure plugin settings
46
- * Wait for email notifications of updates
47
-
48
- == Screenshots ==
49
-
50
- 1. Settings page
51
- 2. Email alert
52
-
53
- == Changelog ==
54
-
55
- = 1.3.2 =
56
- * Added $wp_version globals ( Explains why WordPress Core Updates notifications haven't been working )
57
- * Added missed variable $cur_wp_version
58
-
59
- = 1.3.1 =
60
- * Fixed PHP Fatal error on line 175.
61
-
62
- = 1.3 =
63
- * Added send test email functionality in settings page.
64
- * Fixed `Call-time pass-by-reference has been deprecated` PHP errors.
65
-
66
- = 1.2 =
67
- * Added the ability to allow multiple email address to be added to the `notify to` setting. Multiple email addresses to be comma separated.
68
- * Removed code from last version that was left in from dev. Caused WP to check for update on every admin page load.
69
-
70
- = 1.1 =
71
- * Plugin update notification email now includes links to new plugin description and changelog page.
72
- * Plugin update notification email now shows compatibility of a new plugin. This is same functionality that appears in the WP update area.
73
- * On plugin activation the first update check is scheduled to run an hour after rather than straight away. This stops current awaiting updates being sent to admin email before you've had chance to change the email settings.
74
-
75
- = 1.0.4 =
76
- * Fixed code to not report multiple times of core upgrades. Plugin now only notifies you once of core upgrade until upgrade is done.
77
-
78
- = 1.0.3 =
79
- * When plugin was deactivated then reactivated the cron was not rescheduled unless the settings were saved. This has now been fixed.
80
-
81
- = 1.0.2 =
82
- * Fixed plugin version
83
-
84
- = 1.0.1 =
85
- * Fixed spelling mistake in deactivate hook that stopped deactivate running properly.
86
-
87
- = 1.0 =
88
- * Initial release
 
 
 
 
 
 
 
 
 
 
 
1
+ === Plugin Name ===
2
+ Contributors: l3rady
3
+ Donate link: http://l3rady.com/donate
4
+ Tags: admin, theme, monitor, plugin, notification, upgrade, security
5
+ Requires at least: 3.1
6
+ Tested up to: 3.8.1
7
+ Stable tag: 1.4.1
8
+
9
+ Sends email to notify you if there are any updates for your WordPress site. Can notify about core, plugin and theme updates.
10
+
11
+ == Description ==
12
+
13
+ Monitors your WordPress installation for core, plugin and theme updates and emails you when they are available. This plugin is ideal if you don't login to your WordPress admin regularly or you support a client's website.
14
+
15
+ *Features*
16
+
17
+ - Set the interval of how often to check for updates; hourly, twice daily or daily.
18
+ - Sets WordPress to check for updates more often meaning you get to know about updates sooner.
19
+ - Get emailed about core, plugin and theme updates.
20
+ - Chose if you want to be notified about active only themes and plugins updates.
21
+ - Remove upgrade nag message to non-admin users.
22
+ - For advanced users there are a number of filters and actions you can use. More coming soon.
23
+
24
+ This plugin is a fork of [Update Notifier](http://wordpress.org/extend/plugins/update-notifier/). This plugin was forked because there seemed to be no further development on the existing plugin and there was no way to contact the original author to ask about taking ownership. WP Updates Notifier has the following improvements over Updates Notifier:
25
+
26
+ - Completely rewritten from the ground up using best practises for writing WordPress plugins
27
+ - Code wrapped in a class so better namespace.
28
+ - You can set the cron interval, allowing for more frequent checks.
29
+ - Update checks trigger WordPress internal update check before notification.
30
+ - Allows you to set the 'from address'.
31
+ - Allows you to set multiple 'to addresses'.
32
+ - Makes use of the Settings API.
33
+ - A number of available hooks and filters for advanced users.
34
+ - Active support and development.
35
+
36
+ *Languages*
37
+
38
+ - French by [Christophe Catarina](http://www.ordilibre.com/) - *Added 03 July 2013*
39
+ - German by [Alexander Pfabel](http://alexander.pfabel.de/) - *Added 02 October 2012*
40
+
41
+ == Installation ==
42
+
43
+ * Unzip and upload contents to your plugins directory (usually wp-content/plugins/).
44
+ * Activate plugin
45
+ * Visit Settings page under Settings -> WP Updates Monitor in your WordPress Administration Area
46
+ * Configure plugin settings
47
+ * Wait for email notifications of updates
48
+
49
+ == Screenshots ==
50
+
51
+ 1. Settings page
52
+ 2. Email alert
53
+
54
+ == Changelog ==
55
+
56
+ = 1.4.1 =
57
+ * Switch from using site_url() to home_url() in email subject line so not to link to a 404 page.
58
+
59
+ = 1.4 =
60
+ * Added external cron method allowing users check for updates as often or as little as they want
61
+ * Added sc_wpun_get_options_filter and sc_wpun_put_options_filter filters to allow filtering of this plugins settings
62
+ * Now using wp_get_schedules() rather than statically assigned schedules. This allows admins to set their own schedules such as a weekly one
63
+ * Added French translations
64
+ * Added date and time of when this plugin last did an update check on the settings screen
65
+
66
+ = 1.3.2 =
67
+ * Added $wp_version globals ( Explains why WordPress Core Updates notifications haven't been working )
68
+ * Added missed variable $cur_wp_version
69
+
70
+ = 1.3.1 =
71
+ * Fixed PHP Fatal error on line 175.
72
+
73
+ = 1.3 =
74
+ * Added send test email functionality in settings page.
75
+ * Fixed `Call-time pass-by-reference has been deprecated` PHP errors.
76
+
77
+ = 1.2 =
78
+ * Added the ability to allow multiple email address to be added to the `notify to` setting. Multiple email addresses to be comma separated.
79
+ * Removed code from last version that was left in from dev. Caused WP to check for update on every admin page load.
80
+
81
+ = 1.1 =
82
+ * Plugin update notification email now includes links to new plugin description and changelog page.
83
+ * Plugin update notification email now shows compatibility of a new plugin. This is same functionality that appears in the WP update area.
84
+ * On plugin activation the first update check is scheduled to run an hour after rather than straight away. This stops current awaiting updates being sent to admin email before you've had chance to change the email settings.
85
+
86
+ = 1.0.4 =
87
+ * Fixed code to not report multiple times of core upgrades. Plugin now only notifies you once of core upgrade until upgrade is done.
88
+
89
+ = 1.0.3 =
90
+ * When plugin was deactivated then reactivated the cron was not rescheduled unless the settings were saved. This has now been fixed.
91
+
92
+ = 1.0.2 =
93
+ * Fixed plugin version
94
+
95
+ = 1.0.1 =
96
+ * Fixed spelling mistake in deactivate hook that stopped deactivate running properly.
97
+
98
+ = 1.0 =
99
+ * Initial release
uninstall.php CHANGED
@@ -1,24 +1,24 @@
1
- <?php
2
- /* Copyright 2012 Scott Cariss (email : scott@l3rady.com)
3
-
4
- This program is free software; you can redistribute it and/or modify
5
- it under the terms of the GNU General Public License as published by
6
- the Free Software Foundation; either version 2 of the License, or
7
- (at your option) any later version.
8
-
9
- This program is distributed in the hope that it will be useful,
10
- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- GNU General Public License for more details.
13
-
14
- You should have received a copy of the GNU General Public License
15
- along with this program; if not, write to the Free Software
16
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
- */
18
-
19
- if(!defined('WP_UNINSTALL_PLUGIN')) {
20
- exit();
21
- }
22
- delete_option("sc_wpun_settings");
23
- delete_option("sc_wpun_settings_ver");
24
- ?>
1
+ <?php
2
+ /* Copyright 2014 Scott Cariss (email : scott@l3rady.com)
3
+
4
+ This program is free software; you can redistribute it and/or modify
5
+ it under the terms of the GNU General Public License as published by
6
+ the Free Software Foundation; either version 2 of the License, or
7
+ (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU General Public License for more details.
13
+
14
+ You should have received a copy of the GNU General Public License
15
+ along with this program; if not, write to the Free Software
16
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
+ */
18
+
19
+ if ( !defined( "WP_UNINSTALL_PLUGIN" ) ) {
20
+ exit();
21
+ }
22
+
23
+ delete_option( "sc_wpun_settings" );
24
+ delete_option( "sc_wpun_settings_ver" );
wp-updates-notifier.php CHANGED
@@ -1,547 +1,740 @@
1
- <?php
2
- /*
3
- Plugin Name: WP Updates Notifier
4
- Plugin URI: http://l3rady.com/projects/wp-updates-notifier/
5
- Description: Sends email to notify you if there are any updates for your WordPress site. Can notify about core, plugin and theme updates.
6
- Author: Scott Cariss
7
- Version: 1.3.2
8
- Author URI: http://l3rady.com/
9
- Text Domain: wp-updates-notifier
10
- Domain Path: /languages
11
- */
12
-
13
- /* Copyright 2012 Scott Cariss (email : scott@l3rady.com)
14
-
15
- This program is free software; you can redistribute it and/or modify
16
- it under the terms of the GNU General Public License as published by
17
- the Free Software Foundation; either version 2 of the License, or
18
- (at your option) any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28
- */
29
-
30
- // Only load class if it hasn't already been loaded
31
- if (!class_exists('sc_WPUpdatesNotifier')) {
32
-
33
- // WP Updates Notifier - All the magic happens here!
34
- class sc_WPUpdatesNotifier {
35
- protected static $options_field = "sc_wpun_settings";
36
- protected static $options_field_ver = "sc_wpun_settings_ver";
37
- protected static $options_field_current_ver = "1.0";
38
- protected static $cron_name = "sc_wpun_update_check";
39
- protected static $frequency_intervals = array("hourly", "twicedaily", "daily");
40
-
41
- function __construct() {
42
- // Check settings are up to date
43
- self::settingsUpToDate();
44
- // Create Activation and Deactivation Hooks
45
- register_activation_hook(__FILE__, array(__CLASS__, 'activate'));
46
- register_deactivation_hook(__FILE__, array(__CLASS__, 'deactivate'));
47
- // Internationalization
48
- load_plugin_textdomain('wp-updates-notifier', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/');
49
- // Add Filters
50
- add_filter('plugin_action_links', array(__CLASS__, 'plugin_action_links'), 10, 2); // Add settings link to plugin in plugin list
51
- add_filter('sc_wpun_plugins_need_update', array(__CLASS__, 'check_plugins_against_notified')); // Filter out plugins that need update if already been notified
52
- add_filter('sc_wpun_themes_need_update', array(__CLASS__, 'check_themes_against_notified')); // Filter out themes that need update if already been notified
53
- // Add Actions
54
- add_action('admin_menu', array(__CLASS__, 'admin_settings_menu')); // Add menu to options
55
- add_action('admin_init', array(__CLASS__, 'admin_settings_init')); // Add admin init functions
56
- add_action('admin_init', array(__CLASS__, 'remove_update_nag_for_nonadmins')); // See if we remove update nag for non admins
57
- add_action('sc_wpun_enable_cron', array(__CLASS__, 'enable_cron')); // action to enable cron
58
- add_action('sc_wpun_disable_cron', array(__CLASS__, 'disable_cron')); // action to disable cron
59
- add_action(self::$cron_name, array(__CLASS__, 'do_update_check')); // action to link cron task to actual task
60
- }
61
-
62
-
63
- /**
64
- * Check if this plugin settings are up to date. Firstly check the version in
65
- * the DB. If they don't match then load in defaults but don't override values
66
- * already set. Also this will remove obsolete settings that are not needed.
67
- *
68
- * @return void
69
- */
70
- protected function settingsUpToDate() {
71
- $current_ver = get_option(self::$options_field_ver); // Get current plugin version
72
- if(self::$options_field_current_ver != $current_ver) { // is the version the same as this plugin?
73
- $options = (array) get_option(self::$options_field); // get current settings from DB
74
- $defaults = array( // Here are our default values for this plugin
75
- 'frequency' => self::$frequency_intervals[0],
76
- 'notify_to' => get_option('admin_email'),
77
- 'notify_from' => get_option('admin_email'),
78
- 'notify_plugins' => 1,
79
- 'notify_themes' => 1,
80
- 'hide_updates' => 1,
81
- 'notified' => array(
82
- 'core' => "",
83
- 'plugin' => array(),
84
- 'theme' => array(),
85
- )
86
- );
87
- // Intersect current options with defaults. Basically removing settings that are obsolete
88
- $options = array_intersect_key($options, $defaults);
89
- // Merge current settings with defaults. Basically adding any new settings with defaults that we dont have.
90
- $options = array_merge($defaults, $options);
91
- update_option(self::$options_field, $options); // update settings
92
- update_option(self::$options_field_ver, self::$options_field_current_ver); // update settings version
93
- }
94
- }
95
-
96
-
97
- /**
98
- * Function that deals with activation of this plugin
99
- *
100
- * @return void
101
- */
102
- public function activate() {
103
- do_action("sc_wpun_enable_cron"); // Enable cron
104
- }
105
-
106
-
107
- /**
108
- * Function that deals with de-activation of this plugin
109
- *
110
- * @return void
111
- */
112
- public function deactivate() {
113
- do_action("sc_wpun_disable_cron"); // Disable cron
114
- }
115
-
116
-
117
- /**
118
- * Enable cron for this plugin. Check if a cron should be scheduled.
119
- *
120
- * @param bool|string $manual_interval For setting a manual cron interval.
121
- * @return void
122
- */
123
- public function enable_cron($manual_interval = false) {
124
- $options = get_option(self::$options_field); // get current settings
125
- $currentSchedule = wp_get_schedule(self::$cron_name); // find if a schedule already exists
126
- if(!empty($manual_interval)) {$options['frequency'] = $manual_interval;} // if a manual cron interval is set, use this
127
- if($currentSchedule != $options['frequency']) { // check if the current schedule matches the one set in settings
128
- if(in_array($options['frequency'], self::$frequency_intervals)) { // check the cron setting is valid
129
- do_action("sc_wpun_disable_cron"); // remove any crons for this plugin first so we don't end up with multiple crons doing the same thing.
130
- wp_schedule_event((time()+3600), $options['frequency'], self::$cron_name); // schedule cron for this plugin.
131
- }
132
- }
133
- }
134
-
135
-
136
- /**
137
- * Removes cron for this plugin.
138
- *
139
- * @return void
140
- */
141
- public function disable_cron() {
142
- wp_clear_scheduled_hook(self::$cron_name); // clear cron
143
- }
144
-
145
-
146
- /**
147
- * Adds the settings link under the plugin on the plugin screen.
148
- *
149
- * @param array $links
150
- * @param string $file
151
- * @return array $links
152
- */
153
- public function plugin_action_links($links, $file) {
154
- static $this_plugin;
155
- if (!$this_plugin) {
156
- $this_plugin = plugin_basename(__FILE__);
157
- }
158
- if ($file == $this_plugin){
159
- $settings_link = '<a href="'.site_url().'/wp-admin/options-general.php?page=wp-updates-notifier">'.__("Settings", "wp-updates-notifier").'</a>';
160
- array_unshift($links, $settings_link);
161
- }
162
- return $links;
163
- }
164
-
165
-
166
- /**
167
- * This is run by the cron. The update check checks the core always, the
168
- * plugins and themes if asked. If updates found email notification sent.
169
- *
170
- * @return void
171
- */
172
- public function do_update_check() {
173
- $options = get_option(self::$options_field); // get settings
174
- $message = ""; // start with a blank message
175
- $core_updated = self::core_update_check($message); // check the WP core for updates
176
- if(0 != $options['notify_plugins']) { // are we to check for plugin updates?
177
- $plugins_updated = self::plugins_update_check($message, $options['notify_plugins']); // check for plugin updates
178
- } else {
179
- $plugins_updated = false; // no plugin updates
180
- }
181
- if(0 != $options['notify_themes']) { // are we to check for theme updates?
182
- $themes_updated = self::themes_update_check($message, $options['notify_themes']); // check for theme updates
183
- } else {
184
- $themes_updated = false; // no theme updates
185
- }
186
- if ($core_updated || $plugins_updated || $themes_updated) { // Did anything come back as need updating?
187
- $message = __("There are updates available for your WordPress site:", "wp-updates-notifier")."\n".$message."\n";
188
- $message .= sprintf(__("Please visit %s to update.", "wp-updates-notifier"), admin_url('update-core.php'));
189
- self::send_notification_email($message); // send our notification email.
190
- }
191
- }
192
-
193
-
194
- /**
195
- * Checks to see if any WP core updates
196
- *
197
- * @param string $message holds message to be sent via notification
198
- * @return bool
199
- */
200
- protected function core_update_check(&$message) {
201
- global $wp_version;
202
- $settings = get_option(self::$options_field); // get settings
203
- do_action("wp_version_check"); // force WP to check its core for updates
204
- $update_core = get_site_transient("update_core"); // get information of updates
205
- if('upgrade' == $update_core->updates[0]->response) { // is WP core update available?
206
- if($update_core->updates[0]->current != $settings['notified']['core']) { // have we already notified about this version?
207
- require_once( ABSPATH . WPINC . '/version.php' ); // Including this because some plugins can mess with the real version stored in the DB.
208
- $new_core_ver = $update_core->updates[0]->current; // The new WP core version
209
- $old_core_ver = $wp_version; // the old WP core version
210
- $message .= "\n".sprintf(__("WP-Core: WordPress is out of date. Please update from version %s to %s", "wp-updates-notifier"), $old_core_ver, $new_core_ver)."\n";
211
- $settings['notified']['core'] = $new_core_ver; // set core version we are notifying about
212
- update_option(self::$options_field, $settings); // update settings
213
- return true; // we have updates so return true
214
- } else {
215
- return false; // There are updates but we have already notified in the past.
216
- }
217
- }
218
- $settings['notified']['core'] = ""; // no updates lets set this nothing
219
- update_option(self::$options_field, $settings); // update settings
220
- return false; // no updates return false
221
- }
222
-
223
-
224
- /**
225
- * Check to see if any plugin updates.
226
- *
227
- * @param string $message holds message to be sent via notification
228
- * @param int $allOrActive should we look for all plugins or just active ones
229
- * @return bool
230
- */
231
- protected function plugins_update_check(&$message, $allOrActive) {
232
- global $wp_version;
233
- $cur_wp_version = preg_replace('/-.*$/', '', $wp_version);
234
- $settings = get_option(self::$options_field); // get settings
235
- do_action("wp_update_plugins"); // force WP to check plugins for updates
236
- $update_plugins = get_site_transient('update_plugins'); // get information of updates
237
- if (!empty($update_plugins->response)) { // any plugin updates available?
238
- $plugins_need_update = $update_plugins->response; // plugins that need updating
239
- if(2 == $allOrActive) { // are we to check just active plugins?
240
- $active_plugins = array_flip(get_option('active_plugins')); // find which plugins are active
241
- $plugins_need_update = array_intersect_key($plugins_need_update, $active_plugins); // only keep plugins that are active
242
- }
243
- $plugins_need_update = apply_filters('sc_wpun_plugins_need_update', $plugins_need_update); // additional filtering of plugins need update
244
- if(count($plugins_need_update) >= 1) { // any plugins need updating after all the filtering gone on above?
245
- require_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); // Required for plugin API
246
- require_once(ABSPATH . WPINC . '/version.php' ); // Required for WP core version
247
- foreach($plugins_need_update as $key => $data) { // loop through the plugins that need updating
248
- $plugin_info = get_plugin_data(WP_PLUGIN_DIR . "/" . $key); // get local plugin info
249
- $info = plugins_api('plugin_information', array('slug' => $data->slug )); // get repository plugin info
250
- $message .= "\n".sprintf(__("Plugin: %s is out of date. Please update from version %s to %s", "wp-updates-notifier"), $plugin_info['Name'], $plugin_info['Version'], $data->new_version)."\n";
251
- $message .= "\t".sprintf(__("Details: %s", "wp-updates-notifier"), $data->url)."\n";
252
- $message .= "\t".sprintf(__("Changelog: %s%s", "wp-updates-notifier"), $data->url, "changelog/")."\n";
253
- if ( isset($info->tested) && version_compare($info->tested, $wp_version, '>=') ) {
254
- $compat = sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version);
255
- } elseif ( isset($info->compatibility[$wp_version][$data->new_version]) ) {
256
- $compat = $info->compatibility[$wp_version][$data->new_version];
257
- $compat = sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $wp_version, $compat[0], $compat[2], $compat[1]);
258
- } else {
259
- $compat = sprintf(__('Compatibility with WordPress %1$s: Unknown'), $wp_version);
260
- }
261
- $message .= "\t".sprintf(__("Compatibility: %s", "wp-updates-notifier"), $compat)."\n";
262
- $settings['notified']['plugin'][$key] = $data->new_version; // set plugin version we are notifying about
263
- }
264
- update_option(self::$options_field, $settings); // save settings
265
- return true; // we have plugin updates return true
266
- }
267
- } else {
268
- if(0 != count($settings['notified']['plugin'])) { // is there any plugin notifications?
269
- $settings['notified']['plugin'] = array(); // set plugin notifications to empty as all plugins up-to-date
270
- update_option(self::$options_field, $settings); // save settings
271
- }
272
- }
273
- return false; // No plugin updates so return false
274
- }
275
-
276
-
277
- /**
278
- * Check to see if any theme updates.
279
- *
280
- * @param string $message holds message to be sent via notification
281
- * @param int $allOrActive should we look for all themes or just active ones
282
- * @return bool
283
- */
284
- protected function themes_update_check(&$message, $allOrActive) {
285
- $settings = get_option(self::$options_field); // get settings
286
- do_action("wp_update_themes"); // force WP to check for theme updates
287
- $update_themes = get_site_transient('update_themes'); // get information of updates
288
- if (!empty($update_themes->response)) { // any theme updates available?
289
- $themes_need_update = $update_themes->response; // themes that need updating
290
- if(2 == $allOrActive) { // are we to check just active themes?
291
- $active_theme = array(get_option('template') => array()); // find current theme that is active
292
- $themes_need_update = array_intersect_key($themes_need_update, $active_theme); // only keep theme that is active
293
- }
294
- $themes_need_update = apply_filters('sc_wpun_themes_need_update', $themes_need_update); // additional filtering of themes need update
295
- if(count($themes_need_update) >= 1) { // any themes need updating after all the filtering gone on above?
296
- foreach($themes_need_update as $key => $data) { // loop through the themes that need updating
297
- $theme_info = get_theme_data(WP_CONTENT_DIR . "/themes/" . $key . "/style.css"); // get theme info
298
- $message .= "\n".sprintf(__("Theme: %s is out of date. Please update from version %s to %s", "wp-updates-notifier"), $theme_info['Name'], $theme_info['Version'], $data['new_version'])."\n";
299
- $settings['notified']['theme'][$key] = $data['new_version']; // set theme version we are notifying about
300
- }
301
- update_option(self::$options_field, $settings); // save settings
302
- return true; // we have theme updates return true
303
- }
304
- } else {
305
- if(0 != count($settings['notified']['theme'])) { // is there any theme notifications?
306
- $settings['notified']['theme'] = array(); // set theme notifications to empty as all themes up-to-date
307
- update_option(self::$options_field, $settings); // save settings
308
- }
309
- }
310
- return false; // No theme updates so return false
311
- }
312
-
313
-
314
- /**
315
- * Filter for removing plugins from update list if already been notified about
316
- *
317
- * @param array $plugins_need_update
318
- * @return array $plugins_need_update
319
- */
320
- public function check_plugins_against_notified($plugins_need_update) {
321
- $settings = get_option(self::$options_field); // get settings
322
- foreach($plugins_need_update as $key => $data) { // loop through plugins that need update
323
- if(isset($settings['notified']['plugin'][$key])) { // has this plugin been notified before?
324
- if($data->new_version == $settings['notified']['plugin'][$key]) { // does this plugin version match that of the one that's been notified?
325
- unset($plugins_need_update[$key]); // don't notify this plugin as has already been notified
326
- }
327
- }
328
- }
329
- return $plugins_need_update;
330
- }
331
-
332
-
333
- /**
334
- * Filter for removing themes from update list if already been notified about
335
- *
336
- * @param array $themes_need_update
337
- * @return array $themes_need_update
338
- */
339
- public function check_themes_against_notified($themes_need_update) {
340
- $settings = get_option(self::$options_field); // get settings
341
- foreach($themes_need_update as $key => $data) { // loop through themes that need update
342
- if(isset($settings['notified']['theme'][$key])) { // has this theme been notified before?
343
- if($data['new_version'] == $settings['notified']['theme'][$key]) { // does this theme version match that of the one that's been notified?
344
- unset($themes_need_update[$key]); // don't notify this theme as has already been notified
345
- }
346
- }
347
- }
348
- return $themes_need_update;
349
- }
350
-
351
-
352
- /**
353
- * Sends email notification.
354
- *
355
- * @param string $message holds message to be sent in body of email
356
- * @return void
357
- */
358
- public function send_notification_email($message) {
359
- $settings = get_option(self::$options_field); // get settings
360
- $subject = sprintf(__("WP Updates Notifier: Updates Available @ %s", "wp-updates-notifier"), site_url());
361
- add_filter('wp_mail_from', array(__CLASS__, 'sc_wpun_wp_mail_from')); // add from filter
362
- add_filter('wp_mail_from_name', array(__CLASS__, 'sc_wpun_wp_mail_from_name')); // add from name filter
363
- add_filter('wp_mail_content_type', array(__CLASS__, 'sc_wpun_wp_mail_content_type')); // add content type filter
364
- wp_mail($settings['notify_to'], $subject, $message); // send email
365
- remove_filter('wp_mail_from', array(__CLASS__, 'sc_wpun_wp_mail_from')); // remove from filter
366
- remove_filter('wp_mail_from_name', array(__CLASS__, 'sc_wpun_wp_mail_from_name')); // remove from name filter
367
- remove_filter('wp_mail_content_type', array(__CLASS__, 'sc_wpun_wp_mail_content_type')); // remove content type filter
368
- }
369
- public function sc_wpun_wp_mail_from() { $settings = get_option(self::$options_field); return $settings['notify_from']; }
370
- public function sc_wpun_wp_mail_from_name() { return __("WP Updates Notifier", "wp-updates-notifier"); }
371
- public function sc_wpun_wp_mail_content_type() { return "text/plain"; }
372
-
373
-
374
- /**
375
- * Removes the update nag for non admin users.
376
- *
377
- * @return void
378
- */
379
- public function remove_update_nag_for_nonadmins() {
380
- $settings = get_option(self::$options_field); // get settings
381
- if(1 == $settings['hide_updates']) { // is this enabled?
382
- if (!current_user_can('update_plugins')) { // can the current user update plugins?
383
- remove_action('admin_notices', 'update_nag', 3); // no they cannot so remove the nag for them.
384
- }
385
- }
386
- }
387
-
388
-
389
-
390
- /*
391
- * EVERYTHING SETTINGS
392
- *
393
- * I'm not going to comment any of this as its all pretty
394
- * much straight forward use of the WordPress Settings API.
395
- */
396
- public function admin_settings_menu() {
397
- $page = add_options_page('WP Updates Notifier', 'WP Updates Notifier', 'manage_options', 'wp-updates-notifier', array(__CLASS__, 'settings_page'));
398
- }
399
- public function settings_page() {
400
- ?>
401
- <div class="wrap">
402
- <?php screen_icon(); ?>
403
- <h2><?php _e("WP Updates Notifier", "wp-updates-notifier"); ?></h2>
404
- <form action="options.php" method="post">
405
- <?php
406
- settings_fields("sc_wpun_settings");
407
- do_settings_sections("wp-updates-notifier");
408
- ?>
409
- <input class="button-primary" name="Submit" type="submit" value="<?php _e("Save settings", "wp-updates-notifier"); ?>" />
410
- <input class="button" name="submitwithemail" type="submit" value="<?php _e("Save settings with test email", "wp-updates-notifier"); ?>" />
411
- </form>
412
- </div>
413
- <?php
414
- }
415
- public function admin_settings_init() {
416
- register_setting(self::$options_field, self::$options_field, array(__CLASS__, "sc_wpun_settings_validate")); // Register Main Settings
417
- add_settings_section("sc_wpun_settings_main", __("Settings", "wp-updates-notifier"), array(__CLASS__, "sc_wpun_settings_main_text"), "wp-updates-notifier"); // Make settings main section
418
- add_settings_field("sc_wpun_settings_main_frequency", __("Frequency to check", "wp-updates-notifier"), array(__CLASS__, "sc_wpun_settings_main_field_frequency"), "wp-updates-notifier", "sc_wpun_settings_main");
419
- add_settings_field("sc_wpun_settings_main_notify_to", __("Notify email to", "wp-updates-notifier"), array(__CLASS__, "sc_wpun_settings_main_field_notify_to"), "wp-updates-notifier", "sc_wpun_settings_main");
420
- add_settings_field("sc_wpun_settings_main_notify_from", __("Notify email from", "wp-updates-notifier"), array(__CLASS__, "sc_wpun_settings_main_field_notify_from"), "wp-updates-notifier", "sc_wpun_settings_main");
421
- add_settings_field("sc_wpun_settings_main_notify_plugins", __("Notify about plugin updates?", "wp-updates-notifier"), array(__CLASS__, "sc_wpun_settings_main_field_notify_plugins"), "wp-updates-notifier", "sc_wpun_settings_main");
422
- add_settings_field("sc_wpun_settings_main_notify_themes", __("Notify about theme updates?", "wp-updates-notifier"), array(__CLASS__, "sc_wpun_settings_main_field_notify_themes"), "wp-updates-notifier", "sc_wpun_settings_main");
423
- add_settings_field("sc_wpun_settings_main_hide_updates", __("Hide core WP update nag from non-admin users?", "wp-updates-notifier"), array(__CLASS__, "sc_wpun_settings_main_field_hide_updates"), "wp-updates-notifier", "sc_wpun_settings_main");
424
- }
425
- public function sc_wpun_settings_validate($input) {
426
- $valid = get_option(self::$options_field);
427
-
428
- if(in_array($input['frequency'], self::$frequency_intervals)) {
429
- $valid['frequency'] = $input['frequency'];
430
- do_action("sc_wpun_enable_cron", $input['frequency']);
431
- } else {
432
- add_settings_error("sc_wpun_settings_main_frequency", "sc_wpun_settings_main_frequency_error", __("Invalid frequency entered", "wp-updates-notifier"), "error");
433
- }
434
-
435
- $emails_to = explode(",", $input['notify_to']);
436
- if($emails_to) {
437
- $sanitized_emails = array();
438
- $was_error = false;
439
- foreach($emails_to as $email_to) {
440
- $address = sanitize_email(trim($email_to));
441
- if(!is_email($address)) {
442
- add_settings_error("sc_wpun_settings_main_notify_to", "sc_wpun_settings_main_notify_to_error", __("One or more email to addresses are invalid", "wp-updates-notifier"), "error");
443
- $was_error = true;
444
- break;
445
- }
446
- $sanitized_emails[] = $address;
447
- }
448
- if(!$was_error) {
449
- $valid['notify_to'] = implode(',', $sanitized_emails);
450
- }
451
- } else {
452
- add_settings_error("sc_wpun_settings_main_notify_to", "sc_wpun_settings_main_notify_to_error", __("No email to address entered", "wp-updates-notifier"), "error");
453
- }
454
-
455
- $sanitized_email_from = sanitize_email($input['notify_from']);
456
- if(is_email($sanitized_email_from)) {
457
- $valid['notify_from'] = $sanitized_email_from;
458
- } else {
459
- add_settings_error("sc_wpun_settings_main_notify_from", "sc_wpun_settings_main_notify_from_error", __("Invalid email from entered", "wp-updates-notifier"), "error");
460
- }
461
-
462
- $sanitized_notify_plugins = absint($input['notify_plugins']);
463
- if($sanitized_notify_plugins >= 0 && $sanitized_notify_plugins <= 2) {
464
- $valid['notify_plugins'] = $sanitized_notify_plugins;
465
- } else {
466
- add_settings_error("sc_wpun_settings_main_notify_plugins", "sc_wpun_settings_main_notify_plugins_error", __("Invalid plugin updates value entered", "wp-updates-notifier"), "error");
467
- }
468
-
469
- $sanitized_notify_themes = absint($input['notify_themes']);
470
- if($sanitized_notify_themes >= 0 && $sanitized_notify_themes <= 2) {
471
- $valid['notify_themes'] = $sanitized_notify_themes;
472
- } else {
473
- add_settings_error("sc_wpun_settings_main_notify_themes", "sc_wpun_settings_main_notify_themes_error", __("Invalid theme updates value entered", "wp-updates-notifier"), "error");
474
- }
475
-
476
- $sanitized_hide_updates = absint($input['hide_updates']);
477
- if($sanitized_hide_updates <= 1) {
478
- $valid['hide_updates'] = $sanitized_hide_updates;
479
- } else {
480
- add_settings_error("sc_wpun_settings_main_hide_updates", "sc_wpun_settings_main_hide_updates_error", __("Invalid hide updates value entered", "wp-updates-notifier"), "error");
481
- }
482
-
483
- if(isset($_POST['submitwithemail'])) {
484
- add_filter( 'pre_set_transient_settings_errors', array(__CLASS__, "send_test_email") );
485
- }
486
-
487
- return $valid;
488
- }
489
- public function send_test_email($settings_errors) {
490
- if( isset($settings_errors[0]['type']) && $settings_errors[0]['type'] == "updated" ) {
491
- self::send_notification_email(__("This is a test message from WP Updates Notifier.", "wp-updates-notifier"));
492
- }
493
- }
494
- public function sc_wpun_settings_main_text() {}
495
- public function sc_wpun_settings_main_field_frequency() {
496
- $options = get_option(self::$options_field);
497
- ?>
498
- <select id="sc_wpun_settings_main_frequency" name="<?php echo self::$options_field; ?>[frequency]">
499
- <option value="<?php echo self::$frequency_intervals[0]; ?>" <?php selected( $options['frequency'], self::$frequency_intervals[0] ); ?>><?php _e("Hourly", "wp-updates-notifier"); ?></option>
500
- <option value="<?php echo self::$frequency_intervals[1]; ?>" <?php selected( $options['frequency'], self::$frequency_intervals[1] ); ?>><?php _e("Twice Daily", "wp-updates-notifier"); ?></option>
501
- <option value="<?php echo self::$frequency_intervals[2]; ?>" <?php selected( $options['frequency'], self::$frequency_intervals[2] ); ?>><?php _e("Daily", "wp-updates-notifier"); ?></option>
502
- <select>
503
- <?php
504
- }
505
- public function sc_wpun_settings_main_field_notify_to() {
506
- $options = get_option(self::$options_field);
507
- ?><input id="sc_wpun_settings_main_notify_to" class="regular-text" name="<?php echo self::$options_field; ?>[notify_to]" value="<?php echo $options['notify_to']; ?>" /> <span class="description"><?php _e("Separate multiple email address with a comma (,)", "wp-updates-notifier"); ?></span><?php
508
- }
509
- public function sc_wpun_settings_main_field_notify_from() {
510
- $options = get_option(self::$options_field);
511
- ?><input id="sc_wpun_settings_main_notify_from" class="regular-text" name="<?php echo self::$options_field; ?>[notify_from]" value="<?php echo $options['notify_from']; ?>" /><?php
512
- }
513
- public function sc_wpun_settings_main_field_notify_plugins() {
514
- $options = get_option(self::$options_field);
515
- ?>
516
- <label><input name="<?php echo self::$options_field; ?>[notify_plugins]" type="radio" value="0" <?php checked( $options['notify_plugins'], 0 ); ?> /> <?php _e("No", "wp-updates-notifier"); ?></label><br />
517
- <label><input name="<?php echo self::$options_field; ?>[notify_plugins]" type="radio" value="1" <?php checked( $options['notify_plugins'], 1 ); ?> /> <?php _e("Yes", "wp-updates-notifier"); ?></label><br />
518
- <label><input name="<?php echo self::$options_field; ?>[notify_plugins]" type="radio" value="2" <?php checked( $options['notify_plugins'], 2 ); ?> /> <?php _e("Yes but only active plugins", "wp-updates-notifier"); ?></label>
519
- <?php
520
- }
521
- public function sc_wpun_settings_main_field_notify_themes() {
522
- $options = get_option(self::$options_field);
523
- ?>
524
- <label><input name="<?php echo self::$options_field; ?>[notify_themes]" type="radio" value="0" <?php checked( $options['notify_themes'], 0 ); ?> /> <?php _e("No", "wp-updates-notifier"); ?></label><br />
525
- <label><input name="<?php echo self::$options_field; ?>[notify_themes]" type="radio" value="1" <?php checked( $options['notify_themes'], 1 ); ?> /> <?php _e("Yes", "wp-updates-notifier"); ?></label><br />
526
- <label><input name="<?php echo self::$options_field; ?>[notify_themes]" type="radio" value="2" <?php checked( $options['notify_themes'], 2 ); ?> /> <?php _e("Yes but only active themes", "wp-updates-notifier"); ?></label>
527
- <?php
528
- }
529
- public function sc_wpun_settings_main_field_hide_updates() {
530
- $options = get_option(self::$options_field);
531
- ?>
532
- <select id="sc_wpun_settings_main_hide_updates" name="<?php echo self::$options_field; ?>[hide_updates]">
533
- <option value="1" <?php selected( $options['hide_updates'], 1 ); ?>><?php _e("Yes", "wp-updates-notifier"); ?></option>
534
- <option value="0" <?php selected( $options['hide_updates'], 0 ); ?>><?php _e("No", "wp-updates-notifier"); ?></option>
535
- <select>
536
- <?php
537
- }
538
- /**** END EVERYTHING SETTINGS ****/
539
- }
540
- }
541
-
542
-
543
- // Create Instance of WPUN Class
544
- if (!isset($sc_wpun) && function_exists('add_action')) {
545
- $sc_wpun = new sc_WPUpdatesNotifier();
546
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
547
  ?>
1
+ <?php
2
+ /*
3
+ Plugin Name: WP Updates Notifier
4
+ Plugin URI: https://github.com/l3rady/wp-updates-notifier
5
+ Description: Sends email to notify you if there are any updates for your WordPress site. Can notify about core, plugin and theme updates.
6
+ Author: Scott Cariss
7
+ Version: 1.4.1
8
+ Author URI: http://l3rady.com/
9
+ Text Domain: wp-updates-notifier
10
+ Domain Path: /languages
11
+ */
12
+
13
+ /* Copyright 2014 Scott Cariss (email : scott@l3rady.com)
14
+
15
+ This program is free software; you can redistribute it and/or modify
16
+ it under the terms of the GNU General Public License as published by
17
+ the Free Software Foundation; either version 2 of the License, or
18
+ (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28
+ */
29
+
30
+ // Only load class if it hasn't already been loaded
31
+ if ( !class_exists( 'sc_WPUpdatesNotifier' ) ) {
32
+
33
+ // WP Updates Notifier - All the magic happens here!
34
+ class sc_WPUpdatesNotifier {
35
+ const OPT_FIELD = "sc_wpun_settings";
36
+ const OPT_VERSION_FIELD = "sc_wpun_settings_ver";
37
+ const OPT_VERSION = "5.0";
38
+ const CRON_NAME = "sc_wpun_update_check";
39
+
40
+ public static function init() {
41
+ // Check settings are up to date
42
+ self::settingsUpToDate();
43
+ // Create Activation and Deactivation Hooks
44
+ register_activation_hook( __FILE__, array( __CLASS__, 'activate' ) );
45
+ register_deactivation_hook( __FILE__, array( __CLASS__, 'deactivate' ) );
46
+ // Internationalization
47
+ load_plugin_textdomain( 'wp-updates-notifier', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
48
+ // Add Filters
49
+ add_filter( 'plugin_action_links', array( __CLASS__, 'plugin_action_links' ), 10, 2 ); // Add settings link to plugin in plugin list
50
+ add_filter( 'sc_wpun_plugins_need_update', array( __CLASS__, 'check_plugins_against_notified' ) ); // Filter out plugins that need update if already been notified
51
+ add_filter( 'sc_wpun_themes_need_update', array( __CLASS__, 'check_themes_against_notified' ) ); // Filter out themes that need update if already been notified
52
+ // Add Actions
53
+ add_action( 'admin_menu', array( __CLASS__, 'admin_settings_menu' ) ); // Add menu to options
54
+ add_action( 'admin_init', array( __CLASS__, 'admin_settings_init' ) ); // Add admin init functions
55
+ add_action( 'admin_init', array( __CLASS__, 'remove_update_nag_for_nonadmins' ) ); // See if we remove update nag for non admins
56
+ add_action( 'admin_init', array( __CLASS__, 'admin_register_scripts_styles' ) );
57
+ add_action( 'sc_wpun_enable_cron', array( __CLASS__, 'enable_cron' ) ); // action to enable cron
58
+ add_action( 'sc_wpun_disable_cron', array( __CLASS__, 'disable_cron' ) ); // action to disable cron
59
+ add_action( self::CRON_NAME, array( __CLASS__, 'do_update_check' ) ); // action to link cron task to actual task
60
+ add_action( 'wp_ajax_sc_wpun_check', array( __CLASS__, 'sc_wpun_check' ) ); // Admin ajax hook for remote cron method.
61
+ add_action( 'wp_ajax_nopriv_sc_wpun_check', array( __CLASS__, 'sc_wpun_check' ) ); // Admin ajax hook for remote cron method.
62
+ }
63
+
64
+
65
+ /**
66
+ * Check if this plugin settings are up to date. Firstly check the version in
67
+ * the DB. If they don't match then load in defaults but don't override values
68
+ * already set. Also this will remove obsolete settings that are not needed.
69
+ *
70
+ * @return void
71
+ */
72
+ private function settingsUpToDate() {
73
+ $current_ver = self::getSetOptions( self::OPT_VERSION_FIELD ); // Get current plugin version
74
+ if ( self::OPT_VERSION != $current_ver ) { // is the version the same as this plugin?
75
+ $options = (array) get_option( self::OPT_FIELD ); // get current settings from DB
76
+ $defaults = array( // Here are our default values for this plugin
77
+ 'cron_method' => 'wordpress', // Cron method to be used for scheduling scans
78
+ 'frequency' => 'hourly',
79
+ 'notify_to' => get_option( 'admin_email' ),
80
+ 'notify_from' => get_option( 'admin_email' ),
81
+ 'notify_plugins' => 1,
82
+ 'notify_themes' => 1,
83
+ 'hide_updates' => 1,
84
+ 'notified' => array(
85
+ 'core' => "",
86
+ 'plugin' => array(),
87
+ 'theme' => array(),
88
+ ),
89
+ 'security_key' => sha1( microtime( true ) . mt_rand( 10000, 90000 ) ), // Generate a random key to be used for Other Cron Method,
90
+ 'last_check_time' => false
91
+ );
92
+ // Intersect current options with defaults. Basically removing settings that are obsolete
93
+ $options = array_intersect_key( $options, $defaults );
94
+ // Merge current settings with defaults. Basically adding any new settings with defaults that we dont have.
95
+ $options = array_merge( $defaults, $options );
96
+ self::getSetOptions( self::OPT_FIELD, $options ); // update settings
97
+ self::getSetOptions( self::OPT_VERSION_FIELD, self::OPT_VERSION ); // update settings version
98
+ }
99
+ }
100
+
101
+
102
+ /**
103
+ * Filter for when getting or settings this plugins settings
104
+ *
105
+ * @param string $field Option field name of where we are getting or setting plugin settings
106
+ * @param bool|mixed $settings False if getting settings else an array with settings you are saving
107
+ *
108
+ * @return bool|mixed True or false if setting or an array of settings if getting
109
+ */
110
+ private static function getSetOptions( $field, $settings = false ) {
111
+ if ( $settings === false ) {
112
+ return apply_filters( 'sc_wpun_get_options_filter', get_option( $field ), $field );
113
+ }
114
+
115
+ return update_option( $field, apply_filters( 'sc_wpun_put_options_filter', $settings, $field ) );
116
+ }
117
+
118
+
119
+ /**
120
+ * Function that deals with activation of this plugin
121
+ *
122
+ * @return void
123
+ */
124
+ public static function activate() {
125
+ do_action( "sc_wpun_enable_cron" ); // Enable cron
126
+ }
127
+
128
+
129
+ /**
130
+ * Function that deals with de-activation of this plugin
131
+ *
132
+ * @return void
133
+ */
134
+ public static function deactivate() {
135
+ do_action( "sc_wpun_disable_cron" ); // Disable cron
136
+ }
137
+
138
+
139
+ /**
140
+ * Enable cron for this plugin. Check if a cron should be scheduled.
141
+ *
142
+ * @param bool|string $manual_interval For setting a manual cron interval.
143
+ *
144
+ * @return void
145
+ */
146
+ public function enable_cron( $manual_interval = false ) {
147
+ $options = self::getSetOptions( self::OPT_FIELD ); // Get settings
148
+ $currentSchedule = wp_get_schedule( self::CRON_NAME ); // find if a schedule already exists
149
+
150
+ // if a manual cron interval is set, use this
151
+ if ( false !== $manual_interval ) {
152
+ $options['frequency'] = $manual_interval;
153
+ }
154
+
155
+ if ( "manual" == $options['frequency'] ) {
156
+ do_action( "sc_wpun_disable_cron" ); // Make sure no cron is setup as we are manual
157
+ }
158
+ else {
159
+ // check if the current schedule matches the one set in settings
160
+ if ( $currentSchedule == $options['frequency'] ) {
161
+ return;
162
+ }
163
+
164
+ // check the cron setting is valid
165
+ if ( !in_array( $options['frequency'], self::get_intervals() ) ) {
166
+ return;
167
+ }
168
+
169
+ // Remove any cron's for this plugin first so we don't end up with multiple cron's doing the same thing.
170
+ do_action( "sc_wpun_disable_cron" );
171
+
172
+ // Schedule cron for this plugin.
173
+ wp_schedule_event( time(), $options['frequency'], self::CRON_NAME );
174
+ }
175
+ }
176
+
177
+
178
+ /**
179
+ * Removes cron for this plugin.
180
+ *
181
+ * @return void
182
+ */
183
+ public function disable_cron() {
184
+ wp_clear_scheduled_hook( self::CRON_NAME ); // clear cron
185
+ }
186
+
187
+
188
+ /**
189
+ * Adds the settings link under the plugin on the plugin screen.
190
+ *
191
+ * @param array $links
192
+ * @param string $file
193
+ *
194
+ * @return array $links
195
+ */
196
+ public static function plugin_action_links( $links, $file ) {
197
+ static $this_plugin;
198
+ if ( !$this_plugin ) {
199
+ $this_plugin = plugin_basename( __FILE__ );
200
+ }
201
+ if ( $file == $this_plugin ) {
202
+ $settings_link = '<a href="' . admin_url( 'options-general.php?page=wp-updates-notifier' ) . '">' . __( "Settings", "wp-updates-notifier" ) . '</a>';
203
+ array_unshift( $links, $settings_link );
204
+ }
205
+ return $links;
206
+ }
207
+
208
+
209
+ /**
210
+ * This is run by the cron. The update check checks the core always, the
211
+ * plugins and themes if asked. If updates found email notification sent.
212
+ *
213
+ * @return void
214
+ */
215
+ public function do_update_check() {
216
+ $options = self::getSetOptions( self::OPT_FIELD ); // get settings
217
+ $message = ""; // start with a blank message
218
+ $core_updated = self::core_update_check( $message ); // check the WP core for updates
219
+ if ( 0 != $options['notify_plugins'] ) { // are we to check for plugin updates?
220
+ $plugins_updated = self::plugins_update_check( $message, $options['notify_plugins'] ); // check for plugin updates
221
+ }
222
+ else {
223
+ $plugins_updated = false; // no plugin updates
224
+ }
225
+ if ( 0 != $options['notify_themes'] ) { // are we to check for theme updates?
226
+ $themes_updated = self::themes_update_check( $message, $options['notify_themes'] ); // check for theme updates
227
+ }
228
+ else {
229
+ $themes_updated = false; // no theme updates
230
+ }
231
+ if ( $core_updated || $plugins_updated || $themes_updated ) { // Did anything come back as need updating?
232
+ $message = __( "There are updates available for your WordPress site:", "wp-updates-notifier" ) . "\n" . $message . "\n";
233
+ $message .= sprintf( __( "Please visit %s to update.", "wp-updates-notifier" ), admin_url( 'update-core.php' ) );
234
+ self::send_notification_email( $message ); // send our notification email.
235
+ }
236
+
237
+ self::log_last_check_time();
238
+ }
239
+
240
+
241
+ /**
242
+ * Checks to see if any WP core updates
243
+ *
244
+ * @param string $message holds message to be sent via notification
245
+ *
246
+ * @return bool
247
+ */
248
+ private static function core_update_check( &$message ) {
249
+ global $wp_version;
250
+ $settings = self::getSetOptions( self::OPT_FIELD ); // get settings
251
+ do_action( "wp_version_check" ); // force WP to check its core for updates
252
+ $update_core = get_site_transient( "update_core" ); // get information of updates
253
+ if ( 'upgrade' == $update_core->updates[0]->response ) { // is WP core update available?
254
+ if ( $update_core->updates[0]->current != $settings['notified']['core'] ) { // have we already notified about this version?
255
+ require_once( ABSPATH . WPINC . '/version.php' ); // Including this because some plugins can mess with the real version stored in the DB.
256
+ $new_core_ver = $update_core->updates[0]->current; // The new WP core version
257
+ $old_core_ver = $wp_version; // the old WP core version
258
+ $message .= "\n" . sprintf( __( "WP-Core: WordPress is out of date. Please update from version %s to %s", "wp-updates-notifier" ), $old_core_ver, $new_core_ver ) . "\n";
259
+ $settings['notified']['core'] = $new_core_ver; // set core version we are notifying about
260
+ self::getSetOptions( self::OPT_FIELD, $settings ); // update settings
261
+ return true; // we have updates so return true
262
+ }
263
+ else {
264
+ return false; // There are updates but we have already notified in the past.
265
+ }
266
+ }
267
+ $settings['notified']['core'] = ""; // no updates lets set this nothing
268
+ self::getSetOptions( self::OPT_FIELD, $settings ); // update settings
269
+ return false; // no updates return false
270
+ }
271
+
272
+
273
+ /**
274
+ * Check to see if any plugin updates.
275
+ *
276
+ * @param string $message holds message to be sent via notification
277
+ * @param int $allOrActive should we look for all plugins or just active ones
278
+ *
279
+ * @return bool
280
+ */
281
+ private static function plugins_update_check( &$message, $allOrActive ) {
282
+ global $wp_version;
283
+ $cur_wp_version = preg_replace( '/-.*$/', '', $wp_version );
284
+ $settings = self::getSetOptions( self::OPT_FIELD ); // get settings
285
+ do_action( "wp_update_plugins" ); // force WP to check plugins for updates
286
+ $update_plugins = get_site_transient( 'update_plugins' ); // get information of updates
287
+ if ( !empty( $update_plugins->response ) ) { // any plugin updates available?
288
+ $plugins_need_update = $update_plugins->response; // plugins that need updating
289
+ if ( 2 == $allOrActive ) { // are we to check just active plugins?
290
+ $active_plugins = array_flip( get_option( 'active_plugins' ) ); // find which plugins are active
291
+ $plugins_need_update = array_intersect_key( $plugins_need_update, $active_plugins ); // only keep plugins that are active
292
+ }
293
+ $plugins_need_update = apply_filters( 'sc_wpun_plugins_need_update', $plugins_need_update ); // additional filtering of plugins need update
294
+ if ( count( $plugins_need_update ) >= 1 ) { // any plugins need updating after all the filtering gone on above?
295
+ require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); // Required for plugin API
296
+ require_once( ABSPATH . WPINC . '/version.php' ); // Required for WP core version
297
+ foreach ( $plugins_need_update as $key => $data ) { // loop through the plugins that need updating
298
+ $plugin_info = get_plugin_data( WP_PLUGIN_DIR . "/" . $key ); // get local plugin info
299
+ $info = plugins_api( 'plugin_information', array( 'slug' => $data->slug ) ); // get repository plugin info
300
+ $message .= "\n" . sprintf( __( "Plugin: %s is out of date. Please update from version %s to %s", "wp-updates-notifier" ), $plugin_info['Name'], $plugin_info['Version'], $data->new_version ) . "\n";
301
+ $message .= "\t" . sprintf( __( "Details: %s", "wp-updates-notifier" ), $data->url ) . "\n";
302
+ $message .= "\t" . sprintf( __( "Changelog: %s%s", "wp-updates-notifier" ), $data->url, "changelog/" ) . "\n";
303
+ if ( isset( $info->tested ) && version_compare( $info->tested, $wp_version, '>=' ) ) {
304
+ $compat = sprintf( __( 'Compatibility with WordPress %1$s: 100%% (according to its author)' ), $cur_wp_version );
305
+ }
306
+ elseif ( isset( $info->compatibility[$wp_version][$data->new_version] ) ) {
307
+ $compat = $info->compatibility[$wp_version][$data->new_version];
308
+ $compat = sprintf( __( 'Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)' ), $wp_version, $compat[0], $compat[2], $compat[1] );
309
+ }
310
+ else {
311
+ $compat = sprintf( __( 'Compatibility with WordPress %1$s: Unknown' ), $wp_version );
312
+ }
313
+ $message .= "\t" . sprintf( __( "Compatibility: %s", "wp-updates-notifier" ), $compat ) . "\n";
314
+ $settings['notified']['plugin'][$key] = $data->new_version; // set plugin version we are notifying about
315
+ }
316
+ self::getSetOptions( self::OPT_FIELD, $settings ); // save settings
317
+ return true; // we have plugin updates return true
318
+ }
319
+ }
320
+ else {
321
+ if ( 0 != count( $settings['notified']['plugin'] ) ) { // is there any plugin notifications?
322
+ $settings['notified']['plugin'] = array(); // set plugin notifications to empty as all plugins up-to-date
323
+ self::getSetOptions( self::OPT_FIELD, $settings ); // save settings
324
+ }
325
+ }
326
+ return false; // No plugin updates so return false
327
+ }
328
+
329
+
330
+ /**
331
+ * Check to see if any theme updates.
332
+ *
333
+ * @param string $message holds message to be sent via notification
334
+ * @param int $allOrActive should we look for all themes or just active ones
335
+ *
336
+ * @return bool
337
+ */
338
+ private function themes_update_check( &$message, $allOrActive ) {
339
+ $settings = self::getSetOptions( self::OPT_FIELD ); // get settings
340
+ do_action( "wp_update_themes" ); // force WP to check for theme updates
341
+ $update_themes = get_site_transient( 'update_themes' ); // get information of updates
342
+ if ( !empty( $update_themes->response ) ) { // any theme updates available?
343
+ $themes_need_update = $update_themes->response; // themes that need updating
344
+ if ( 2 == $allOrActive ) { // are we to check just active themes?
345
+ $active_theme = array( get_option( 'template' ) => array() ); // find current theme that is active
346
+ $themes_need_update = array_intersect_key( $themes_need_update, $active_theme ); // only keep theme that is active
347
+ }
348
+ $themes_need_update = apply_filters( 'sc_wpun_themes_need_update', $themes_need_update ); // additional filtering of themes need update
349
+ if ( count( $themes_need_update ) >= 1 ) { // any themes need updating after all the filtering gone on above?
350
+ foreach ( $themes_need_update as $key => $data ) { // loop through the themes that need updating
351
+ $theme_info = wp_get_theme( $key ); // get theme info
352
+ $message .= "\n" . sprintf( __( "Theme: %s is out of date. Please update from version %s to %s", "wp-updates-notifier" ), $theme_info['Name'], $theme_info['Version'], $data['new_version'] ) . "\n";
353
+ $settings['notified']['theme'][$key] = $data['new_version']; // set theme version we are notifying about
354
+ }
355
+ self::getSetOptions( self::OPT_FIELD, $settings ); // save settings
356
+ return true; // we have theme updates return true
357
+ }
358
+ }
359
+ else {
360
+ if ( 0 != count( $settings['notified']['theme'] ) ) { // is there any theme notifications?
361
+ $settings['notified']['theme'] = array(); // set theme notifications to empty as all themes up-to-date
362
+ self::getSetOptions( self::OPT_FIELD, $settings ); // save settings
363
+ }
364
+ }
365
+ return false; // No theme updates so return false
366
+ }
367
+
368
+
369
+ /**
370
+ * Filter for removing plugins from update list if already been notified about
371
+ *
372
+ * @param array $plugins_need_update
373
+ *
374
+ * @return array $plugins_need_update
375
+ */
376
+ public function check_plugins_against_notified( $plugins_need_update ) {
377
+ $settings = self::getSetOptions( self::OPT_FIELD ); // get settings
378
+ foreach ( $plugins_need_update as $key => $data ) { // loop through plugins that need update
379
+ if ( isset( $settings['notified']['plugin'][$key] ) ) { // has this plugin been notified before?
380
+ if ( $data->new_version == $settings['notified']['plugin'][$key] ) { // does this plugin version match that of the one that's been notified?
381
+ unset( $plugins_need_update[$key] ); // don't notify this plugin as has already been notified
382
+ }
383
+ }
384
+ }
385
+ return $plugins_need_update;
386
+ }
387
+
388
+
389
+ /**
390
+ * Filter for removing themes from update list if already been notified about
391
+ *
392
+ * @param array $themes_need_update
393
+ *
394
+ * @return array $themes_need_update
395
+ */
396
+ public function check_themes_against_notified( $themes_need_update ) {
397
+ $settings = self::getSetOptions( self::OPT_FIELD ); // get settings
398
+ foreach ( $themes_need_update as $key => $data ) { // loop through themes that need update
399
+ if ( isset( $settings['notified']['theme'][$key] ) ) { // has this theme been notified before?
400
+ if ( $data['new_version'] == $settings['notified']['theme'][$key] ) { // does this theme version match that of the one that's been notified?
401
+ unset( $themes_need_update[$key] ); // don't notify this theme as has already been notified
402
+ }
403
+ }
404
+ }
405
+ return $themes_need_update;
406
+ }
407
+
408
+
409
+ /**
410
+ * Sends email notification.
411
+ *
412
+ * @param string $message holds message to be sent in body of email
413
+ *
414
+ * @return void
415
+ */
416
+ public function send_notification_email( $message ) {
417
+ $settings = self::getSetOptions( self::OPT_FIELD ); // get settings
418
+ $subject = sprintf( __( "WP Updates Notifier: Updates Available @ %s", "wp-updates-notifier" ), home_url() );
419
+ add_filter( 'wp_mail_from', array( __CLASS__, 'sc_wpun_wp_mail_from' ) ); // add from filter
420
+ add_filter( 'wp_mail_from_name', array( __CLASS__, 'sc_wpun_wp_mail_from_name' ) ); // add from name filter
421
+ add_filter( 'wp_mail_content_type', array( __CLASS__, 'sc_wpun_wp_mail_content_type' ) ); // add content type filter
422
+ wp_mail( $settings['notify_to'], $subject, $message ); // send email
423
+ remove_filter( 'wp_mail_from', array( __CLASS__, 'sc_wpun_wp_mail_from' ) ); // remove from filter
424
+ remove_filter( 'wp_mail_from_name', array( __CLASS__, 'sc_wpun_wp_mail_from_name' ) ); // remove from name filter
425
+ remove_filter( 'wp_mail_content_type', array( __CLASS__, 'sc_wpun_wp_mail_content_type' ) ); // remove content type filter
426
+ }
427
+
428
+ public function sc_wpun_wp_mail_from() {
429
+ $settings = self::getSetOptions( self::OPT_FIELD );
430
+ return $settings['notify_from'];
431
+ }
432
+
433
+ public static function sc_wpun_wp_mail_from_name() {
434
+ return __( "WP Updates Notifier", "wp-updates-notifier" );
435
+ }
436
+
437
+ public static function sc_wpun_wp_mail_content_type() {
438
+ return "text/plain";
439
+ }
440
+
441
+
442
+ private function log_last_check_time() {
443
+ $options = self::getSetOptions( self::OPT_FIELD );
444
+ $options['last_check_time'] = current_time( "timestamp" );
445
+ self::getSetOptions( self::OPT_FIELD, $options );
446
+ }
447
+
448
+
449
+ /**
450
+ * Removes the update nag for non admin users.
451
+ *
452
+ * @return void
453
+ */
454
+ public function remove_update_nag_for_nonadmins() {
455
+ $settings = self::getSetOptions( self::OPT_FIELD ); // get settings
456
+ if ( 1 == $settings['hide_updates'] ) { // is this enabled?
457
+ if ( !current_user_can( 'update_plugins' ) ) { // can the current user update plugins?
458
+ remove_action( 'admin_notices', 'update_nag', 3 ); // no they cannot so remove the nag for them.
459
+ }
460
+ }
461
+ }
462
+
463
+
464
+ /**
465
+ * Adds JS to admin settings screen for this plugin
466
+ */
467
+ public static function admin_register_scripts_styles() {
468
+ wp_register_script( 'wp_updates_monitor_js_function', plugins_url( 'js/function.js', __FILE__ ), array( 'jquery' ), '1.0', true );
469
+ }
470
+
471
+
472
+ static public function sc_wpun_check() {
473
+ $options = self::getSetOptions( self::OPT_FIELD ); // get settings
474
+
475
+ if ( !isset( $_GET['sc_wpun_key'] ) || $options['security_key'] != $_GET['sc_wpun_key'] || "other" != $options['cron_method'] ) {
476
+ return;
477
+ }
478
+
479
+ self::do_update_check();
480
+
481
+ die( __( "Successfully checked for updates.", "wp-updates-notifier" ) );
482
+ }
483
+
484
+
485
+ private static function get_schedules() {
486
+ $schedules = wp_get_schedules();
487
+ uasort( $schedules, array( __CLASS__, 'sort_by_interval' ) );
488
+ return $schedules;
489
+ }
490
+
491
+
492
+ private static function get_intervals() {
493
+ $intervals = array_keys( self::get_schedules() );
494
+ $intervals[] = "manual";
495
+ return $intervals;
496
+ }
497
+
498
+
499
+ private static function sort_by_interval( $a, $b ) {
500
+ return $a['interval'] - $b['interval'];
501
+ }
502
+
503
+
504
+ /*
505
+ * EVERYTHING SETTINGS
506
+ *
507
+ * I'm not going to comment any of this as its all pretty
508
+ * much straight forward use of the WordPress Settings API.
509
+ */
510
+ public static function admin_settings_menu() {
511
+ $page = add_options_page( 'Updates Notifier', 'Updates Notifier', 'manage_options', 'wp-updates-notifier', array( __CLASS__, 'settings_page' ) );
512
+ add_action( "admin_print_scripts-{$page}", array( __CLASS__, 'enqueue_plugin_script' ) );
513
+ }
514
+
515
+ public static function enqueue_plugin_script() {
516
+ wp_enqueue_script( 'wp_updates_monitor_js_function' );
517
+ }
518
+
519
+ public function settings_page() {
520
+ $options = self::getSetOptions( self::OPT_FIELD );
521
+ $date_format = get_option( 'date_format' );
522
+ $time_format = get_option( 'time_format' );
523
+ ?>
524
+ <div class="wrap">
525
+ <?php screen_icon(); ?>
526
+ <h2><?php _e( "Updates Notifier", "wp-updates-notifier" ); ?></h2>
527
+
528
+ <p>
529
+ <span class="description">
530
+ <?php
531
+ if ( false === $options["last_check_time"] ) {
532
+ $scan_date = __( "Never", "wp-updates-notifier" );
533
+ }
534
+ else {
535
+ $scan_date = sprintf(
536
+ __( "%1s @ %2s", "wp-updates-notifier" ),
537
+ date( $date_format, $options["last_check_time"] ),
538
+ date( $time_format, $options['last_check_time'] )
539
+ );
540
+ }
541
+
542
+ echo sprintf( __( "Last scanned: %s", "wp-updates-notifier" ), $scan_date );
543
+ ?>
544
+ </span>
545
+ </p>
546
+
547
+ <form action="<?php echo admin_url( "options.php" ); ?>" method="post">
548
+ <?php
549
+ settings_fields( "sc_wpun_settings" );
550
+ do_settings_sections( "wp-updates-notifier" );
551
+ ?>
552
+ <p>&nbsp;</p>
553
+ <input class="button-primary" name="Submit" type="submit" value="<?php _e( "Save settings", "wp-updates-notifier" ); ?>" />
554
+ <input class="button" name="submitwithemail" type="submit" value="<?php _e( "Save settings with test email", "wp-updates-notifier" ); ?>" />
555
+ </form>
556
+ </div>
557
+ <?php
558
+ }
559
+
560
+ public function admin_settings_init() {
561
+ register_setting( self::OPT_FIELD, self::OPT_FIELD, array( __CLASS__, "sc_wpun_settings_validate" ) ); // Register Main Settings
562
+ add_settings_section( "sc_wpun_settings_main", __( "Settings", "wp-updates-notifier" ), array( __CLASS__, "sc_wpun_settings_main_text" ), "wp-updates-notifier" ); // Make settings main section
563
+ add_settings_field( "sc_wpun_settings_main_cron_method", __( "Cron Method", "wp-updates-notifier" ), array( __CLASS__, "sc_wpun_settings_main_field_cron_method" ), "wp-updates-notifier", "sc_wpun_settings_main" );
564
+ add_settings_field( "sc_wpun_settings_main_frequency", __( "Frequency to check", "wp-updates-notifier" ), array( __CLASS__, "sc_wpun_settings_main_field_frequency" ), "wp-updates-notifier", "sc_wpun_settings_main" );
565
+ add_settings_field( "sc_wpun_settings_main_notify_to", __( "Notify email to", "wp-updates-notifier" ), array( __CLASS__, "sc_wpun_settings_main_field_notify_to" ), "wp-updates-notifier", "sc_wpun_settings_main" );
566
+ add_settings_field( "sc_wpun_settings_main_notify_from", __( "Notify email from", "wp-updates-notifier" ), array( __CLASS__, "sc_wpun_settings_main_field_notify_from" ), "wp-updates-notifier", "sc_wpun_settings_main" );
567
+ add_settings_field( "sc_wpun_settings_main_notify_plugins", __( "Notify about plugin updates?", "wp-updates-notifier" ), array( __CLASS__, "sc_wpun_settings_main_field_notify_plugins" ), "wp-updates-notifier", "sc_wpun_settings_main" );
568
+ add_settings_field( "sc_wpun_settings_main_notify_themes", __( "Notify about theme updates?", "wp-updates-notifier" ), array( __CLASS__, "sc_wpun_settings_main_field_notify_themes" ), "wp-updates-notifier", "sc_wpun_settings_main" );
569
+ add_settings_field( "sc_wpun_settings_main_hide_updates", __( "Hide core WP update nag from non-admin users?", "wp-updates-notifier" ), array( __CLASS__, "sc_wpun_settings_main_field_hide_updates" ), "wp-updates-notifier", "sc_wpun_settings_main" );
570
+ }
571
+
572
+ public function sc_wpun_settings_validate( $input ) {
573
+ $valid = self::getSetOptions( self::OPT_FIELD );
574
+
575
+ if ( isset( $input['cron_method'] ) && in_array( $input['cron_method'], array( "wordpress", "other" ) ) ) {
576
+ $valid['cron_method'] = $input['cron_method'];
577
+ }
578
+ else {
579
+ add_settings_error( "sc_wpun_settings_main_cron_method", "sc_wpun_settings_main_cron_method_error", __( "Invalid cron method selected", "wp-updates-notifier" ), "error" );
580
+ }
581
+
582
+ if ( "other" == $valid['cron_method'] ) {
583
+ $input['frequency'] = "manual";
584
+ }
585
+
586
+ if ( in_array( $input['frequency'], self::get_intervals() ) ) {
587
+ $valid['frequency'] = $input['frequency'];
588
+ do_action( "sc_wpun_enable_cron", $input['frequency'] );
589
+ }
590
+ else {
591
+ add_settings_error( "sc_wpun_settings_main_frequency", "sc_wpun_settings_main_frequency_error", __( "Invalid frequency entered", "wp-updates-notifier" ), "error" );
592
+ }
593
+
594
+ $emails_to = explode( ",", $input['notify_to'] );
595
+ if ( $emails_to ) {
596
+ $sanitized_emails = array();
597
+ $was_error = false;
598
+ foreach ( $emails_to as $email_to ) {
599
+ $address = sanitize_email( trim( $email_to ) );
600
+ if ( !is_email( $address ) ) {
601
+ add_settings_error( "sc_wpun_settings_main_notify_to", "sc_wpun_settings_main_notify_to_error", __( "One or more email to addresses are invalid", "wp-updates-notifier" ), "error" );
602
+ $was_error = true;
603
+ break;
604
+ }
605
+ $sanitized_emails[] = $address;
606
+ }
607
+ if ( !$was_error ) {
608
+ $valid['notify_to'] = implode( ',', $sanitized_emails );
609
+ }
610
+ }
611
+ else {
612
+ add_settings_error( "sc_wpun_settings_main_notify_to", "sc_wpun_settings_main_notify_to_error", __( "No email to address entered", "wp-updates-notifier" ), "error" );
613
+ }
614
+
615
+ $sanitized_email_from = sanitize_email( $input['notify_from'] );
616
+ if ( is_email( $sanitized_email_from ) ) {
617
+ $valid['notify_from'] = $sanitized_email_from;
618
+ }
619
+ else {
620
+ add_settings_error( "sc_wpun_settings_main_notify_from", "sc_wpun_settings_main_notify_from_error", __( "Invalid email from entered", "wp-updates-notifier" ), "error" );
621
+ }
622
+
623
+ $sanitized_notify_plugins = absint( isset( $input['notify_plugins'] ) ? $input['notify_plugins'] : 0 );
624
+ if ( $sanitized_notify_plugins >= 0 && $sanitized_notify_plugins <= 2 ) {
625
+ $valid['notify_plugins'] = $sanitized_notify_plugins;
626
+ }
627
+ else {
628
+ add_settings_error( "sc_wpun_settings_main_notify_plugins", "sc_wpun_settings_main_notify_plugins_error", __( "Invalid plugin updates value entered", "wp-updates-notifier" ), "error" );
629
+ }
630
+
631
+ $sanitized_notify_themes = absint( isset( $input['notify_themes'] ) ? $input['notify_themes'] : 0 );
632
+ if ( $sanitized_notify_themes >= 0 && $sanitized_notify_themes <= 2 ) {
633
+ $valid['notify_themes'] = $sanitized_notify_themes;
634
+ }
635
+ else {
636
+ add_settings_error( "sc_wpun_settings_main_notify_themes", "sc_wpun_settings_main_notify_themes_error", __( "Invalid theme updates value entered", "wp-updates-notifier" ), "error" );
637
+ }
638
+
639
+ $sanitized_hide_updates = absint( isset( $input['hide_updates'] ) ? $input['hide_updates'] : 0 );
640
+ if ( $sanitized_hide_updates <= 1 ) {
641
+ $valid['hide_updates'] = $sanitized_hide_updates;
642
+ }
643
+ else {
644
+ add_settings_error( "sc_wpun_settings_main_hide_updates", "sc_wpun_settings_main_hide_updates_error", __( "Invalid hide updates value entered", "wp-updates-notifier" ), "error" );
645
+ }
646
+
647
+ if ( isset( $_POST['submitwithemail'] ) ) {
648
+ add_filter( 'pre_set_transient_settings_errors', array( __CLASS__, "send_test_email" ) );
649
+ }
650
+
651
+ return $valid;
652
+ }
653
+
654
+ public static function send_test_email( $settings_errors ) {
655
+ if ( isset( $settings_errors[0]['type'] ) && $settings_errors[0]['type'] == "updated" ) {
656
+ self::send_notification_email( __( "This is a test message from WP Updates Notifier.", "wp-updates-notifier" ) );
657
+ }
658
+ }
659
+
660
+ public static function sc_wpun_settings_main_text() {
661
+ }
662
+
663
+ public function sc_wpun_settings_main_field_cron_method() {
664
+ $options = self::getSetOptions( self::OPT_FIELD );
665
+ ?>
666
+ <select name="<?php echo self::OPT_FIELD; ?>[cron_method]">
667
+ <option value="wordpress" <?php selected( $options['cron_method'], "wordpress" ); ?>><?php _e( "WordPress Cron", "wp-updates-notifier" ); ?></option>
668
+ <option value="other" <?php selected( $options['cron_method'], "other" ); ?>><?php _e( "Other Cron", "wp-updates-notifier" ); ?></option>
669
+ </select>
670
+ <div>
671
+ <br />
672
+ <span class="description"><?php _e( "Cron Command: ", "wp-updates-notifier" ); ?></span>
673
+ <pre>wget -q "<?php echo admin_url( "/admin-ajax.php?action=sc_wpun_check&sc_wpun_key=" . $options['security_key'] ); ?>" -O /dev/null >/dev/null 2>&amp;1</pre>
674
+ </div>
675
+ <?php
676
+ }
677
+
678
+ public function sc_wpun_settings_main_field_frequency() {
679
+ $options = self::getSetOptions( self::OPT_FIELD );
680
+ ?>
681
+ <select id="sc_wpun_settings_main_frequency" name="<?php echo self::OPT_FIELD; ?>[frequency]">
682
+ <?php foreach ( self::get_schedules() as $k => $v ): ?>
683
+ <option value="<?php echo $k; ?>" <?php selected( $options['frequency'], $k ); ?>><?php echo $v['display']; ?></option>
684
+ <?php endforeach; ?>
685
+ <select>
686
+ <?php
687
+ }
688
+
689
+ public function sc_wpun_settings_main_field_notify_to() {
690
+ $options = self::getSetOptions( self::OPT_FIELD );
691
+ ?>
692
+ <input id="sc_wpun_settings_main_notify_to" class="regular-text" name="<?php echo self::OPT_FIELD; ?>[notify_to]" value="<?php echo $options['notify_to']; ?>" />
693
+ <span class="description"><?php _e( "Separate multiple email address with a comma (,)", "wp-updates-notifier" ); ?></span><?php
694
+ }
695
+
696
+ public function sc_wpun_settings_main_field_notify_from() {
697
+ $options = self::getSetOptions( self::OPT_FIELD );
698
+ ?>
699
+ <input id="sc_wpun_settings_main_notify_from" class="regular-text" name="<?php echo self::OPT_FIELD; ?>[notify_from]" value="<?php echo $options['notify_from']; ?>" /><?php
700
+ }
701
+
702
+ public function sc_wpun_settings_main_field_notify_plugins() {
703
+ $options = self::getSetOptions( self::OPT_FIELD );
704
+ ?>
705
+ <label><input name="<?php echo self::OPT_FIELD; ?>[notify_plugins]" type="radio" value="0" <?php checked( $options['notify_plugins'], 0 ); ?> /> <?php _e( "No", "wp-updates-notifier" ); ?>
706
+ </label><br />
707
+ <label><input name="<?php echo self::OPT_FIELD; ?>[notify_plugins]" type="radio" value="1" <?php checked( $options['notify_plugins'], 1 ); ?> /> <?php _e( "Yes", "wp-updates-notifier" ); ?>
708
+ </label><br />
709
+ <label><input name="<?php echo self::OPT_FIELD; ?>[notify_plugins]" type="radio" value="2" <?php checked( $options['notify_plugins'], 2 ); ?> /> <?php _e( "Yes but only active plugins", "wp-updates-notifier" ); ?>
710
+ </label>
711
+ <?php
712
+ }
713
+
714
+ public function sc_wpun_settings_main_field_notify_themes() {
715
+ $options = self::getSetOptions( self::OPT_FIELD );
716
+ ?>
717
+ <label><input name="<?php echo self::OPT_FIELD; ?>[notify_themes]" type="radio" value="0" <?php checked( $options['notify_themes'], 0 ); ?> /> <?php _e( "No", "wp-updates-notifier" ); ?>
718
+ </label><br />
719
+ <label><input name="<?php echo self::OPT_FIELD; ?>[notify_themes]" type="radio" value="1" <?php checked( $options['notify_themes'], 1 ); ?> /> <?php _e( "Yes", "wp-updates-notifier" ); ?>
720
+ </label><br />
721
+ <label><input name="<?php echo self::OPT_FIELD; ?>[notify_themes]" type="radio" value="2" <?php checked( $options['notify_themes'], 2 ); ?> /> <?php _e( "Yes but only active themes", "wp-updates-notifier" ); ?>
722
+ </label>
723
+ <?php
724
+ }
725
+
726
+ public function sc_wpun_settings_main_field_hide_updates() {
727
+ $options = self::getSetOptions( self::OPT_FIELD );
728
+ ?>
729
+ <select id="sc_wpun_settings_main_hide_updates" name="<?php echo self::OPT_FIELD; ?>[hide_updates]">
730
+ <option value="1" <?php selected( $options['hide_updates'], 1 ); ?>><?php _e( "Yes", "wp-updates-notifier" ); ?></option>
731
+ <option value="0" <?php selected( $options['hide_updates'], 0 ); ?>><?php _e( "No", "wp-updates-notifier" ); ?></option>
732
+ </select>
733
+ <?php
734
+ }
735
+ /**** END EVERYTHING SETTINGS ****/
736
+ }
737
+ }
738
+
739
+ sc_WPUpdatesNotifier::init();
740
  ?>