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 = '