function createDigest(&$analytics) { try { // Step 2. Get the user's first view (profile) ID. $profileId = GOOGLE_ANALYTICS_PROFILE_ID; if (isset($profileId)) { $totalActiveUsers = totalActiveUsers($analytics, $profileId); $pagePaths = pagePath($analytics, $profileId); $pagePaths = array_reverse($pagePaths); $topPosts = ''; $count = 0; for ($count = 0; $count <= 6; $count++) { if (strcmp($pagePaths[$count][0], '/') !== 0) { $topPosts .= "\n<https://www.google.com/analytics/web/?hl=en#realtime/rt-content/" . GOOGLE_ANALYTICS_WEB_ID . "/%3Ffilter.list%3D10%3D%3D" . urlencode($pagePaths[$count][0]) . "|" . $pagePaths[$count][1] . ">\t<" . YOUR_DOMAIN . $pagePaths[$count][0] . "|" . str_replace(".html", "", preg_replace('/\\/\\d+\\/\\d+\\/\\d+\\//', '', $pagePaths[$count][0])) . ">"; } } $message = "Current users on the site: <https://www.google.com/analytics/web/?hl=en#realtime/rt-overview/" . GOOGLE_ANALYTICS_WEB_ID . "/|{$totalActiveUsers}>\n\nTop posts:\n" . $topPosts; // echo $message; // Step 4. Output the results. // slackMessage($message, "#general"); slackMessage($message, "#analytics"); } } catch (apiServiceException $e) { // Error from the API. print 'There was an API error : ' . $e->getCode() . ' : ' . $e->getMessage(); } catch (Exception $e) { print 'There was a general error : ' . $e->getMessage(); } }
function getContent($htmlize = true) { $route = $GLOBALS['ROUTES']; if (isset($route)) { if ($this->hasContentFile()) { require_once pagePath($route[$this->path]["file"]); if (function_exists('display_page_content')) { display_page_content(); } } } }
function display_404() { require_once pagePath("404"); }