Server IP : 103.119.228.120 / Your IP : 18.224.59.107 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/softaculous/sitepad/editor/site-data/plugins/kkart-pro/includes/tracks/ |
Upload File : |
<?php /** * PHP Tracks Client * * @package Kkart\Tracks */ /** * KKART_Tracks class. */ class KKART_Tracks { /** * Tracks event name prefix. */ const PREFIX = 'wcadmin_'; /** * Get total product counts. * * @return int Number of products. */ public static function get_products_count() { $product_counts = KKART_Tracker::get_product_counts(); return $product_counts['total']; } /** * Gather blog related properties. * * @param int $user_id User id. * @return array Blog details. */ public static function get_blog_details( $user_id ) { $blog_details = get_transient( 'kkart_tracks_blog_details' ); if ( false === $blog_details ) { $blog_details = array( 'url' => home_url(), 'blog_lang' => get_user_locale( $user_id ), 'blog_id' => class_exists( 'Jetpack_Options' ) ? Jetpack_Options::get_option( 'id' ) : null, 'products_count' => self::get_products_count(), ); set_transient( 'kkart_tracks_blog_details', $blog_details, DAY_IN_SECONDS ); } return $blog_details; } /** * Gather details from the request to the server. * * @return array Server details. */ public static function get_server_details() { $data = array(); $data['_via_ua'] = isset( $_SERVER['HTTP_USER_AGENT'] ) ? kkart_clean( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) : ''; $data['_via_ip'] = isset( $_SERVER['REMOTE_ADDR'] ) ? kkart_clean( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) : ''; $data['_lg'] = isset( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) ? kkart_clean( wp_unslash( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) ) : ''; $data['_dr'] = isset( $_SERVER['HTTP_REFERER'] ) ? kkart_clean( wp_unslash( $_SERVER['HTTP_REFERER'] ) ) : ''; $uri = isset( $_SERVER['REQUEST_URI'] ) ? kkart_clean( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : ''; $host = isset( $_SERVER['HTTP_HOST'] ) ? kkart_clean( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : ''; $data['_dl'] = isset( $_SERVER['REQUEST_SCHEME'] ) ? kkart_clean( wp_unslash( $_SERVER['REQUEST_SCHEME'] ) ) . '://' . $host . $uri : ''; return $data; } /** * Record an event in Tracks - this is the preferred way to record events from PHP. * * @param string $event_name The name of the event. * @param array $properties Custom properties to send with the event. * @return bool|WP_Error True for success or WP_Error if the event pixel could not be fired. */ public static function record_event( $event_name, $properties = array() ) { /** * Don't track users who don't have tracking enabled. */ if ( ! KKART_Site_Tracking::is_tracking_enabled() ) { return false; } $user = wp_get_current_user(); // We don't want to track user events during unit tests/CI runs. if ( $user instanceof WP_User && 'wptests_capabilities' === $user->cap_key ) { return false; } $prefixed_event_name = self::PREFIX . $event_name; $data = array( '_en' => $prefixed_event_name, '_ts' => KKART_Tracks_Client::build_timestamp(), ); $server_details = self::get_server_details(); $identity = KKART_Tracks_Client::get_identity( $user->ID ); $blog_details = self::get_blog_details( $user->ID ); // Allow event props to be filtered to enable adding site-wide props. $filtered_properties = apply_filters( 'kkart_tracks_event_properties', $properties, $prefixed_event_name ); // Delete _ui and _ut protected properties. unset( $filtered_properties['_ui'] ); unset( $filtered_properties['_ut'] ); $event_obj = new KKART_Tracks_Event( array_merge( $data, $server_details, $identity, $blog_details, $filtered_properties ) ); if ( is_wp_error( $event_obj->error ) ) { return $event_obj->error; } return $event_obj->record(); } }