id == 'settings_page_ctcc' ) { ?> get_default_options_settings(); update_option ( 'ctcc_options_settings', $defaults ); } } public function sanitize_content( $input ){ $output = array(); foreach( $input as $key=>$value ) { if( isset($input[$key] ) ) { if( $key == 'notification_text' ) { $output[$key] = esc_attr( $input[$key] ); } else if( $key == 'more_info_url' ) { $output[$key] = esc_url( $input[$key] ); } else { $output[$key] = sanitize_text_field( $input[$key] ); } } } return $output; } public function register_content_init() { register_setting ( 'ctcc_content', 'ctcc_content_settings', array( $this, 'sanitize_content') ); add_settings_section ( 'ctcc_content_section', __( 'Content settings', 'uk-cookie-consent' ), array ( $this, 'content_settings_section_callback' ), 'ctcc_content' ); add_settings_field ( 'heading_text', __( 'Heading Text', 'uk-cookie-consent' ), array ( $this, 'heading_text_render' ), 'ctcc_content', 'ctcc_content_section' ); add_settings_field ( 'notification_text', __( 'Notification Text', 'uk-cookie-consent' ), array ( $this, 'notification_text_render' ), 'ctcc_content', 'ctcc_content_section' ); add_settings_field ( 'more_info_text', __( 'More Info Text', 'uk-cookie-consent' ), array ( $this, 'more_info_text_render' ), 'ctcc_content', 'ctcc_content_section' ); add_settings_field ( 'more_info_page', __( 'More Info Page', 'uk-cookie-consent' ), array ( $this, 'more_info_page_render' ), 'ctcc_content', 'ctcc_content_section' ); add_settings_field ( 'more_info_url', __( 'More Info URL', 'uk-cookie-consent' ), array ( $this, 'more_info_url_render' ), 'ctcc_content', 'ctcc_content_section' ); add_settings_field ( 'more_info_target', __( 'More Info Target', 'uk-cookie-consent' ), array ( $this, 'more_info_target_render' ), 'ctcc_content', 'ctcc_content_section' ); add_settings_field ( 'accept_text', __( 'Accept Text', 'uk-cookie-consent' ), array ( $this, 'accept_text_render' ), 'ctcc_content', 'ctcc_content_section' ); // Set default options $options = get_option ( 'ctcc_content_settings' ); if ( false === $options ) { // Get defaults $defaults = $this -> get_default_content_settings(); update_option ( 'ctcc_content_settings', $defaults ); } } public function register_styles_init( ) { register_setting ( 'ctcc_styles', 'ctcc_styles_settings' ); add_settings_section ( 'ctcc_styles_section', __( 'Styles settings', 'uk-cookie-consent' ), array ( $this, 'styles_settings_section_callback' ), 'ctcc_styles' ); add_settings_field ( 'position', __( 'Position', 'uk-cookie-consent' ), array ( $this, 'position_render' ), 'ctcc_styles', 'ctcc_styles_section' ); add_settings_field ( 'container_class', __( 'Container Class', 'uk-cookie-consent' ), array ( $this, 'container_class_render' ), 'ctcc_styles', 'ctcc_styles_section' ); add_settings_field ( 'enqueue_styles', __( 'Include Stylesheet', 'uk-cookie-consent' ), array ( $this, 'enqueue_styles_render' ), 'ctcc_styles', 'ctcc_styles_section' ); add_settings_field ( 'rounded_corners', __( 'Rounded Corners', 'uk-cookie-consent' ), array ( $this, 'rounded_corners_render' ), 'ctcc_styles', 'ctcc_styles_section' ); add_settings_field ( 'drop_shadow', __( 'Drop Shadow', 'uk-cookie-consent' ), array ( $this, 'drop_shadow_render' ), 'ctcc_styles', 'ctcc_styles_section' ); add_settings_field ( 'display_accept_with_text', __( 'Display Button With Text', 'uk-cookie-consent' ), array ( $this, 'display_accept_with_text_render' ), 'ctcc_styles', 'ctcc_styles_section' ); add_settings_field ( 'x_close', __( 'Use X Close', 'uk-cookie-consent' ), array ( $this, 'x_close_render' ), 'ctcc_styles', 'ctcc_styles_section' ); add_settings_field ( 'text_color', __( 'Text Color', 'uk-cookie-consent' ), array ( $this, 'text_color_render' ), 'ctcc_styles', 'ctcc_styles_section' ); add_settings_field ( 'bg_color', __( 'Background Color', 'uk-cookie-consent' ), array ( $this, 'bg_color_render' ), 'ctcc_styles', 'ctcc_styles_section' ); add_settings_field ( 'link_color', __( 'Link Color', 'uk-cookie-consent' ), array ( $this, 'link_color_render' ), 'ctcc_styles', 'ctcc_styles_section' ); add_settings_field ( 'button_color', __( 'Button Color', 'uk-cookie-consent' ), array ( $this, 'button_color_render' ), 'ctcc_styles', 'ctcc_styles_section' ); add_settings_field ( 'button_bg_color', __( 'Button Background', 'uk-cookie-consent' ), array ( $this, 'button_bg_color_render' ), 'ctcc_styles', 'ctcc_styles_section' ); add_settings_field ( 'bg_color', __( 'Background Color', 'uk-cookie-consent' ), array ( $this, 'bg_color_render' ), 'ctcc_styles', 'ctcc_styles_section' ); add_settings_field ( 'flat_button', __( 'Flat Button', 'uk-cookie-consent' ), array ( $this, 'flat_button_render' ), 'ctcc_styles', 'ctcc_styles_section' ); // Set default options $options = get_option ( 'ctcc_styles_settings' ); if ( false === $options ) { // Get defaults $defaults = $this -> get_default_styles_settings(); update_option ( 'ctcc_styles_settings', $defaults ); } } public function get_default_options_settings() { $defaults = array ( 'closure' => 'click', 'scroll_height' => 200, 'first_page' => 0, 'enable_metafield' => 0, 'zones_only' => '', 'duration' => 60, 'cookie_expiry' => 30, 'cookie_version' => 1 ); return $defaults; } public function get_default_content_settings() { $previous_settings = get_option ( 'catapult_cookie_options' ); // Check for settings from previous version if ( ! empty ( $previous_settings ) ) { $defaults = array ( 'heading_text' => __( 'Cookies', 'uk-cookie-consent' ), 'notification_text' => $previous_settings['catapult_cookie_text_settings'], 'accept_text' => $previous_settings['catapult_cookie_accept_settings'], 'more_info_text' => $previous_settings['catapult_cookie_more_settings'], 'more_info_page' => '', 'more_info_url' => site_url ( $previous_settings['catapult_cookie_link_settings'] ), 'more_info_target' => '_blank', ); } else { $defaults = array ( 'heading_text' => __( 'Cookies', 'uk-cookie-consent' ), 'notification_text' => __( 'This site uses cookies: ', 'uk-cookie-consent' ), 'accept_text' => __( 'Okay, thanks', 'uk-cookie-consent' ), 'more_info_text' => __( 'Find out more.', 'uk-cookie-consent' ), 'more_info_page' => get_option( 'ctcc_more_info_page', '' ), 'more_info_url' => '', 'more_info_target' => '_blank', ); } return $defaults; } public function get_default_styles_settings() { $previous_settings = get_option ( 'catapult_cookie_options' ); $defaults = array ( 'position' => 'top-bar', 'container_class' => '', 'enqueue_styles' => 1, 'rounded_corners' => 1, 'drop_shadow' => 1, 'display_accept_with_text' => 1, 'x_close' => 0, 'text_color' => '#ddd', 'bg_color' => '#464646', 'link_color' => '#fff', 'button_color' => '', 'button_bg_color' => '', 'flat_button' => 1, ); // Check for settings from previous version if ( ! empty ( $previous_settings['catapult_cookie_bar_position_settings'] ) ) { $defaults['position'] = $previous_settings['catapult_cookie_bar_position_settings'] . '-bar'; } if ( ! empty ( $previous_settings['catapult_cookie_text_colour_settings'] ) ) { $defaults['text_color'] = $previous_settings['catapult_cookie_text_colour_settings']; } if ( ! empty ( $previous_settings['catapult_cookie_bg_colour_settings'] ) ) { $defaults['bg_color'] = $previous_settings['catapult_cookie_bg_colour_settings']; } if ( ! empty ( $previous_settings['catapult_cookie_link_colour_settings'] ) ) { $defaults['link_color'] = $previous_settings['catapult_cookie_link_colour_settings']; } if ( ! empty ( $previous_settings['catapult_cookie_link_colour_settings'] ) ) { $defaults['link_color'] = $previous_settings['catapult_cookie_link_colour_settings']; } if ( ! empty ( $previous_settings['catapult_cookie_button_colour_settings'] ) ) { $defaults['button_bg_color'] = $previous_settings['catapult_cookie_button_colour_settings']; } return $defaults; } public function closure_render() { $options = get_option( 'ctcc_options_settings' ); ?>

value='1'>

GeoIP Detect plugin activated, you can specify which areas of the world to exclude from displaying the notification.', 'uk-cookie-consent' ); ?>

value='1'>

value='1'>

value='1'>

value='1'>

value='1'>

value='1'>

value='1'>

value='1'>

' . __( 'Basic settings', 'uk-cookie-consent' ) . '

'; echo '

' . __( 'Create your own privacy policy here') . '

'; } public function content_settings_section_callback() { echo '

' .__( 'Update the content displayed to the user', 'uk-cookie-consent' ) . '

'; echo '

' . __( 'Create your own privacy policy here') . '

'; } public function styles_settings_section_callback() { echo '

' .__( 'Change the styles here if you like - but it\'s better in the Customizer', 'uk-cookie-consent' ) . '

'; echo '

' . __( 'Create your own privacy policy here') . '

'; } public function pages_settings_section_callback() { echo '

' . __( 'Use this section to set exclusion rules for pages and posts.', 'uk-cookie-consent' ) . '

'; echo '

' . __( 'Create your own privacy policy here') . '

'; } public function options_page() { $reset = isset ( $_GET['reset'] ) ? $_GET['reset'] : ''; if ( isset ( $_POST['reset'] ) ) { $defaults = $this -> get_default_styles_settings(); update_option ( 'ctcc_styles_settings', $defaults ); $defaults = $this -> get_default_content_settings(); update_option ( 'ctcc_content_settings', $defaults ); } $current = isset ( $_GET['tab'] ) ? $_GET['tab'] : 'options'; $title = __( 'Cookie Consent', 'uk-cookie-consent' ); $tabs = array ( 'options' => __( 'General', 'uk-cookie-consent' ), 'content' => __( 'Content', 'uk-cookie-consent' ), 'styles' => __( 'Styles', 'uk-cookie-consent' ) );?>