Beispiel #1
0
function routes_cache($URL_URLRULE = '')
{
    $urlstr .= '\':l' . C('URL_PATHINFO_DEPR') . 'Tags' . C('URL_PATHINFO_DEPR') . ':module' . C('URL_PATHINFO_DEPR') . ':tag' . C('URL_PATHINFO_DEPR') . ':p\' => \'Home/Tags/index\',' . "\n";
    $urlstr .= '\':l' . C('URL_PATHINFO_DEPR') . 'Tags' . C('URL_PATHINFO_DEPR') . ':tag' . C('URL_PATHINFO_DEPR') . ':p\' => \'Home/Tags/index\',' . "\n";
    $urlstr .= '\':l' . C('URL_PATHINFO_DEPR') . 'Tags' . C('URL_PATHINFO_DEPR') . ':module' . C('URL_PATHINFO_DEPR') . ':tag\' => \'Home/Tags/index\',' . "\n";
    $urlstr .= '\':l' . C('URL_PATHINFO_DEPR') . 'Tags' . C('URL_PATHINFO_DEPR') . ':p\\d\' => \'Home/Tags/index\',' . "\n";
    $urlstr .= '\':l' . C('URL_PATHINFO_DEPR') . 'Tags' . C('URL_PATHINFO_DEPR') . ':tag\' => \'Home/Tags/index\',' . "\n";
    $urlstr .= '\':l' . C('URL_PATHINFO_DEPR') . 'Tags\' => \'Home/Tags/index\',' . "\n";
    $urlstr .= '\'Tags' . C('URL_PATHINFO_DEPR') . ':module' . C('URL_PATHINFO_DEPR') . ':tag' . C('URL_PATHINFO_DEPR') . ':p\' => \'Home/Tags/index\',' . "\n";
    $urlstr .= '\'Tags' . C('URL_PATHINFO_DEPR') . ':tag' . C('URL_PATHINFO_DEPR') . ':p\' => \'Home/Tags/index\',' . "\n";
    $urlstr .= '\'Tags' . C('URL_PATHINFO_DEPR') . ':module' . C('URL_PATHINFO_DEPR') . ':tag\' => \'Home/Tags/index\',' . "\n";
    $urlstr .= '\'Tags' . C('URL_PATHINFO_DEPR') . ':p\\d\' => \'Home/Tags/index\',' . "\n";
    $urlstr .= '\'Tags' . C('URL_PATHINFO_DEPR') . ':tag\' => \'Home/Tags/index\',' . "\n";
    $urlstr .= '\'Tags\' => \'Home/Tags/index\',' . "\n";
    if (APP_LANG) {
        $Lang = F('Lang');
        foreach ((array) $Lang as $key => $r) {
            $langarr[] = $key;
        }
        $urlstr .= '\'/^(' . implode('|', $langarr) . ')$/\' => \'Index/index?l=:1\',' . "\n";
    }
    $URL_URLRULE = $URL_URLRULE ? $URL_URLRULE : C('URL_URLRULE');
    $urlrule = is_array($URL_URLRULE) ? $URL_URLRULE : explode(':::', $URL_URLRULE);
    $list = explode('|', $urlrule[1]);
    $show = explode('|', $urlrule[0]);
    $listurls[] = make_urlrule($show[1], $langarr, 'show');
    $listurls[] = make_urlrule($show[0], $langarr, 'show');
    $listurls[] = make_urlrule($list[1], $langarr, 'index');
    $listurls[] = make_urlrule($list[0], $langarr, 'index');
    $url = implode(",\n", $listurls);
    file_put_contents(DATA_PATH . 'Routes.php', "<?php\nreturn array(\n" . $urlstr . $url . "\n);\n?>");
    if (is_file(RUNTIME_PATH . '~runtime.php')) {
        @unlink(RUNTIME_PATH . '~runtime.php');
    }
    if (is_file(RUNTIME_PATH . '~allinone.php')) {
        @unlink(RUNTIME_PATH . '~allinone.php');
    }
}
Beispiel #2
0
function routes_cache($URL_URLRULE = '')
{
    $Lang = F('Lang');
    foreach ((array) $Lang as $key => $r) {
        $langarr[] = $key;
    }
    $langstr = implode('|', $langarr);
    $langurlstr = ' \'(' . $langstr . ')\'  =>array( \'{$l}\', \'{([\\w\\$]+)}\',\'index\'),' . "\n";
    $tagurl = ' \'(' . $langstr . ')?\\/?(Tags)\' =>array( \'{$l}/{$m}\', \'{([\\w\\$]+)}\\/{([\\w\\$]+)}\',\'index\'),' . "\n";
    $tagurl .= ' \'(' . $langstr . ')?\\/?(Tags)\\/([A-Z]{1}[a-z]+)?-?(\\w+)?-?(\\d+)?\' =>array( \'{$l}/{$m}/{$module}-{$tag}-{$p}\', \'{([\\w\\$]+)}\\/{([\\w\\$]+)}\\/{([\\w\\$]+)}-{([\\w\\$]+)}-{([\\w\\$]+)}\',\'index\'),' . "\n";
    $URL_URLRULE = $URL_URLRULE ? $URL_URLRULE : C('URL_URLRULE');
    $urlrule = is_array($URL_URLRULE) ? $URL_URLRULE : explode(':::', $URL_URLRULE);
    $list = explode('|', $urlrule[1]);
    $show = explode('|', $urlrule[0]);
    $listurls[] = make_urlrule($show[1], $langarr, 'show');
    $listurls[] = make_urlrule($show[0], $langarr, 'show');
    $listurls[] = make_urlrule($list[1], $langarr, 'index');
    $listurls[] = make_urlrule($list[0], $langarr, 'index');
    $url = implode(",\n", $listurls) . ',' . "\n";
    file_put_contents(DATA_PATH . 'Routes.php', "<?php\nreturn array(\n" . $langurlstr . $tagurl . $url . "\n);\n?>");
    if (is_file(CACHE_PATH . '~runtime.php')) {
        @unlink(CACHE_PATH . '~runtime.php');
    }
}