/** * Registers this instance of wordpress with FireStats. * This is requires so that if there is more than one blog/system that works with * the same FireStats instance it will be possible to filter the stats per site. */ function fs_register_wordpress() { $FS_PATH = fs_get_firestats_path(); if (!$FS_PATH) { return; } require_once $FS_PATH . '/php/db-sql.php'; $firestats_site_id = get_option('firestats_site_id'); if ($firestats_site_id == null && !fs_site_exists($firestats_site_id)) { $site_id = null; if (fs_is_wpmu()) { // for wpmu sites, use the blog id as the firestats site id. global $blog_id; $site_id = $blog_id; } $firestats_site_id = fs_register_site($site_id); if (firestats_site_id === false) { echo "FireStats: error registering blog with id = {$site_id}"; return; } update_option('firestats_site_id', $firestats_site_id); } $name = get_option('blogname'); $type = FS_SITE_TYPE_WORDPRESS; $res = fs_update_site_params($firestats_site_id, $firestats_site_id, $name, $type); if ($res !== true) { echo $res; } // update the filter to show us this blog by default after the installation update_option('firestats_sites_filter', $firestats_site_id); }
function fs_ajax_update_sites_info(&$response) { if (!fs_ajax_assert_admin($response)) { return; } $new_sid = $_POST['new_sid']; $orig_sid = $_POST['orig_sid']; $name = $_POST['name']; $type = $_POST['type']; $baseline_views = $_POST['baseline_views']; $baseline_visitors = $_POST['baseline_visitors']; $res = fs_update_site_params($new_sid, $orig_sid, $name, $type, $baseline_views, $baseline_visitors); if ($res === true) { fs_ajax_send_update($response); } else { ajax_error($response, $res); } }