app_login_url = 'https://app.hu-manity.co/#/en/cc2/login'; } /** * Load scripts and styles - admin. */ public function admin_enqueue_scripts( $page ) { if ( in_array( Cookie_Notice()->get_status(), array( 'active', 'pending' ) ) ) return; wp_enqueue_style( 'dashicons' ); wp_enqueue_style( 'cookie-notice-modaal', plugins_url( '../assets/modaal/css/modaal.min.css', __FILE__ ), array(), Cookie_Notice()->defaults['version'] ); wp_enqueue_script( 'cookie-notice-modaal', plugins_url( '../assets/modaal/js/modaal.min.js', __FILE__ ), array(), Cookie_Notice()->defaults['version'] ); wp_enqueue_style( 'cookie-notice-spectrum', plugins_url( '../assets/spectrum/spectrum.min.css', __FILE__ ), array(), Cookie_Notice()->defaults['version'] ); wp_enqueue_style( 'cookie-notice-microtip', plugins_url( '../assets/microtip/microtip.min.css', __FILE__ ), array(), Cookie_Notice()->defaults['version'] ); wp_enqueue_script( 'cookie-notice-spectrum', plugins_url( '../assets/spectrum/spectrum.min.js', __FILE__ ), array(), Cookie_Notice()->defaults['version'] ); wp_enqueue_script( 'cookie-notice-welcome', plugins_url( '../js/admin-welcome.js', __FILE__ ), array( 'jquery', 'jquery-ui-core', 'jquery-ui-progressbar' ), Cookie_Notice()->defaults['version'] ); wp_enqueue_script( 'cookie-notice-braintree-client', 'https://js.braintreegateway.com/web/3.71.0/js/client.min.js', array(), null, false ); wp_enqueue_script( 'cookie-notice-braintree-hostedfields', 'https://js.braintreegateway.com/web/3.71.0/js/hosted-fields.min.js', array(), null, false ); wp_enqueue_script( 'cookie-notice-braintree-paypal', 'https://js.braintreegateway.com/web/3.71.0/js/paypal-checkout.min.js', array(), null, false ); $js_args = array( 'ajaxURL' => admin_url( 'admin-ajax.php' ), 'nonce' => wp_create_nonce( 'cookie-notice-welcome' ), 'initModal' => get_transient( 'cn_show_welcome' ), // welcome modal 'error' => __( 'Unexpected error occurred. Please try again later.', 'cookie-notice' ), 'statusPassed' => __( 'Passed', 'cookie-notice' ), 'statusFailed' => __( 'Failed', 'cookie-notice' ), 'complianceStatus' => Cookie_Notice()->get_status(), 'complianceFailed' => __( 'Compliance Failed!Your website does not achieve minimum viable compliance. Sign up to Cookie Compliance to bring your site into compliance with the latest data privacy rules and regulations.', 'cookie-notice' ), 'compliancePassed' => __( 'Compliance Passed!Congratulations. Your website meets minimum viable compliance.', 'cookie-notice' ), 'invalidFields' => __( 'Please fill all the required fields.', 'cookie-notice' ) ); // delete the show modal transient delete_transient( 'cn_show_welcome' ); wp_localize_script( 'cookie-notice-welcome', 'cnWelcomeArgs', $js_args ); wp_enqueue_style( 'cookie-notice-welcome', plugins_url( '../css/admin-welcome.css', __FILE__ ) ); } /** * Add one or more classes to the body tag in the dashboard. * * @param string $classes * @return string */ public function admin_body_class( $classes ) { if ( isset( $_GET['page'] ) && $_GET['page'] === 'cookie-notice-welcome' ) $classes .= ' folded'; return $classes; } /** * Send user to the welcome page on first activation. * * @return void */ public function welcome() { global $pagenow; if ( $pagenow != 'admin.php' ) return; if ( isset( $_GET['page'] ) && $_GET['page'] !== 'cookie-notice' ) return; // bail if activating from network, or bulk, or within an iFrame if ( is_network_admin() || isset( $_GET['activate-multi'] ) || defined( 'IFRAME_REQUEST' ) ) return; if ( (isset( $_GET['action'] ) && 'upgrade-plugin' == $_GET['action']) && (isset( $_GET['plugin'] ) && strstr( $_GET['plugin'], 'cookie-notice.php' )) ) return; add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); add_action( 'admin_footer', array( $this, 'admin_footer' ) ); add_filter( 'admin_body_class', array( $this, 'admin_body_class' ) ); } /** * Welcome modal container. */ public function admin_footer() { echo ''; } /** * Output the welcome screen. * * @return void */ public function welcome_page() { // get plugin version $plugin_version = substr( Cookie_Notice()->defaults['version'], 0, 3 ); $screen = ( isset( $_GET['screen'] ) ? (int) $_GET['screen'] : 1 ); $this->welcome_screen( $screen ); } /** * Render welcome screen sidebar step. * * @param int $step * @return mixed */ public function welcome_screen( $screen, $echo = true ) { global $current_user; if ( ! current_user_can( 'install_plugins' ) ) wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) ); $sidebars = array( 'about', 'login', 'register', 'configure', 'select_plan', 'success' ); $steps = array( 1, 2, 3, 4 ); $screens = array_merge( $sidebars, $steps ); $is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX; $screen = ! empty( $screen ) && in_array( $screen, $screens ) ? $screen : ( isset( $_REQUEST['screen'] ) && in_array( $_REQUEST['screen'], $screens ) ? $_REQUEST['screen'] : '' ); if ( empty( $screen ) ) wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) ); if ( $is_ajax && ! check_ajax_referer( 'cookie-notice-welcome', 'nonce' ) ) wp_die( _( 'You do not have permission to access this page.', 'cookie-notice' ) ); // get token data $token_data = get_transient( 'cookie_notice_app_token' ); // step screens if ( in_array( $screen, $steps ) ) { $html = '
'; if ( $screen == 1 ) { $html .= $this->welcome_screen( 'about', false ); $html .= '

Cookie Compliance™

' . __( 'The next generation of Cookie Notice', 'cookie-notice' ) . '

' . __( 'Cookie Compliance is a free web application that enables websites to take a proactive approach to data protection and consent laws.', 'cookie-notice' ) . '

Cookie Notice dashboard

' . __( 'It is the first solution to offer intentional consent, a new consent framework that incorporates the latest guidelines from over 100+ countries, and emerging standards from leading international organizations like the IEEE.', 'cookie-notice' ) . '

' . __( 'Cookie Notice includes seamless integration with Cookie Compliance to help your site comply with the latest updates to existing consent laws and provide a beautiful, multi-level experience to engage visitors in data privacy decisions.', 'cookie-notice' ) . '

'; $html .= '

'; $html .= '
'; } elseif ( $screen == 2 ) { $html .= $this->welcome_screen( 'configure', false ); $html .= '
'; } elseif ( $screen == 3 ) { // get options $app_config = get_transient( 'cookie_notice_app_config' ); $html .= $this->welcome_screen( 'register', false ); $html .= '

Cookie Compliance™

' . __( 'The next generation of Cookie Notice', 'cookie-notice' ) . '

' . __( 'Take a proactive approach to data protection and consent laws by signing up for Cookie Compliance account. Then select a limited Basic Plan for free or get one of the Professional Plans for unlimited visits, consent storage, languages and customizations.', 'cookie-notice' ) . '

'; /*
$html .= '
' . __( 'WP Plugin', 'cookie-notice' ) . '
Cookie Notice dashboard
  • ' . __( 'Free', 'cookie-notice' ) . '
  • ' . __( 'Customizable notice message', 'cookie-notice' ) . '
  • ' . __( 'Consent on click, scroll or close', 'cookie-notice' ) . '
  • ' . __( 'Link to Privacy Policy page', 'cookie-notice' ) . '
Cookie Notice + Compliance
' . __( 'Web App', 'cookie-notice' ) . '
Cookie Compliance dashboard
  • ' . __( 'Free plan', 'cookie-notice' ) . '
  • ' . __( 'Consent Analytics Dashboard', 'cookie-notice' ) . '
  • ' . __( 'Cookie Autoblocking', 'cookie-notice' ) . '
  • ' . __( 'Cookie Categories', 'cookie-notice' ) . '
  • ' . __( 'Proof-of-Consent Storage', 'cookie-notice' ) . '
  • ' . __( "Link to 'Do Not Sell' page", 'cookie-notice' ) . '
'; */ $html .= '

' . __( 'Compliance Plans', 'cookie-notice' ) . ':

'; $html .= '
'; } elseif ( $screen == 4 ) { $html .= $this->welcome_screen( 'success', false ); $html .= '

' . __( 'Congratulations', 'cookie-notice' ) . '

' . __( 'You are now promoting privacy with Hu-manity.co', 'cookie-notice' ) . '

' . __( 'Log in to your Cookie Compliance™ account and continue configuring your Privacy Experience.', 'cookie-notice' ) . '

'; } $html .= '
'; // sidebar screens } elseif ( in_array( $screen, $sidebars ) ) { $html = ''; if ( $screen === 'about' ) { $theme = wp_get_theme(); $html .= '

' . __( 'Compliance check', 'cookie-notice' ) . '

' . __( 'This is a Compliance Check to determine your site’s compliance with updated data processing and consent rules under GDPR, CCPA and other international data privacy laws.', 'cookie-notice' ) . '

' . __( 'Site URL', 'cookie-notice' ) . ': ' . home_url() . '

' . __( 'Site Name', 'cookie-notice' ) . ': ' . get_bloginfo( 'name' ) . '

' . __( 'Checking...', 'cookie-notice' ) . '

' . __( 'Cookie Notice', 'cookie-notice' ) . '

' . __( 'Notifies visitors that site uses cookies.', 'cookie-notice' ) . '

' /*
. '
*/ . '
'; } elseif ( $screen === 'configure' ) { $html .= '

' . __( 'Live Setup', 'cookie-notice' ) . '

' . __( 'Configure your Cookie Notice & Compliance design and compliance features through the options below. Click Apply Setup to save the configuration and go to selecting your preferred cookie solution.', 'cookie-notice' ) . '

' . /*
*/ '
* ' . __( 'available for Cookie Compliance™ Pro plans only', 'cookie-notice' ) . '
* ' . __( 'available for Cookie Compliance™ Pro plans only', 'cookie-notice' ) . '
'; $html .= wp_nonce_field( 'cn_api_configure', 'cn_nonce', true, false ); $html .= '
'; } elseif ( $screen === 'register' ) { $html .= '

' . __( 'Compliance account', 'cookie-notice' ) . '

' . __( 'Create a Cookie Compliance™ account and select your preferred plan.', 'cookie-notice' ) . '

'; // get site language $locale = get_locale(); $locale_code = explode( '_', $locale ); $html .= ' '; $html .= wp_nonce_field( 'cn_api_register', 'cn_nonce', true, false ); $html .= '

' . __( 'Already have an account?', 'cookie-notice' ) . ' ' . __( 'Sign in', 'cookie-notice' ). '

'; $html .= '
'; $html .= wp_nonce_field( 'cn_api_payment', 'cn_payment_nonce', true, false ); $html .= '
'; $html .= '
'; } elseif ( $screen === 'login' ) { $html .= '

' . __( 'Compliance Sign in', 'cookie-notice' ) . '

' . __( 'Sign in to your existing Cookie Compliance™ account and select your preferred plan.', 'cookie-notice' ) . '

'; // get site language $locale = get_locale(); $locale_code = explode( '_', $locale ); $html .= ' '; $html .= wp_nonce_field( 'cn_api_login', 'cn_nonce', true, false ); $html .= '

' . __( 'Don\'t have an account yet?', 'cookie-notice' ) . ' ' . __( 'Sign up', 'cookie-notice' ) . '

'; $html .= '
'; $html .= wp_nonce_field( 'cn_api_payment', 'cn_payment_nonce', true, false ); $html .= '
'; } elseif ( $screen === 'success' ) { $html .= '

' . __( 'Success!', 'cookie-notice' ) . '

' . __( 'You have successfully upgraded your website to Cookie Compliance™', 'cookie-notice' ) . '

' . sprintf( __( 'Go to Cookie Compliance™ application now. Or access it anytime from your Cookie Notice settings page.', 'cookie-notice' ), esc_url( admin_url( 'admin.php?page=cookie-notice' ) ) ) . '

'; } $html .= '
'; } if ( $echo ) echo $html; else return $html; if ( $is_ajax ) exit(); } }