complianz-gdpr
Last commit date
DNSMPD
2 months ago
assets
1 month ago
config
2 months ago
cookie
1 month ago
cookiebanner
1 month ago
cron
7 months ago
documents
2 months ago
gutenberg
1 month ago
integrations
1 month ago
languages
1 month ago
mailer
1 year ago
onboarding
1 year ago
placeholders
7 months ago
progress
2 years ago
proof-of-consent
1 month ago
rest-api
1 month ago
settings
1 month ago
templates
6 months ago
upgrade
1 month ago
websitescan
2 months ago
LICENSE.txt
4 years ago
README.md
7 months ago
class-admin.php
6 months ago
class-company.php
2 years ago
class-cookie-blocker.php
7 months ago
class-export.php
2 years ago
class-installer.php
2 years ago
class-review.php
11 months ago
complianz-gpdr.php
1 month ago
functions-legacy.php
2 years ago
functions.php
2 months ago
index.php
7 years ago
loco.xml
4 years ago
readme.txt
1 month ago
security.md
2 years ago
system-status.php
1 year ago
uninstall.php
1 month ago
upgrade.php
2 months ago
class-export.php
61 lines
| 1 | <?php |
| 2 | defined( 'ABSPATH' ) or die( "you do not have access to this page!" ); |
| 3 | |
| 4 | if ( ! class_exists( "cmplz_export_settings" ) ) { |
| 5 | class cmplz_export_settings { |
| 6 | private static $_this; |
| 7 | |
| 8 | function __construct() { |
| 9 | if ( isset( self::$_this ) ) { |
| 10 | wp_die( sprintf( '%s is a singleton class and you cannot create a second instance.', |
| 11 | get_class( $this ) ) ); |
| 12 | } |
| 13 | |
| 14 | self::$_this = $this; |
| 15 | add_action( 'admin_init', array( $this, 'process_export_action' ), 10, 1 ); |
| 16 | } |
| 17 | |
| 18 | static function this() { |
| 19 | return self::$_this; |
| 20 | } |
| 21 | |
| 22 | public function process_export_action() { |
| 23 | if ( ! cmplz_user_can_manage() ) { |
| 24 | return; |
| 25 | } |
| 26 | |
| 27 | if ( isset( $_GET['action'] ) |
| 28 | && $_GET['action'] === 'cmplz_export_settings' |
| 29 | ) { |
| 30 | $settings = get_option( 'cmplz_options' ); |
| 31 | //disable A/B testing |
| 32 | $settings['a_b_testing'] = false; |
| 33 | $settings['a_b_testing_buttons'] = false; |
| 34 | |
| 35 | ob_start(); |
| 36 | if (isset($_GET['export_type']) && $_GET['export_type']==='cookiebanner') { |
| 37 | $banner_id = (int) $_GET['id']; |
| 38 | $args = array( |
| 39 | 'banners' => cmplz_get_cookiebanners(array('ID'=>$banner_id)), |
| 40 | ); |
| 41 | } else { |
| 42 | $args = array( |
| 43 | 'settings' => $settings, |
| 44 | 'banners' => cmplz_get_cookiebanners(), |
| 45 | ); |
| 46 | } |
| 47 | |
| 48 | $json = json_encode($args); |
| 49 | $json = $json . '#--COMPLIANZ--#'; |
| 50 | |
| 51 | ob_clean(); |
| 52 | header( 'Content-disposition: attachment; filename=complianz-export.json' ); |
| 53 | header( 'Content-type: application/json' ); |
| 54 | echo $json; |
| 55 | ob_end_flush(); |
| 56 | die(); |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | } |
| 61 |