| 1 | <?php |
| 2 | /** |
| 3 | * Privacy Policy Screen. |
| 4 | * |
| 5 | * @package WordPress |
| 6 | * @subpackage Administration |
| 7 | */ |
| 8 | |
| 9 | /** WordPress Administration Bootstrap */ |
| 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
| 11 | |
| 12 | if ( ! current_user_can( 'manage_options' ) ) { |
| 13 | wp_die( __( 'Sorry, you are not allowed to manage privacy on this site.' ) ); |
| 14 | } |
| 15 | |
| 16 | $title = __( 'Privacy' ); |
| 17 | |
| 18 | get_current_screen()->add_help_tab( array( |
| 19 | 'id' => 'privacy', |
| 20 | 'title' => __( 'Privacy' ), |
| 21 | 'content' => '<p>' . __( 'This page provides tools with which you can manage your user\'s personal data and site\'s privacy policy.' ) . '</p>', |
| 22 | ) ); |
| 23 | |
| 24 | get_current_screen()->set_help_sidebar( |
| 25 | '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
| 26 | '<p>' . __( '<a href="#">Documentation on privacy</a>' ) . '</p>' |
| 27 | ); |
| 28 | |
| 29 | require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
| 30 | |
| 31 | ?> |
| 32 | <!-- PAGE WRAP --> |
| 33 | <div class="wrap"> |
| 34 | <h1><?php echo esc_html( $title ); ?></h1> |
| 35 | |
| 36 | <!-- TAB PANEL MENU --> |
| 37 | <div class="nav-tab-wrapper wp-clearfix"> |
| 38 | <a href="#" class="nav-tab nav-tab-active" data-tab="privacy-tools"><?php _e( 'Tools' ); ?></a> |
| 39 | <a href="#" class="nav-tab" data-tab="privacy-requests"><?php _e( 'Requests' ); ?></a> |
| 40 | <a href="#" class="nav-tab" data-tab="privacy-information"><?php _e( 'Privacy Policy Information' ); ?></a> |
| 41 | </div> |
| 42 | |
| 43 | |
| 44 | <div class="tabs"> |
| 45 | <!-- TAB Tools --> |
| 46 | <div class="tab privacy-tools"> |
| 47 | <div class="tools-row create-page"> |
| 48 | <h2><?php _e( 'Set up a Privacy Policy Page' ); ?></h2> |
| 49 | <form action="#" id="" method="POST"> |
| 50 | <p class="description"><?php _e( 'You can either select one of your existing Pages to use as a <code>Privacy Policy Page</code> or you can create a new one!' ); ?></p> |
| 51 | <p> |
| 52 | <label for="privacy-policy-page"><?php _e( 'Select an existing Page:' ); ?></label> |
| 53 | <select name="privacy-policy-page" id="privacy-policy-page"> |
| 54 | <option value="0">— Select —</option> |
| 55 | <option class="level-0" value="2">Sample Page</option> |
| 56 | </select> |
| 57 | <input type="submit" class="button button-primary button-save" value="<?php esc_html_e( 'Save' ); ?>"> |
| 58 | <input type="submit" class="button button-primary button-create" value="<?php esc_html_e( 'Create Page' ); ?>"> |
| 59 | </p> |
| 60 | </form> |
| 61 | </div> |
| 62 | <div class="tools-row export-data"> |
| 63 | <h3><?php _e( 'Export Data' ); ?></h3> |
| 64 | <form action="#" id="" method="POST"> |
| 65 | <p class="description"><?php _e( 'You can export a users data by simply entering his <code>E-mail</code> address. All of the Plugins that support this function will automatically export their Data as well.' ); ?></p> |
| 66 | <p> |
| 67 | <label for="email"><?php _e( 'E-mail', 'health-check' ); ?></label> |
| 68 | <input type="text" name="email" id="email" value=""> |
| 69 | <input type="submit" class="button button-primary" value="<?php _e( 'Export' ); ?>"> |
| 70 | </p> |
| 71 | </form> |
| 72 | </div> |
| 73 | <div class="tools-row anonymize-data"> |
| 74 | <h3><?php _e( 'Anonymize Data' ); ?></h3> |
| 75 | <form action="#" id="" method="POST"> |
| 76 | <p class="description"><?php _e( 'You can anonymize a users data by simply entering his <code>E-mail</code> address. All of the Plugins that support this function will automatically anonymize their Data as well.' ); ?></p> |
| 77 | <div class="notice notice-error inline"> |
| 78 | <p><?php _e( 'Caution: You will <code>NOT</code> be able to undo this action.' ); ?></p> |
| 79 | </div> |
| 80 | <p> |
| 81 | <label for="email"><?php _e( 'E-mail', 'health-check' ); ?></label> |
| 82 | <input type="text" name="email" id="email" value=""> |
| 83 | <input type="submit" class="button button-primary" value="<?php _e( 'Anonymize' ); ?>"> |
| 84 | </p> |
| 85 | </form> |
| 86 | </div> |
| 87 | <div class="tools-row delete-data"> |
| 88 | <h3><?php _e( 'Delete Data' ); ?></h3> |
| 89 | <form action="#" id="" method="POST"> |
| 90 | <p class="description"><?php _e( 'You can delete a users data by simply entering his <code>E-mail</code> address. All of the Plugins that support this function will automatically delete their Data as well.' ); ?></p> |
| 91 | <div class="notice notice-error inline"> |
| 92 | <p> |
| 93 | <?php _e( 'Caution: You will <code>NOT</code> be able to undo this action.' ); ?> |
| 94 | </p> |
| 95 | </div> |
| 96 | <p> |
| 97 | <label for="email"><?php _e( 'E-mail', 'health-check' ); ?></label> |
| 98 | <input type="text" name="email" id="email" value=""> |
| 99 | <input type="submit" class="button button-primary" value="<?php _e( 'Delete' ); ?>"> |
| 100 | </p> |
| 101 | </form> |
| 102 | </div> |
| 103 | <div class="information-section"> |
| 104 | <h2><?php _e( 'General Information - What you can do with this new Tools section' ); ?></h2> |
| 105 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis at neque arcu. In id odio porta, eleifend dui vitae, commodo nunc. Praesent vulputate sollicitudin tellus, accumsan auctor tortor suscipit quis. Integer venenatis consectetur sem, vitae dapibus ex sollicitudin vel. Vivamus ac elit et turpis semper faucibus. Nullam hendrerit risus est, aliquet auctor odio auctor ut. Etiam tortor massa, porta vel laoreet quis, iaculis at dolor. Cras nisl enim, vehicula nec laoreet et, feugiat vitae neque. |
| 106 | <br/><br/> |
| 107 | Ut porta velit nec sodales lobortis. Morbi blandit nunc in quam dictum accumsan. Nunc efficitur non neque at sodales. Duis pellentesque bibendum arcu eget congue. Nulla tincidunt ornare nibh, id dapibus odio lobortis vel. In finibus vulputate urna ac gravida. Proin eu molestie sem, nec feugiat nunc. In scelerisque sollicitudin odio nec fringilla. Etiam ornare orci nisl, at vestibulum ipsum fringilla vitae. Sed finibus ipsum ac ligula convallis, in efficitur massa efficitur. |
| 108 | <br/><br/> |
| 109 | Pellentesque libero leo, dignissim sed faucibus eget, egestas ac purus. Vivamus pellentesque erat non orci ornare congue. Suspendisse varius nulla in lorem finibus, nec sollicitudin felis porta. Sed commodo, ante sit amet lobortis varius, ex est accumsan risus, a viverra sem sapien eu ante. Aenean ut finibus ligula. Cras sed dignissim ligula, et eleifend est. Donec id justo dapibus, feugiat tortor at, euismod risus. Nunc dignissim lorem nulla, at iaculis nunc lobortis vitae. Mauris sit amet sapien mattis, auctor ex sed, volutpat massa. Donec ex odio, convallis vitae metus in, viverra rutrum nibh. Aenean congue eros ac egestas mattis. |
| 110 | <br/><br/> |
| 111 | Nulla in orci ultrices, semper odio non, varius nunc. Nulla nec purus magna. Vivamus cursus bibendum nibh, a iaculis lectus mattis vitae. Suspendisse eu accumsan tellus. Curabitur aliquet est ligula, eu imperdiet ex tincidunt in. Nunc in odio accumsan, congue tortor scelerisque, gravida est. Proin quis finibus lectus. Quisque convallis auctor arcu non tristique. Phasellus accumsan leo odio, sed blandit nisi laoreet eu. Nullam lobortis odio neque, sed rutrum nibh sollicitudin id. |
| 112 | </div> |
| 113 | </div> |
| 114 | <!-- TAB Requests --> |
| 115 | <div class="tab privacy-requests"> |
| 116 | |
| 117 | <?php |
| 118 | // Requests come from wp_options as an array of users. |
| 119 | // If user is registered, use an array similar to WP_User, otherwise just the user email. |
| 120 | $requests = array( |
| 121 | array( |
| 122 | 'ID' => 1, |
| 123 | 'full_name' => 'Fernando Claussen', |
| 124 | 'email' => 'test@test.com', |
| 125 | 'date' => '2018/03/07', |
| 126 | 'type' => 'Delete', |
| 127 | ), |
| 128 | array( |
| 129 | 'ID' => 2, |
| 130 | 'full_name' => 'Donald Trump', |
| 131 | 'email' => 'test@test.com', |
| 132 | 'date' => '2018/03/03', |
| 133 | 'type' => 'Anonymize', |
| 134 | ), |
| 135 | ); |
| 136 | |
| 137 | $delete_requests = array_filter( $requests, function( $item ) { |
| 138 | return $item['type'] == 'Delete'; |
| 139 | }); |
| 140 | |
| 141 | $anonymize_requests = array_filter( $requests, function( $item ) { |
| 142 | return $item['type'] == 'Anonymize'; |
| 143 | }); |
| 144 | ?> |
| 145 | |
| 146 | <?php if ( ! empty( $delete_requests ) ): ?> |
| 147 | <h2><?php _e( 'Deletion Requests' ); ?></h2> |
| 148 | <table class="widefat"> |
| 149 | <thead> |
| 150 | <tr> |
| 151 | <th><?php esc_attr_e( 'ID' ); ?></th> |
| 152 | <th><?php esc_attr_e( 'Full Name' ); ?></th> |
| 153 | <th><?php esc_attr_e( 'Email' ); ?></th> |
| 154 | <th><?php esc_attr_e( 'Date of Request' ); ?></th> |
| 155 | <th><?php esc_attr_e( 'Review' ); ?></th> |
| 156 | <th><?php esc_attr_e( 'Action' ); ?></th> |
| 157 | </tr> |
| 158 | </thead> |
| 159 | <tbody> |
| 160 | <?php foreach ($delete_requests as $request ): ?> |
| 161 | <tr> |
| 162 | <td><?php echo esc_html( $request['ID'] ) ?></td> |
| 163 | <td><?php echo esc_html( $request['full_name'] ); ?></td> |
| 164 | <td><?php echo esc_html( $request['email'] ); ?></td> |
| 165 | <td><?php echo esc_html( $request['date'] ); ?></td> |
| 166 | <td> |
| 167 | <button class="button"><?php _e( 'Review Request' ); ?></button> |
| 168 | </td> |
| 169 | <td> |
| 170 | <button class="button button-primary"><?php _e( 'Delete User' ); ?></button> |
| 171 | </td> |
| 172 | </tr> |
| 173 | <?php endforeach; ?> |
| 174 | </tbody> |
| 175 | </table> |
| 176 | <?php endif ?> |
| 177 | <?php if ( ! empty( $anonymize_requests ) ): ?> |
| 178 | <h2><?php _e( 'Anonymize Requests' ); ?></h2> |
| 179 | <table class="widefat"> |
| 180 | <thead> |
| 181 | <tr> |
| 182 | <th><?php esc_attr_e( 'ID' ); ?></th> |
| 183 | <th><?php esc_attr_e( 'Full Name' ); ?></th> |
| 184 | <th><?php esc_attr_e( 'Email' ); ?></th> |
| 185 | <th><?php esc_attr_e( 'Date of Request' ); ?></th> |
| 186 | <th><?php esc_attr_e( 'Review' ); ?></th> |
| 187 | <th><?php esc_attr_e( 'Action' ); ?></th> |
| 188 | </tr> |
| 189 | </thead> |
| 190 | <tbody> |
| 191 | <?php foreach ($anonymize_requests as $request ): ?> |
| 192 | <tr> |
| 193 | <td><?php echo esc_html( $request['ID'] ) ?></td> |
| 194 | <td><?php echo esc_html( $request['full_name'] ); ?></td> |
| 195 | <td><?php echo esc_html( $request['email'] ); ?></td> |
| 196 | <td><?php echo esc_html( $request['date'] ); ?></td> |
| 197 | <td> |
| 198 | <button class="button"><?php _e( 'Review Request' ); ?></button> |
| 199 | </td> |
| 200 | <td> |
| 201 | <button class="button button-primary"><?php _e( 'Anonymize User' ); ?></button> |
| 202 | </td> |
| 203 | </tr> |
| 204 | <?php endforeach; ?> |
| 205 | </tbody> |
| 206 | </table> |
| 207 | <?php endif ?> |
| 208 | </div> |
| 209 | <!-- TAB Privacy Policy Information --> |
| 210 | <div class="tab privacy-information"> |
| 211 | <div id="contextual-help-wrap" class="hidden" tabindex="-1" aria-label="Contextual Help Tab" style="display: block;"> |
| 212 | <div id="contextual-help-back"></div> |
| 213 | <div id="contextual-help-columns"> |
| 214 | <div class="contextual-help-tabs"> |
| 215 | <ul> |
| 216 | <li id="tab-link-core" class="active"> |
| 217 | <a href="#tab-panel-core">Core</a> |
| 218 | </li> |
| 219 | <li id="tab-link-plugin1"> |
| 220 | <a href="#tab-panel-plugin1">Plugin 1</a> |
| 221 | </li> |
| 222 | <li id="tab-link-plugin2"> |
| 223 | <a href="#tab-panel-plugin2">Plugin 2</a> |
| 224 | </li> |
| 225 | </ul> |
| 226 | </div> |
| 227 | <div class="contextual-help-tabs-wrap"> |
| 228 | <div id="tab-panel-core" class="help-tab-content active"> |
| 229 | <h2>Core</h2> |
| 230 | <h3>Privacy Policy</h3> |
| 231 | <p> |
| 232 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis at neque arcu. In id odio porta, eleifend dui vitae, commodo nunc. Praesent vulputate sollicitudin tellus, accumsan auctor tortor suscipit quis. Integer venenatis consectetur sem, vitae dapibus ex sollicitudin vel. Vivamus ac elit et turpis semper faucibus. Nullam hendrerit risus est, aliquet auctor odio auctor ut. Etiam tortor massa, porta vel laoreet quis, iaculis at dolor. Cras nisl enim, vehicula nec laoreet et, feugiat vitae neque. |
| 233 | </p> |
| 234 | <h3>Cookies</h3> |
| 235 | <p> |
| 236 | _one _two _three _cookies _in _the _jar |
| 237 | </p> |
| 238 | <h3>Data</h3> |
| 239 | <p> |
| 240 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis at neque arcu. In id odio porta, eleifend dui vitae, commodo nunc. Praesent vulputate sollicitudin tellus, accumsan auctor tortor suscipit quis. Integer venenatis consectetur sem, vitae dapibus ex sollicitudin vel. Vivamus ac elit et turpis semper faucibus. Nullam hendrerit risus est, aliquet auctor odio auctor ut. Etiam tortor massa, porta vel laoreet quis, iaculis at dolor. Cras nisl enim, vehicula nec laoreet et, feugiat vitae neque. |
| 241 | </p> |
| 242 | </div> |
| 243 | <div id="tab-panel-plugin1" class="help-tab-content"> |
| 244 | <h2>Plugin 1</h2> |
| 245 | <h3>Privacy Policy</h3> |
| 246 | <p> |
| 247 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis at neque arcu. In id odio porta, eleifend dui vitae, commodo nunc. Praesent vulputate sollicitudin tellus, accumsan auctor tortor suscipit quis. Integer venenatis consectetur sem, vitae dapibus ex sollicitudin vel. Vivamus ac elit et turpis semper faucibus. Nullam hendrerit risus est, aliquet auctor odio auctor ut. Etiam tortor massa, porta vel laoreet quis, iaculis at dolor. Cras nisl enim, vehicula nec laoreet et, feugiat vitae neque. |
| 248 | </p> |
| 249 | <h3>Cookies</h3> |
| 250 | <p> |
| 251 | _one _two _three _cookies _in _the _jar |
| 252 | </p> |
| 253 | </div> |
| 254 | <div id="tab-panel-plugin2" class="help-tab-content"> |
| 255 | <h2>Plugin 2</h2> |
| 256 | <h3>Cookies</h3> |
| 257 | <p> |
| 258 | _one _two _three _cookies _in _the _jar |
| 259 | </p> |
| 260 | <h3>Data</h3> |
| 261 | <p> |
| 262 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis at neque arcu. In id odio porta, eleifend dui vitae, commodo nunc. Praesent vulputate sollicitudin tellus, accumsan auctor tortor suscipit quis. Integer venenatis consectetur sem, vitae dapibus ex sollicitudin vel. Vivamus ac elit et turpis semper faucibus. Nullam hendrerit risus est, aliquet auctor odio auctor ut. Etiam tortor massa, porta vel laoreet quis, iaculis at dolor. Cras nisl enim, vehicula nec laoreet et, feugiat vitae neque. |
| 263 | </p> |
| 264 | </div> |
| 265 | </div> |
| 266 | </div> |
| 267 | </div> |
| 268 | </div> |
| 269 | </div> |
| 270 | </div> |
| 271 | <script> |
| 272 | ( function( $ ){ |
| 273 | $( document ).ready( function() { |
| 274 | |
| 275 | |
| 276 | function changePageSelectorButton() { |
| 277 | var privacy_page_id = $('#privacy-policy-page').val(); |
| 278 | if ( privacy_page_id == 0 ) { |
| 279 | $('.button-save').addClass('hidden'); |
| 280 | $('.button-save').siblings().removeClass('hidden'); |
| 281 | } else { |
| 282 | $('.button-create').addClass('hidden'); |
| 283 | $('.button-create').siblings().removeClass('hidden'); |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | changePageSelectorButton(); |
| 288 | |
| 289 | $('#privacy-policy-page').change(function() { |
| 290 | changePageSelectorButton(); |
| 291 | }); |
| 292 | |
| 293 | |
| 294 | $('.nav-tab').on('click', function( e ){ |
| 295 | e.preventDefault(); |
| 296 | |
| 297 | var target = '.' + $(this).data('tab'); |
| 298 | $( target ).show(); |
| 299 | $( target ).siblings().hide(); |
| 300 | $( this ).addClass( 'nav-tab-active' ); |
| 301 | $( this ).siblings().removeClass( 'nav-tab-active' ) |
| 302 | }); |
| 303 | |
| 304 | $( '.tab:eq(0)' ).siblings().css( 'display', 'none' ); |
| 305 | }); |
| 306 | })( jQuery ) |
| 307 | </script> |
| 308 | <style> |
| 309 | body.tools-privacy-php .nav-tab { |
| 310 | background: #ccc; |
| 311 | } |
| 312 | |
| 313 | body.tools-privacy-php .tabs { |
| 314 | margin-top: 20px; |
| 315 | } |
| 316 | |
| 317 | body.tools-privacy-php .nav-tab-active { |
| 318 | border-bottom: 1px solid #f1f1f1; |
| 319 | background: #f1f1f1; |
| 320 | color: #000; |
| 321 | font-weight: 700; |
| 322 | } |
| 323 | |
| 324 | body.tools-privacy-php .information-section { |
| 325 | background: #f6fbfd; |
| 326 | padding: 20px; |
| 327 | } |
| 328 | |
| 329 | body.tools-privacy-php #contextual-help-wrap { |
| 330 | background: #fff; |
| 331 | } |
| 332 | |
| 333 | body.tools-privacy-php #contextual-help-back { |
| 334 | right: 0; |
| 335 | } |
| 336 | |
| 337 | body.tools-privacy-php .tools-row { |
| 338 | background: #fff; |
| 339 | padding: 10px; |
| 340 | margin-bottom: 20px; |
| 341 | } |
| 342 | |
| 343 | body.tools-privacy-php .tab.privacy-tools { |
| 344 | display: block; |
| 345 | } |
| 346 | |
| 347 | @media (min-width: 1024px) { |
| 348 | |
| 349 | body.tools-privacy-php .tools-row { |
| 350 | margin-bottom: 0; |
| 351 | } |
| 352 | |
| 353 | body.tools-privacy-php .tab.privacy-tools { |
| 354 | display: grid; |
| 355 | grid-gap: 20px; |
| 356 | grid-template-columns: [col1-start] calc( 100% - 420px ) [col2-start] 400px [col2-end]; |
| 357 | grid-template-rows: [row1-start] auto [row2-start] auto [row3-start] auto [row4-start] auto [row4-end]; |
| 358 | } |
| 359 | |
| 360 | body.tools-privacy-php .tab.privacy-tools .create-page { |
| 361 | grid-column: col1-start; |
| 362 | grid-row: row1-start ; |
| 363 | } |
| 364 | |
| 365 | body.tools-privacy-php .tab.privacy-tools .export-data { |
| 366 | grid-column: col1-start; |
| 367 | grid-row: row2-start ; |
| 368 | } |
| 369 | |
| 370 | body.tools-privacy-php .tab.privacy-tools .anonymize-data { |
| 371 | grid-column: col1-start; |
| 372 | grid-row: row3-start ; |
| 373 | } |
| 374 | |
| 375 | body.tools-privacy-php .tab.privacy-tools .delete-data { |
| 376 | grid-column: col1-start; |
| 377 | grid-row: row4-start ; |
| 378 | } |
| 379 | |
| 380 | body.tools-privacy-php .tab.privacy-tools .information-section { |
| 381 | grid-column: col2-start; |
| 382 | grid-row: row1-start / row4-end ; |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | </style> |
| 387 | <?php |
| 388 | |
| 389 | include( ABSPATH . 'wp-admin/admin-footer.php' ); |