Akismet Privacy Policies - Version 1.0.0

Version Description

  • Release first version
Download this release

Release Info

Developer Bueltge
Plugin Icon wp plugin Akismet Privacy Policies
Version 1.0.0
Comparing to
See all releases

Version 1.0.0

Files changed (4) hide show
  1. akismet-privacy-policies.php +404 -0
  2. readme.txt +36 -0
  3. screenshot-1.png +0 -0
  4. screenshot-2.png +0 -0
akismet-privacy-policies.php ADDED
@@ -0,0 +1,404 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Akismet Privacy Policies
4
+ */
5
+ /*
6
+ Plugin Name: Akismet Privacy Policies
7
+ Plugin URI: http://wpde.org/
8
+ Description: Ergänzt das Kommentarformular um datenschutzrechtliche Hinweise bei Nutzung des Plugins Akismet.
9
+ Version: 1.0.0
10
+ Author: Inpsyde GmbH
11
+ Author URI: http://inpsyde.com/
12
+ License: GPLv2
13
+ */
14
+
15
+ /*
16
+ This program is free software; you can redistribute it and/or
17
+ modify it under the terms of the GNU General Public License
18
+ as published by the Free Software Foundation; either version 2
19
+ of the License, or (at your option) any later version.
20
+
21
+ This program is distributed in the hope that it will be useful,
22
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
+ GNU General Public License for more details.
25
+
26
+ You should have received a copy of the GNU General Public License
27
+ along with this program; if not, write to the Free Software
28
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29
+ */
30
+
31
+ class Akismet_Privacy_Policies {
32
+
33
+ static private $classobj;
34
+
35
+ // default for active checkbox on comment form
36
+ public $checkbox = 1;
37
+ // default for nitoce on comment form
38
+ public $notice = '<strong>Achtung:</strong> Ich erkläre mich damit einverstanden, dass alle
39
+ eingegebenen Daten und meine IP-Adresse nur zum Zweck der Spamvermeidung durch das Programm
40
+ <a href="http://akismet.com/">Akismet</a> in den USA überprüft und gespeichert werden.';
41
+ // default for error message, if checkbox is not active on comment form
42
+ public $error_message = '<p><strong>Achtung:</strong>
43
+ Du hast die datenschutzrechtlichen Hinweise nicht akzeptiert.</p>';
44
+ // default style to float checkbox
45
+ public $style = 'input#akismet_privacy_check { float: left; margin: 7px 7px 7px 0; width: 13px; }';
46
+
47
+ /**
48
+ * construct
49
+ *
50
+ * @uses add_filter
51
+ * @access public
52
+ * @since 0.0.1
53
+ * @return void
54
+ */
55
+ public function __construct() {
56
+
57
+ register_deactivation_hook( __FILE__, array( &$this, 'unregister_settings' ) );
58
+ register_uninstall_hook( __FILE__, array( 'Akismet_Privacy_Policies', 'unregister_settings' ) );
59
+
60
+ add_filter( 'comment_form_defaults', array( $this, 'add_comment_notice' ), 11, 1 );
61
+ add_action( 'akismet_privacy_policies', array( $this, 'add_comment_notice' ) );
62
+
63
+ $options = get_option( 'akismet_privacy_notice_settings' );
64
+ if ( empty( $options['checkbox'] ) )
65
+ $options['checkbox'] = $this->checkbox;
66
+ if ( $options['checkbox'] )
67
+ add_action( 'pre_comment_on_post', array( $this, 'error_message' ) );
68
+ if ( !isset($options['style']) )
69
+ $options['style'] = $this->style;
70
+ if ( $options['style'] )
71
+ add_action( 'wp_head', array( $this, 'add_style' ) );
72
+
73
+ // for settings
74
+ add_action( 'admin_menu', array( $this, 'add_settings_page' ) );
75
+ add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2 );
76
+ add_action( 'admin_init', array( $this, 'register_settings' ) );
77
+ }
78
+
79
+ /**
80
+ * Handler for the action 'init'. Instantiates this class.
81
+ *
82
+ * @since 0.0.2
83
+ * @access public
84
+ * @return $classobj
85
+ */
86
+ public function get_object() {
87
+ if ( null === self::$classobj ) {
88
+ self::$classobj = new self;
89
+ }
90
+
91
+ return self::$classobj;
92
+ }
93
+
94
+ /**
95
+ * return plugin comment data
96
+ *
97
+ * @since 0.0.2
98
+ * @access public
99
+ * @param $value string, default = 'Version'
100
+ * Name, PluginURI, Version, Description, Author, AuthorURI, TextDomain, DomainPath, Network, Title
101
+ * @return string
102
+ */
103
+ public function get_plugin_data( $value = 'Version' ) {
104
+
105
+ $plugin_data = get_plugin_data( __FILE__ );
106
+ $plugin_value = $plugin_data[$value];
107
+
108
+ return $plugin_value;
109
+ }
110
+
111
+ /**
112
+ * return content for policies inlcude markup
113
+ * use filter hook akismet_privacy_notice_options for change markup or notice
114
+ *
115
+ * @access public
116
+ * @uses apply_filters
117
+ * @since 0.0.1
118
+ * @param array string $arr_comment_defaults
119
+ * @return array | string $arr_comment_defaults or 4html
120
+ */
121
+ public function add_comment_notice($arr_comment_defaults) {
122
+
123
+ if ( is_user_logged_in() )
124
+ return $arr_comment_defaults;
125
+
126
+ $options = get_option( 'akismet_privacy_notice_settings' );
127
+ if ( ! isset( $options['checkbox'] ) || empty( $options['checkbox'] ) && 0 != $options['checkbox'] )
128
+ $options['checkbox'] = $this->checkbox;
129
+ if ( empty( $options['notice'] ) )
130
+ $options['notice'] = $this->notice;
131
+
132
+ $defaults = array(
133
+ 'css_class' => 'privacy-notice'
134
+ , 'html_element' => 'p'
135
+ , 'text' => $options['notice']
136
+ , 'checkbox' => $options['checkbox']
137
+ , 'position' => 'comment_notes_after'
138
+ );
139
+
140
+ // Make it filterable
141
+ $params = apply_filters( 'akismet_privacy_notice_options', $defaults );
142
+
143
+ // Create the output
144
+ $html = "\n" . '<' . $params['html_element'];
145
+ if ( !empty( $params['css_class'] ) )
146
+ $html .= ' class="' . $params['css_class'] . '"';
147
+ $html .= '>' . "\n";
148
+ if ( (bool) $params['checkbox'] ) {
149
+ $html .= '<input type="checkbox" id="akismet_privacy_check" name="akismet_privacy_check" value="1" aria-required="true" />' . "\n";
150
+ $html .= '<label for="akismet_privacy_check">';
151
+ }
152
+ $html .= $params['text'];
153
+ if ( (bool) $params['checkbox'] )
154
+ $html .= '</label>';
155
+ $html .='</' . $params['html_element'] . '>' . "\n";
156
+
157
+ // Add the text to array
158
+ if ( isset($arr_comment_defaults['comment_notes_after']) ) {
159
+ $arr_comment_defaults['comment_notes_after'] .= $html;
160
+ return $arr_comment_defaults;
161
+ } else { // for custom hook in theme
162
+ $arr_comment_defaults = $html;
163
+ echo $arr_comment_defaults;
164
+ }
165
+ }
166
+
167
+ /**
168
+ * Return Message on inactive checkbox
169
+ * Use filter akismet_privacy_error_message for change text or markup
170
+ *
171
+ * @uses wp_die
172
+ * @access public
173
+ * @since 0.0.2
174
+ * @return void
175
+ */
176
+ public function error_message() {
177
+
178
+ if ( is_user_logged_in() )
179
+ return NULL;
180
+
181
+ $options = get_option( 'akismet_privacy_notice_settings' );
182
+ if ( empty( $options['error_message'] ) )
183
+ $options['error_message'] = $this->error_message;
184
+
185
+ // check for checkbox active
186
+ if ( isset( $_POST['comment'] ) && ( ! isset( $_POST['akismet_privacy_check'] ) ) ) {
187
+ $message = apply_filters( 'akismet_privacy_error_message', $options['error_message'] );
188
+ wp_die( $message );
189
+ }
190
+ }
191
+
192
+ /**
193
+ * Echo style in wp_head
194
+ *
195
+ * @uses get_option, plugin_action_links, plugin_basename
196
+ * @access public
197
+ * @since 0.0.2
198
+ * @return string $links
199
+ */
200
+ public function add_style() {
201
+
202
+ if ( is_user_logged_in() )
203
+ return NULL;
204
+
205
+ $options = get_option( 'akismet_privacy_notice_settings' );
206
+ if ( empty( $options['style'] ) )
207
+ $options['style'] = $this->style;
208
+
209
+ echo '<style type="text/css" media="screen">' . $options['style'] . '</style>';
210
+ }
211
+
212
+ /**
213
+ * Add settings link on plugins.php in backend
214
+ *
215
+ * @uses plugin_basename
216
+ * @access public
217
+ * @param array $links, string $file
218
+ * @since 0.0.2
219
+ * @return string $links
220
+ */
221
+ public function plugin_action_links( $links, $file ) {
222
+ if ( plugin_basename( dirname(__FILE__).'/akismet-privacy-policies.php' ) == $file ) {
223
+ $links[] = '<a href="options-general.php?page=akismet_privacy_notice_settings_group">' . __('Settings') . '</a>';
224
+ }
225
+
226
+ return $links;
227
+ }
228
+
229
+ /**
230
+ * Add settings page in WP backend
231
+ *
232
+ * @uses add_options_page
233
+ * @access public
234
+ * @since 0.0.2
235
+ * @return void
236
+ */
237
+ public function add_settings_page() {
238
+
239
+ add_options_page(
240
+ 'Akismet Privacy Policies Settings',
241
+ 'Akismet Privacy Policies',
242
+ 'manage_options',
243
+ 'akismet_privacy_notice_settings_group',
244
+ array( $this, 'get_settings_page' )
245
+ );
246
+
247
+ add_action( 'contextual_help', array( $this, 'contextual_help' ), 10, 3 );
248
+ }
249
+
250
+ /**
251
+ * Return form and markup on settings page
252
+ *
253
+ * @uses settings_fields, normalize_whitespace
254
+ * @access public
255
+ * @since 0.0.2
256
+ * @return void
257
+ */
258
+ public function get_settings_page() {
259
+ ?>
260
+ <div class="wrap">
261
+ <h2><?php echo $this->get_plugin_data('Name'); ?></h2>
262
+
263
+ <form method="post" action="options.php">
264
+ <?php
265
+ settings_fields( 'akismet_privacy_notice_settings_group' );
266
+ $options = get_option( 'akismet_privacy_notice_settings' );
267
+ if ( ! isset($options['checkbox']) || empty( $options['checkbox'] ) && 0 != $options['checkbox'] )
268
+ $options['checkbox'] = $this->checkbox;
269
+ if ( empty( $options['notice'] ) )
270
+ $options['notice'] = normalize_whitespace( $this->notice );
271
+ if ( empty( $options['error_message'] ) )
272
+ $options['error_message'] = normalize_whitespace( $this->error_message );
273
+ if ( empty( $options['style'] ) )
274
+ $options['style'] = normalize_whitespace( $this->style );
275
+ ?>
276
+
277
+ <table class="form-table">
278
+ <tr valign="top">
279
+ <td scope="row"><label for="akismet_privacy_checkbox">Aktives Prüfen via Checkbox</label></td>
280
+ <td><input type="checkbox" id="akismet_privacy_checkbox" name="akismet_privacy_notice_settings[checkbox]" value="1"
281
+ <?php if ( isset( $options['checkbox'] ) ) checked( '1', $options['checkbox'] ); ?> />
282
+ </td>
283
+ </tr>
284
+ <tr valign="top">
285
+ <td scope="row"><label for="akismet_privacy_notice">Datenschutzrechtlicher Hinweis</label></td>
286
+ <td><textarea id="akismet_privacy_notice" name="akismet_privacy_notice_settings[notice]" cols="80" rows="10"
287
+ aria-required="true" ><?php if ( isset($options['notice']) ) echo $options['notice']; ?></textarea>
288
+ <br /><strong>Hinweis:</strong> HTML möglich
289
+ <br /><strong>Beispiel:</strong> <?php echo esc_html( $this->notice ); ?>
290
+ </td>
291
+ </tr>
292
+ <tr valign="top">
293
+ <td scope="row"><label for="akismet_privacy_error_message">Fehler-Hinweis</label></td>
294
+ <td><textarea id="akismet_privacy_error_message" name="akismet_privacy_notice_settings[error_message]" cols="80"
295
+ rows="10" aria-required="true" ><?php if ( isset($options['error_message']) ) echo $options['error_message']; ?></textarea>
296
+ <br /><strong>Hinweis:</strong> HTML möglich
297
+ <br /><strong>Beispiel:</strong> <?php echo esc_html( $this->error_message ); ?>
298
+ </td>
299
+ </tr>
300
+ <tr valign="top">
301
+ <td scope="row"><label for="akismet_privacy_style">Stylesheet</label></td>
302
+ <td><textarea id="akismet_privacy_style" name="akismet_privacy_notice_settings[style]" cols="80"
303
+ rows="10" aria-required="true" ><?php if ( isset($options['style']) ) echo $options['style']; ?></textarea>
304
+ <br /><strong>Hinweis:</strong> CSS notwendig
305
+ <br /><strong>Beispiel:</strong> <?php echo esc_html( $this->style ); ?>
306
+ </td>
307
+ </tr>
308
+ </table>
309
+
310
+ <p class="submit">
311
+ <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
312
+ </p>
313
+
314
+ </form>
315
+ </div>
316
+ <?php
317
+ }
318
+
319
+ /**
320
+ * Validate settings for options
321
+ *
322
+ * @uses normalize_whitespace
323
+ * @access public
324
+ * @param array $value
325
+ * @since 0.0.2
326
+ * @return string $value
327
+ */
328
+ public function validate_settings( $value ) {
329
+
330
+ if ( isset($value['checkbox']) && 1 == $value['checkbox'] )
331
+ $value['checkbox'] = 1;
332
+ else
333
+ $value['checkbox'] = 0;
334
+ $value['notice'] = normalize_whitespace( $value['notice'] );
335
+ $value['error_message'] = normalize_whitespace( $value['error_message'] );
336
+ $value['style'] = normalize_whitespace( $value['style'] );
337
+
338
+ return $value;
339
+ }
340
+
341
+ /**
342
+ * Register settings for options
343
+ *
344
+ * @uses register_setting
345
+ * @access public
346
+ * @since 0.0.2
347
+ * @return void
348
+ */
349
+ public function register_settings() {
350
+
351
+ register_setting( 'akismet_privacy_notice_settings_group', 'akismet_privacy_notice_settings', array( $this, 'validate_settings' ) );
352
+ }
353
+
354
+ /**
355
+ * Unregister and delete settings; clean database
356
+ *
357
+ * @uses unregister_setting, delete_option
358
+ * @access public
359
+ * @since 0.0.2
360
+ * @return void
361
+ */
362
+ public function unregister_settings() {
363
+
364
+ unregister_setting( 'akismet_privacy_notice_settings_group', 'akismet_privacy_notice_settings' );
365
+ delete_option( 'akismet_privacy_notice_settings' );
366
+ }
367
+
368
+ /**
369
+ * Add help text
370
+ *
371
+ * @uses normalize_whitespace
372
+ * @param string $contextual_help
373
+ * @param string $screen_id
374
+ * @param string $screen
375
+ * @since 0.0.2
376
+ * @return string $contextual_help
377
+ */
378
+ public function contextual_help($contextual_help, $screen_id, $screen) {
379
+
380
+ if ( 'settings_page_akismet_privacy_notice_settings_group' !== $screen_id )
381
+ return $contextual_help;
382
+
383
+ $contextual_help =
384
+ '<p>' . __( 'Das Plugin ergänzt das Kommentarformular um datenschutzrechtliche Hinweise,
385
+ die erforderlich sind, wenn du das Plugin Akismet einsetzt.' ) . '</p>'
386
+ . '<ul>'
387
+ . '<li>' . __( 'Du kannst diverse Einstellungen vornehmen, nutze dazu die Möglichkeiten innerhalb der Einstellungen.' ) . '</li>'
388
+ . '<li>' . __( 'Eingeloggte Anwender sehen den Hinweis am Kommentarformular nicht.' ) . '</li>'
389
+ . '<li>' . __( 'Weitere Informationen zum Thema findest du in <a href="http://faq.wpde.org/hinweise-zum-datenschutz-beim-einsatz-von-akismet-in-deutschland/">diesem Artikel der WordPress Deutschland FAQ</a>' ) . '</li>'
390
+ . '</ul>';
391
+
392
+ return normalize_whitespace( $contextual_help );
393
+ }
394
+
395
+ } // end class
396
+
397
+ if ( function_exists('add_action') && class_exists('Akismet_Privacy_Policies') ) {
398
+ add_action( 'plugins_loaded', array( 'Akismet_Privacy_Policies', 'get_object' ) );
399
+ } else {
400
+ header( 'Status: 403 Forbidden' );
401
+ header( 'HTTP/1.1 403 Forbidden' );
402
+ exit();
403
+ }
404
+ ?>
readme.txt ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Akismet Privacy Policies ===
2
+ Contributors: Inpsyde, Bueltge, jottlieb, nullbyte
3
+ Tags: akismet, privacy, spam
4
+ Requires at least: 3.0
5
+ Tested up to: 3.1.1
6
+ Stable tag: 1.0.0
7
+
8
+ Ergänzt das Kommentarformular um datenschutzrechtliche Hinweise bei Nutzung des Plugins Akismet.
9
+
10
+ == Description ==
11
+ Der Einsatz des Anti-Spam-Plugins Akismet ist in Deutschland aus datenschutzrechtlichen Aspekten sehr bedenklich, da personenbezogene Daten auf Servern in den USA gespeichert werden.
12
+
13
+ Um keine Angriffsfläche für Abmahnungen zu bieten, muss man die Benutzer vor dem Kommentieren auf das Speichern dieser Daten hinweisen. Dies übernimmt das Plugin.
14
+
15
+
16
+ == Installation ==
17
+ 1. Plugin herunterladen, entpacken, in den Ordner `wp-content/plugins/` laden und aktivieren. Oder direkt über den Adminbereich und 'Plugins' - 'Installieren' das Plugin suchen und installieren.
18
+ 2. Das Plugin sollte nun automatisch unter dem Kommentarfeld den Hinweistext anzeigen. Falls nicht, muss im Theme (z.B. comments.php) manuell folgender Code eingefügt werden:
19
+ `<?php do_action( 'akismet_privacy_policies' ); ?>`
20
+ Der Aufruf muss an der Stelle des Templates statt finden, wo die Ausgabe erscheinen soll.
21
+
22
+ == Frequently Asked Questions ==
23
+ = Wo finde ich weitere Informationen zum Thema Datenschutz und Akismet? =
24
+
25
+ Wir haben bei WordPress Deutschland einen [FAQ-Artikel](http://faq.wordpress-deutschland.org/hinweise-zum-datenschutz-beim-einsatz-von-akismet-in-deutschland/ "FAQ-Artikel zu Akismet").
26
+
27
+ Rechtsanwalt Thomas Schwenke klärt in einem Artikel auf: [Usability VS Datenschutz – Datenschutzrechtliche Einwilligung ohne Opt-In?](http://spreerecht.de/datenschutz/2011-04/usability-vs-datenschutz-datenschutzrechtliche-einwilligung-ohne-opt-in)
28
+
29
+ == Screenshots ==
30
+ 1. So sieht das Plugin im Einsatz aus.
31
+ 2. Die optionalen Einstellungen im Backend von WordPress
32
+
33
+ == Changelog ==
34
+ = 1.0.0 =
35
+ * Release first version
36
+
screenshot-1.png ADDED
Binary file
screenshot-2.png ADDED
Binary file