147 lines
4.3 KiB
PHP
147 lines
4.3 KiB
PHP
<?php
|
|
|
|
// dsm($vars, 'vars');
|
|
|
|
if (module_exists('rdf')) {
|
|
$vars['doctype'] = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML+RDFa 1.1//EN">' . "\n";
|
|
$vars['rdf_profile'] = ' profile="' . $vars['grddl_profile'] . '"';
|
|
}
|
|
else {
|
|
$vars['doctype'] = '<!DOCTYPE html>' . "\n";
|
|
$vars['rdf_profile'] = '';
|
|
}
|
|
|
|
# Add mobile meta tags to $head ADD this to your subtheme
|
|
$heads = array();
|
|
|
|
// $heads['HandheldFriendly'] = array(
|
|
// '#tag' => 'meta',
|
|
// '#attributes' => array(
|
|
// 'name' => 'HandheldFriendly',
|
|
// 'content' => 'true',
|
|
// ),
|
|
// );
|
|
|
|
$heads['apple-mobile-web-app-capable'] = array(
|
|
'#tag' => 'meta',
|
|
'#attributes' => array(
|
|
'name' => 'apple-mobile-web-app-capable',
|
|
'content' => 'yes',
|
|
),
|
|
);
|
|
|
|
# Mobile Viewport Fix
|
|
# j.mp/mobileviewport & davidbcalhoun.com/2010/viewport-metatag
|
|
# device-width : Occupy full width of the screen in its current orientation
|
|
# initial-scale = 1.0 retains dimensions instead of zooming out if page height > device height
|
|
# maximum-scale = 1.0 retains dimensions instead of zooming in if page width < device width
|
|
|
|
$heads['viewport'] = array(
|
|
'#tag' => 'meta',
|
|
'#attributes' => array(
|
|
'name' => 'viewport',
|
|
'content' => 'width=device-width,initial-scale=1,maximum-scale=1',
|
|
),
|
|
);
|
|
|
|
# Add these icons links to your sub theme
|
|
# or Place favicon.ico and apple-touch-icon.png in the root of your domain and delete these references
|
|
|
|
// $head[] = '<link rel="apple-touch-icon" sizes="72x72" href="'. base_path() . path_to_theme() .'/touch-icon-ipad.png'.'"/>' . "\n";
|
|
// $head[] = '<link rel="apple-touch-icon" sizes="114x114" href="'. base_path() . path_to_theme() .'/touch-icon-iphone4.png'.'"/>' . "\n";
|
|
|
|
$heads['icon'] = array(
|
|
'#tag' => 'link',
|
|
'#attributes' => array(
|
|
'href' => base_path() . path_to_theme() .'/materio-icon.png',
|
|
'rel' => 'shortcut icon',
|
|
'type' => 'image/png',
|
|
),
|
|
);
|
|
|
|
$heads['apple-touch-icon'] = array(
|
|
'#tag' => 'link',
|
|
'#attributes' => array(
|
|
'href' => $GLOBALS['base_url'] . base_path() . path_to_theme() .'/materio-touch-icon.png',
|
|
'rel' => 'apple-touch-icon-precomposed',
|
|
),
|
|
);
|
|
|
|
foreach ($heads as $type=>$head)
|
|
drupal_add_html_head($head, $type);
|
|
|
|
|
|
$node = isset($vars['node']) ? $vars['node'] : false;
|
|
|
|
# add body classes
|
|
if($node){
|
|
|
|
# from taxonomy
|
|
foreach ($vars['node']->taxonomy as $tid => $term) {
|
|
$vars['classes_array'][] = 'term-vid-'. $term->vid .' term-tid-'. $tid;
|
|
}
|
|
|
|
# from menu
|
|
$mlid = db_result(db_query("SELECT mlid FROM {menu_links} WHERE link_path = '%s'", 'node/'. $vars['node']->nid));
|
|
// Now get the menu related information.
|
|
if (!empty($mlid) || !empty($node->menu['mlid']) || !empty($node->menu['plid'])) {
|
|
$menu_link = menu_link_load($mlid);
|
|
// krumo($menu_link);
|
|
$vars['classes_array'][] = ' mlid-'. $menu_link['mlid'] .' plid-'. $menu_link['plid'];
|
|
}
|
|
}
|
|
|
|
foreach ($vars['user']->roles as $key => $value) {
|
|
$vars['classes_array'][] = "role-" . $key;
|
|
}
|
|
|
|
// dsm($vars);
|
|
// if(){
|
|
// $vars['classes_array'][] = "fixed-grid";
|
|
// }
|
|
|
|
/*
|
|
if(isset($vars['page']['sidebar_first']) && isset($vars['page']['sidebar_second'])){
|
|
$layout = 'two-sidebars';
|
|
}else if(isset($vars['page']['sidebar_first']) || isset($vars['page']['sidebar_second'])){
|
|
$layout = isset($vars['page']['sidebar_first']) ? 'sidebar-first' : 'sidebar-second';
|
|
}else{
|
|
$layout = 'no-sidebar';
|
|
}
|
|
$vars['classes_array'][] = $layout;
|
|
*/
|
|
|
|
$currentpath = current_path();
|
|
$menu_item = menu_get_item($currentpath);
|
|
// $node = false;
|
|
// if($menu_item['page_callback'] == 'node_page_view')
|
|
// $node = $menu_item['page_arguments'][0];
|
|
|
|
global $language;
|
|
|
|
drupal_add_js(array('materiobasetheme' => array(
|
|
'strings'=>array(
|
|
'search'=>t('search'),
|
|
// 'filter'=>t('filter'),
|
|
'site_name'=>t(variable_get('site_name', '')),
|
|
'site_slogan'=>t(variable_get('site_slogan', '')),
|
|
),
|
|
'themePath'=> drupal_get_path('theme', 'materiobasetheme'),
|
|
// 'current_path' => $currentpath,
|
|
// 'menu_item' => $menu_item,
|
|
'page_callback' => $menu_item['page_callback'],
|
|
'node_type' => isset($node->type) ? $node->type : false,
|
|
'node_nid' => isset($node->nid) ? $node->nid : false,
|
|
'language'=>$language->language,
|
|
)), 'setting');
|
|
|
|
$head_title_array = array();
|
|
foreach ($vars['head_title_array'] as $key => $value){
|
|
if($value){
|
|
$head_title_array[] = $value;
|
|
}
|
|
}
|
|
$vars['head_title'] = $vars['head_array']['title'] = strip_tags(implode(' | ', $head_title_array));
|
|
|
|
|