Exemplo n.º 1
0
function vocabsLinkList($vocabs, $path, $uglyUrls)
{
    $html = '';
    foreach ($vocabs as $vocabName => $vocab) {
        $html .= '<h2 class="vocab-links-title" id="' . $vocabName . '-vocabulary">' . $vocabName . '</h2>';
        $html .= '<table class="vocab-links">';
        foreach ($vocab as $locale => $translation) {
            if ($uglyUrls == true) {
                $url = './?name=' . $vocabName . '&lang=' . $locale;
            } else {
                $url = $path . $vocabName . '/' . $locale;
            }
            $title = $translation['title'];
            $language = $translation['language'];
            $html .= '<tr class="language-' . $locale . '">';
            $html .= '<td class="vocab-link-link"><a href="' . $url . '">' . $title . '</a></td>';
            $html .= '<td class="vocab-link-language">' . $language . '</td>';
            $html .= '<td class="vocab-link-authors">';
            $html .= creditsLinks($translation['credits']);
            $html .= '</td>';
            $html .= '</tr>';
        }
        $html .= '</table><br>';
    }
    return $html;
}
Exemplo n.º 2
0
} else {
    $path = 'http://apps.workflower.fi/css-cheats/';
}
$sets = json_decode(file_get_contents('rulesets/rulesets.json'), true);
$github = 'https://github.com/sakamies/css-cheats';
$appCredits = '<a href="http://twitter.com/sakamies">@sakamies</a> / <a href="http://twitter.com/workflower">@workflower</a>';
$reportIssue = '<a href="' . $github . '/issues/new">Report an issue</a>';
$createSet = '<a href="' . $github . '/fork">Create a cheatsheet</a>';
// If there is no name given, output the index list and die
$setName = filter_input(INPUT_GET, 'name', FILTER_SANITIZE_STRING);
if (isset($setName) == false) {
    include 'list.php';
    exit;
}
// If a name is in the url, make sure it exists in sets.json
// Should be safe to use setName
$setExists = array_key_exists($setName, $sets);
if ($setExists == false) {
    header('HTTP/1.0 404 Not Found');
    include 'error.php';
    exit;
} else {
    // Ok cool, we have a cheatsheet, time party
    //Read page title and stuff from sets.json according to bundle
    $set = $sets[$setName];
    $title = $set['title'];
    $credits = creditsLinks($set['credits']);
    $specs = specsLinks($set['specs']);
    $helpText = $set['help-text'];
    include 'app.php';
}