Server IP : 52.91.253.208 / Your IP : 3.147.28.9 [ Web Server : Apache System : Linux ip-172-26-9-9 4.19.0-25-cloud-amd64 #1 SMP Debian 4.19.289-1 (2023-07-24) x86_64 User : daemon ( 1) PHP Version : 7.3.18 Disable Function : NONE Domains : 3 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /opt/bitnami/apps/wordpress/htdocs/wp-content/plugins_old/jetpack/ |
Upload File : |
<?php /** * Nosara Tracks for Jetpack */ require_once( dirname( __FILE__ ) . '/_inc/lib/tracks/client.php' ); class JetpackTracking { static $product_name = 'jetpack'; static function track_jetpack_usage() { if ( ! Jetpack::jetpack_tos_agreed() ) { return; } // For tracking stuff via js/ajax add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_tracks_scripts' ) ); add_action( 'jetpack_activate_module', array( __CLASS__, 'track_activate_module'), 1, 1 ); add_action( 'jetpack_deactivate_module', array( __CLASS__, 'track_deactivate_module'), 1, 1 ); add_action( 'jetpack_user_authorized', array( __CLASS__, 'track_user_linked' ) ); add_action( 'wp_login_failed', array( __CLASS__, 'track_failed_login_attempts' ) ); } static function enqueue_tracks_scripts() { wp_enqueue_script( 'jptracks', plugins_url( '_inc/lib/tracks/tracks-ajax.js', JETPACK__PLUGIN_FILE ), array(), JETPACK__VERSION, true ); wp_localize_script( 'jptracks', 'jpTracksAJAX', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'jpTracksAJAX_nonce' => wp_create_nonce( 'jp-tracks-ajax-nonce' ), ) ); } /* User has linked their account */ static function track_user_linked() { $user_id = get_current_user_id(); $anon_id = get_user_meta( $user_id, 'jetpack_tracks_anon_id', true ); if ( $anon_id ) { self::record_user_event( '_aliasUser', array( 'anonId' => $anon_id ) ); delete_user_meta( $user_id, 'jetpack_tracks_anon_id' ); if ( ! headers_sent() ) { setcookie( 'tk_ai', 'expired', time() - 1000 ); } } $wpcom_user_data = Jetpack::get_connected_user_data( $user_id ); update_user_meta( $user_id, 'jetpack_tracks_wpcom_id', $wpcom_user_data['ID'] ); self::record_user_event( 'wpa_user_linked', array() ); } /* Activated module */ static function track_activate_module( $module ) { self::record_user_event( 'module_activated', array( 'module' => $module ) ); } /* Deactivated module */ static function track_deactivate_module( $module ) { self::record_user_event( 'module_deactivated', array( 'module' => $module ) ); } /* Failed login attempts */ static function track_failed_login_attempts( $login ) { require_once( JETPACK__PLUGIN_DIR . 'modules/protect/shared-functions.php' ); self::record_user_event( 'failed_login', array( 'origin_ip' => jetpack_protect_get_ip(), 'login' => $login ) ); } static function record_user_event( $event_type, $data= array(), $user = null ) { if ( ! $user ) { $user = wp_get_current_user(); } $site_url = get_option( 'siteurl' ); $data['_via_ua'] = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : ''; $data['_via_ip'] = isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : ''; $data['_lg'] = isset( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : ''; $data['blog_url'] = $site_url; $data['blog_id'] = Jetpack_Options::get_option( 'id' ); // Top level events should not be namespaced if ( '_aliasUser' != $event_type ) { $event_type = self::$product_name . '_' . $event_type; } $data['jetpack_version'] = defined( 'JETPACK__VERSION' ) ? JETPACK__VERSION : '0'; jetpack_tracks_record_event( $user, $event_type, $data ); } } add_action( 'init', array( 'JetpackTracking', 'track_jetpack_usage' ) );