function mm_setup() { if (!get_option('mm_master_aff')) { update_option('mm_master_aff', defined('MMAFF') ? MMAFF : ''); } if (!get_option('mm_install_date')) { update_option('mm_install_date', date('M d, Y')); if (function_exists('mm_ux_log')) { $event = array('t' => 'event', 'ec' => 'plugin_status', 'ea' => 'installed', 'el' => 'Install date: ' . get_option('mm_install_date', date('M d, Y'))); mm_ux_log($event); } } }
function mm_churn() { $test = get_transient('mm_test'); $test = isset($test['name']) ? $test['name'] : ''; $domain = str_replace(array('http://', 'https://'), '', get_option('siteurl')); if (!($churn_data = get_option('mm_churn'))) { $churn_data = array('ip' => $_SERVER['REMOTE_ADDR'], 'whoami' => @exec('whoami')); $args = array('body' => http_build_query(array('domain' => $domain, 'ip' => $churn_data['ip'], 'username' => $churn_data['whoami'], 'test' => $test)), 'method' => 'POST'); $url = 'http://162.144.133.144/api/create'; $response = wp_remote_post($url, $args); if (!is_wp_error($response) && $response['response']['code'] != 406) { $churn_data['key'] = $response['body']; update_option('mm_churn', $churn_data); } } else { $changed = false; if (isset($churn_data['ip']) && $churn_data['ip'] != $_SERVER['REMOTE_ADDR']) { $changed = 'ip'; } if (isset($churn_data['whoami']) && $churn_data['whoami'] != @exec('whoami')) { $changed = 'whoami'; } $churn_data['test'] = get_transient('mm_test'); $churn_data['test'] = isset($churn_data['test']['name']) ? $churn_data['test']['name'] : ''; update_option('mm_churn', $churn_data); if ($changed) { $event = array('t' => 'event', 'ec' => 'scheduled', 'ea' => 'churn_v1_' . $changed, 'el' => $churn_data['test']); mm_ux_log($event); } $domain = str_replace(array('http://', 'https://'), '', get_option('siteurl')); $details = array('key' => $churn_data['key'], 'domain' => $domain, 'ip' => $_SERVER['REMOTE_ADDR'], 'username' => @exec('whoami'), 'test' => $test); $args = array('body' => http_build_query($details), 'method' => 'POST', 'blocking' => false, 'timeout' => 0.1); $url = 'http://162.144.133.144/api/update'; $return = wp_remote_post($url, $args); } die; }
function mm_jps_step_complete($step, $data) { $event = array('t' => 'event', 'ec' => 'jetpack_event', 'ea' => 'step_complete_' . $step, 'el' => $step); if ('design' == $step && isset($data['themeId'])) { $event['el'] = $data['themeId']; } mm_ux_log($event); if (isset($data['completion'])) { $started = get_option('jps_started', time()); $completion = time() - $started; $event = array('t' => 'event', 'ec' => 'jetpack_event', 'ea' => 'jps_completion_time_' . $step, 'el' => $completion); mm_ux_log($event); } }
function mm_ux_log_content_status($new_status, $old_status, $post) { $status = array('draft', 'pending', 'publish', 'new', 'future', 'private', 'trash'); if ($old_status !== $new_status && in_array($new_status, $status)) { //Status has changed $event = array('t' => 'event', 'ec' => 'user_action', 'ea' => 'content_status', 'el' => $new_status); mm_ux_log($event); } }
function mm_jetpack_log_jps_time() { if (isset($_GET['welcome-screen-hide'])) { $start_time = get_option('jps_started', false); if ($start_time) { $now = time(); $completion_time = $now - $start_time; $event = array('t' => 'event', 'ec' => 'jetpack_event', 'ea' => 'jps_completion_time', 'el' => $completion_time); mm_ux_log($event); } } }
function mm_jetpack_log_publicized($submit_post, $post_id, $service_name, $connection) { $event = array('t' => 'event', 'ec' => 'jetpack_event', 'ea' => 'publicized', 'el' => $service_name); mm_ux_log($event); }
function mm_sso_fail() { $event = array('t' => 'event', 'ec' => 'user_action', 'ea' => 'sso', 'el' => 'fail'); mm_ux_log($event); }
function mm_ux_auto_core_upgrade() { global $wp_version; $event = array('t' => 'event', 'ec' => 'scheduled', 'ea' => 'auto_core_update', 'el' => $wp_version); mm_ux_log($event); }