Exemplo n.º 1
0
function lean_preprocess_page(&$vars)
{
    // Assign section name as subtitle
    $vars['page_subtitle'] = _lean_get_section_name($vars['node']);
    // Format Today titles
    if ($vars['node']->type == 'today') {
        $vars['page_title'] = _lean_get_today_title($vars['node'], $vars['title'], false, true);
        $vars['page_date'] = '<p class="date">' . format_date($vars['node']->created, 'custom', 'l, jS M Y') . ':</p>';
        $vars['title'] = 'Today: ' . format_date($vars['node']->created, 'custom', 'l, jS M Y');
    }
    // add date to Today index listing page
    if ($_GET['q'] == 'today') {
        $vars['page_title'] = $vars['title'] . '<span class="date"> ' . format_date(time(), 'custom', 'l, jS M Y') . '</span>';
        $vars['body_classes'] .= ' view-today';
    }
    // Remove node.css if this is homepage
    if ($vars['is_front']) {
        $vars['styles'] = _lean_remove_css(path_to_theme() . '/css/node.css', $vars['styles']);
        //if (!strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
        //  $vars['message'] = t('This page looks much better in Firefox, Chrome or Safari!');
        //}
    }
    // Title
    $vars['head_title'] = _get_page_head_title($vars);
    // Set lang for KanjiKanji
    if ($_GET['q'] == '漢字感じ' || $vars['node']->type == 'kanjikanji') {
        //$vars['html_language'] = 'ja';
        $vars['is_kanjikanji'] = True;
    }
}
Exemplo n.º 2
0
function leggy_preprocess_page(&$vars)
{
    // Assign section name as subtitle
    $vars['page_subtitle'] = _leggy_get_section_name($vars['node']);
    // Format Today titles
    if ($vars['node']->type == 'today') {
        $vars['page_title'] = _leggy_get_today_title($vars['node'], false, true);
        $vars['page_date'] = '<p class="date">' . format_date($vars['node']->created, 'custom', 'l, jS M Y') . ':</p>';
        $vars['title'] = 'Today: ' . format_date($vars['node']->created, 'custom', 'l, jS M Y');
    }
    // add date to Today index listing page
    if ($_GET['q'] == 'today') {
        $vars['page_title'] = $vars['title'] . '<span class="date"> ' . format_date(time(), 'custom', 'l, jS M Y') . '</span>';
        $vars['body_classes'] .= ' view-today';
    } elseif (strstr($_GET[q], 'today/')) {
        $vars['body_classes'] .= ' view-today';
        $q_parts = explode('/', $_GET[q]);
        $date_parts = explode('-', $q_parts[1]);
        if (!is_numeric($date_parts[0])) {
            unset($date_parts);
        } elseif (!is_numeric($date_parts[1])) {
            unset($date_parts[1]);
        }
        if (count($date_parts) == 2 && checkdate($date_parts[1], 1, $date_parts[0])) {
            $vars['page_title'] = $vars['title'] . '<span class="date"> in ' . format_date(strtotime($q_parts[1]), 'custom', 'F Y') . '</span>';
        } elseif (is_numeric($date_parts[0]) && checkdate(1, 1, $date_parts[0])) {
            $vars['page_title'] = $vars['title'] . '<span class="date"> in ' . check_plain($date_parts[0]) . '</span>';
        }
    }
    // Remove node.css if this is homepage
    if ($vars['is_front']) {
        $vars['styles'] = _leggy_remove_css(path_to_theme() . '/css/node.css', $vars['styles']);
        //if (!strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
        //  $vars['message'] = t('This page looks much better in Firefox, Chrome or Safari!');
        //}
    }
    // Title
    $vars['head_title'] = _get_page_head_title($vars);
    // Set lang for KanjiKanji
    if ($_GET['q'] == '漢字感じ' || $vars['node']->type == 'kanjikanji') {
        //$vars['html_language'] = 'ja';
        $vars['is_kanjikanji'] = True;
    }
    // Add css for search
    $array_q = explode('/', $_GET['q']);
    if ($array_q[0] == 'search') {
        drupal_add_css(path_to_theme() . '/css/search.css', 'theme');
        //Reload css/js. This is needed for preprocess_page since css/js is already loaded.
        $vars['styles'] = drupal_get_css();
        $vars['tabs'] = null;
        // don't show search tabs
    }
}