Example #1
0
$last_check = $cms->getSetting("bigtree-internal-cron-last-run");
if ($last_check === false) {
    $admin->createSetting(array("id" => "bigtree-internal-cron-last-run", "system" => "on"));
}
// It's been more than 24 hours since we last ran cron.
if (time() - $last_check > 24 * 60 * 60) {
    // Update the setting.
    $admin->updateSettingValue("bigtree-internal-cron-last-run", time());
    // Email the daily digest
    $admin->emailDailyDigest();
    // Cache google analytics
    $ga = new BigTreeGoogleAnalyticsAPI();
    if ($ga->API && $ga->Profile) {
        // The Google Analytics wrappers can cause Exceptions and we don't want the page failing to load due to them.
        try {
            $ga->cacheInformation();
        } catch (Exception $e) {
            // We should log this in 4.1
        }
    }
}
// Normal page routing.
$ispage = false;
$inc = false;
$primary_route = $bigtree["path"][1];
$module_path = array_slice($bigtree["path"], 1);
// Check custom
list($inc, $commands) = BigTree::route(SERVER_ROOT . "custom/admin/modules/", $module_path);
// Check core if we didn't find the page or if we found the page but it had commands (because we may be overriding a page earlier in the chain but using the core further down)
if (!$inc || count($commands)) {
    list($core_inc, $core_commands) = BigTree::route(SERVER_ROOT . "core/admin/modules/", $module_path);
Example #2
0
<?php

header("Content-type: text/json");
$analytics = new BigTreeGoogleAnalyticsAPI();
try {
    $analytics->cacheInformation();
    echo "true";
} catch (Exception $e) {
    echo "false";
}