示例#1
0
/**
 * Appends a version parameter to a link. 
 * 
 * This is useful to avoid browser-side CSS and JS caching.
 * @param string $href The URL
 * @return string A new URL appended the nocache string
 */
function appendVersion($href)
{
    if (!isset($GLOBALS['APP_VERSION'])) {
        setAppVersion(0, 0, 0, "default");
    }
    if (!$href || $href[0] == '/') {
        return "/{$GLOBALS['APP_VERSION']['nc']}{$href}";
    }
    return "{$GLOBALS['APP_VERSION']['nc']}/{$href}";
}
/**
 * Gets the application version.
 * 
 * If key is given, returns that part only.
 * @param string $key 'major','minor','build' or 'codename'
 * @return mixed Version array or the requested part of it
 */
function getAppVersion($key = false)
{
    if (!isset($GLOBALS['APP_VERSION'])) {
        setAppVersion(0, 0, 0, "default");
    }
    if ($key && isset($GLOBALS['APP_VERSION'][$key])) {
        return $GLOBALS['APP_VERSION'][$key];
    }
    return $GLOBALS['APP_VERSION'];
}
示例#3
0
<?php

require_once __DIR__ . "/../system/system.php";
switchToDev();
setAppVersion(0, 0, 1);
system_init('documentor');
if (isset($_GET['clear'])) {
    cache_clear();
    $_SESSION = array();
}
system_execute();