fevicon_url = get_site_icon_url(75); } public static function get_instance() { if ( ! self::$instance ) { self::$instance = new self(); } return self::$instance; } /* Authentication Settings */ public $awca_auth_settings = array( 'trackind_id' => '', 'property_id' => '', 'api_secret' => '', 'manual_tracking' => false, 'agreement'=> true, ); /* Tracking Settings */ public $awca_tracking_settings = array( 'track_admin' => true, 'not_track_pageviews' => false, 'anonymize_ip'=> true, 'gdpr_enable' => false, 'gdpr_title' => 'Help us to serve you better!', 'gdpr_subtitle' => 'We use your shopping experience data to improve our services.', 'gdpr_image_url' => '', 'gdpr_opt_in_name' => 'Yes', 'gdpr_opt_out_name' => 'No', ); /* parsing tracking settings before saving them */ public function parse_awca_track_settings($settings) { $args = array( 'track_admin' => array( 'filter' => FILTER_VALIDATE_BOOLEAN, 'flags' => FILTER_REQUIRE_SCALAR, ), 'not_track_pageviews' => array( 'filter' => FILTER_VALIDATE_BOOLEAN, 'flags' => FILTER_REQUIRE_SCALAR, ), 'anonymize_ip' => array( 'filter' => FILTER_VALIDATE_BOOLEAN, 'flags' => FILTER_REQUIRE_SCALAR, ), 'gdpr_enable' => array( 'filter' => FILTER_VALIDATE_BOOLEAN, 'flags' => FILTER_REQUIRE_SCALAR, ), 'gdpr_pos_right' => array( 'filter' => FILTER_VALIDATE_BOOLEAN, 'flags' => FILTER_REQUIRE_SCALAR, ), 'gdpr_title' => array( 'filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_REQUIRE_SCALAR, ), 'gdpr_subtitle' => array( 'filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_REQUIRE_SCALAR, ), 'gdpr_image_url' => array( 'filter' => FILTER_SANITIZE_URL, 'flags' => FILTER_FLAG_HOST_REQUIRED, ), 'gdpr_opt_in_name' => array( 'filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_REQUIRE_SCALAR, ), 'gdpr_opt_out_name' => array( 'filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_REQUIRE_SCALAR, ), ); $settings = filter_var_array( $settings, $args ); return $settings; } /* Event Tracking Settings */ public $awca_event_settings = array( 'user_login' => true, 'user_logout' => true, 'viewed_signup_form' => true, 'user_signup' => true, 'viewed_shop' => true, 'viewed_product' => true, 'begin_checkout' => true, 'filled_checkout_form' => true, 'added_payment_method' => true, 'added_shipping_method' => true, 'order_failed' => true, 'processing_payment' => true, 'completed_purchase' => true, 'wrote_review' => true, 'commented' => true, 'viewed_account' => true, ); /* Hooks Associated with events */ public $awca_event_hooks = array( 'user_login' => array(2,'wp_login'), 'user_logout' => 'wp_logout', 'viewed_signup_form' => 'woocommerce_register_form', 'user_signup' => 'user_register', 'viewed_shop' => 'wp_head', 'viewed_product' => 'woocommerce_after_single_product_summary', 'begin_checkout' => 'woocommerce_after_checkout_form', 'filled_checkout_form' => 'woocommerce_after_checkout_form', 'added_shipping_method' => 'woocommerce_after_checkout_form', 'added_payment_method' => 'woocommerce_after_checkout_form', 'order_failed' => array(2,'woocommerce_order_status_failed'), 'processing_payment' => 'woocommerce_checkout_order_processed', 'completed_purchase' => array('woocommerce_order_status_on-hold','woocommerce_payment_complete','woocommerce_order_status_processing','woocommerce_order_status_completed','woocommerce_thankyou'), 'wrote_review' => 'comment_post', 'commented' => 'comment_post', 'viewed_account' => 'woocommerce_after_my_account', ); /* parsing Authentication settings before saving them */ public function parse_awca_auth_settings($settings) { $args = array( 'tracking_id' => array( 'filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_REQUIRE_SCALAR, ), 'property_id' => array( 'filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_REQUIRE_SCALAR, ), 'api_secret' => array( 'filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_REQUIRE_SCALAR, ), 'manual_tracking' => array( 'filter' => FILTER_VALIDATE_BOOLEAN, 'flags' => FILTER_REQUIRE_SCALAR, ), 'agreement' => array( 'filter' => FILTER_VALIDATE_BOOLEAN, 'flags' => FILTER_REQUIRE_SCALAR, ), ); $settings = filter_var_array( $settings, $args ); return $settings; } /* parsing event settings before saving them */ public function parse_awca_bool_settings($settings) { $settings = filter_var_array( $settings,FILTER_VALIDATE_BOOLEAN ); return $settings; } /* Defining Defaults for Authentication Settings */ public function init_awca_auth_defaults() { $defaults = array( 'trackind_id' => '', 'property_id' => '', 'api_secret' =>'', 'manual_tracking' => false, 'agreement'=> true, ); return $defaults; } /* Defining Defaults for Tracking Settings */ public function init_awca_track_defaults() { $defaults = array( 'track_admin' => true, 'not_track_pageviews' => false, 'anonymize_ip'=> true, 'gdpr_enable' => false, 'gdpr_title' => 'Help us to serve you better!', 'gdpr_subtitle' => 'We use your shopping experience data to improve our services.', 'gdpr_image_url' => $this->fevicon_url, 'gdpr_opt_in_name' => 'Yes', 'gdpr_opt_out_name' => 'No', ); return $defaults; } /* Defining Defaults for Events Settings */ public function init_awca_events_defaults() { $defaults = array( 'user_login' => true, 'user_logout' => true, 'viewed_signup_form' => true, 'user_signup' => true, 'viewed_shop' => true, 'viewed_product' => true, 'begin_checkout' => true, 'filled_checkout_form' => true, 'added_payment_method' => true, 'added_shipping_method' => true, 'order_failed' => true, 'processing_payment' => true, 'completed_purchase' => true, 'wrote_review' => true, 'commented' => true, 'viewed_account' => true, ); return $defaults; } }