function lamtech_preprocess_html(&$vars) { drupal_add_html_head_link(array('href' => 'http://fonts.googleapis.com/css?family=Roboto:300', 'rel' => 'stylesheet', 'type' => 'text/css')); drupal_add_css(drupal_get_path('theme', 'lamtech') . '/css/html-elements.css'); drupal_add_css(drupal_get_path('theme', 'lamtech') . '/css/forms.css'); drupal_add_css(drupal_get_path('theme', 'lamtech') . '/css/page.css'); drupal_add_css(drupal_get_path('theme', 'lamtech') . '/css/comments.css'); drupal_add_css(drupal_get_path('theme', 'lamtech') . '/css/views.css'); drupal_add_css(drupal_get_path('theme', 'lamtech') . '/css/forums.css'); drupal_add_css(drupal_get_path('theme', 'lamtech') . '/css/fields.css'); drupal_add_css(drupal_get_path('theme', 'lamtech') . '/css/blocks.css'); drupal_add_css(drupal_get_path('theme', 'lamtech') . '/css/navigation.css'); // drupal_add_css(drupal_get_path('theme', 'lamtech') . '/bootstrap/css/bootstrap.min.css'); drupal_add_css(drupal_get_path('theme', 'lamtech') . '/bootstrap/css/bootstrap-theme.min.css'); drupal_add_css(drupal_get_path('theme', 'lamtech') . '/tpl/anb/css/responsive.css'); drupal_add_css(drupal_get_path('theme', 'lamtech') . '/tpl/anb/css/lamtech.bootstrap.css'); drupal_add_css(drupal_get_path('theme', 'lamtech') . '/tpl/anb/css/lamtech.core.css'); drupal_add_css(drupal_get_path('theme', 'lamtech') . '/tpl/anb/css/lamtech.css'); drupal_add_css(drupal_get_path('theme', 'lamtech') . '/tpl/anb/css/lamtech.common.css', array('group' => 1)); drupal_add_css(drupal_get_path('theme', 'lamtech') . '/tpl/anb/css/lamtech.typography.css'); drupal_add_css(drupal_get_path('theme', 'lamtech') . '/tpl/anb/css/lamtech.forms.css'); drupal_add_css(drupal_get_path('theme', 'lamtech') . '/tpl/anb/css/off-canvas.css'); drupal_add_js(drupal_get_path('theme', 'lamtech') . '/bootstrap/js/bootstrap.js'); drupal_add_js(drupal_get_path('theme', 'lamtech') . '/js/jquery.smooth-scroll.js'); }
function bfw2015_add_icons() { global $base_url; $favicon = $base_url . '/' . path_to_theme() . '/icons/apple-touch-icon-57x57.png'; $variables[] = array('rel' => 'apple-touch-icon-precomposed', 'sizes' => '57x57', 'href' => drupal_strip_dangerous_protocols($favicon)); $favicon = $base_url . '/' . path_to_theme() . '/icons/apple-touch-icon-114x114.png'; $variables[] = array('rel' => 'apple-touch-icon-precomposed', 'sizes' => '114x114', 'href' => drupal_strip_dangerous_protocols($favicon)); $favicon = $base_url . '/' . path_to_theme() . '/icons/apple-touch-icon-72x72.png'; $variables[] = array('rel' => 'apple-touch-icon-precomposed', 'sizes' => '72x72', 'href' => drupal_strip_dangerous_protocols($favicon)); $favicon = $base_url . '/' . path_to_theme() . '/icons/apple-touch-icon-144x144.png'; $variables[] = array('rel' => 'apple-touch-icon-precomposed', 'sizes' => '144x144', 'href' => drupal_strip_dangerous_protocols($favicon)); $favicon = $base_url . '/' . path_to_theme() . '/icons/apple-touch-icon-60x60.png'; $variables[] = array('rel' => 'apple-touch-icon-precomposed', 'sizes' => '60x60', 'href' => drupal_strip_dangerous_protocols($favicon)); $favicon = $base_url . '/' . path_to_theme() . '/icons/apple-touch-icon-120x120.png'; $variables[] = array('rel' => 'apple-touch-icon-precomposed', 'sizes' => '120x120', 'href' => drupal_strip_dangerous_protocols($favicon)); $favicon = $base_url . '/' . path_to_theme() . '/icons/apple-touch-icon-76x76.png'; $variables[] = array('rel' => 'apple-touch-icon-precomposed', 'sizes' => '76x76', 'href' => drupal_strip_dangerous_protocols($favicon)); $favicon = $base_url . '/' . path_to_theme() . '/icons/apple-touch-icon-152x152.png'; $variables[] = array('rel' => 'apple-touch-icon-precomposed', 'sizes' => '152x152', 'href' => drupal_strip_dangerous_protocols($favicon)); $favicon = $base_url . '/' . path_to_theme() . '/icons/favicon-196x196.png'; $variables[] = array('rel' => 'icon', 'sizes' => '196x196', 'type' => 'image/png', 'href' => drupal_strip_dangerous_protocols($favicon)); $favicon = $base_url . '/' . path_to_theme() . '/icons/favicon-96x96.png'; $variables[] = array('rel' => 'icon', 'sizes' => '96x96', 'type' => 'image/png', 'href' => drupal_strip_dangerous_protocols($favicon)); $favicon = $base_url . '/' . path_to_theme() . '/icons/favicon-32x32.png'; $variables[] = array('rel' => 'icon', 'sizes' => '32x32', 'type' => 'image/png', 'href' => drupal_strip_dangerous_protocols($favicon)); $favicon = $base_url . '/' . path_to_theme() . '/icons/favicon-16x16.png'; $variables[] = array('rel' => 'icon', 'sizes' => '16x16', 'type' => 'image/png', 'href' => drupal_strip_dangerous_protocols($favicon)); $favicon = $base_url . '/' . path_to_theme() . '/icons/favicon-128x128.png'; $variables[] = array('rel' => 'icon', 'sizes' => '128x128', 'type' => 'image/png', 'href' => drupal_strip_dangerous_protocols($favicon)); foreach ($variables as $vars) { drupal_add_html_head_link($vars); } $meta_variables = array('#tag' => 'meta', '#attributes' => array('name' => 'application-name', 'content' => ' ')); drupal_add_html_head($meta_variables, 'meta_application_name'); $meta_variables = array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-TileColor', 'content' => '#FFFFFF')); drupal_add_html_head($meta_variables, 'msapplication_tilecolor'); $favicon = $base_url . '/' . path_to_theme() . '/icons/mstile-144x144.png'; $meta_variables = array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-TileImage', 'content' => $favicon)); drupal_add_html_head($meta_variables, 'msapplication_tileimage'); $favicon = $base_url . '/' . path_to_theme() . '/icons/mstile-70x70.png'; $meta_variables = array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-square70x70logo', 'content' => $favicon)); drupal_add_html_head($meta_variables, 'msapplication_70x70'); $favicon = $base_url . '/' . path_to_theme() . '/icons/mstile-150x150.png'; $meta_variables = array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-square150x150logo', 'content' => $favicon)); drupal_add_html_head($meta_variables, 'msapplication_150x150'); $favicon = $base_url . '/' . path_to_theme() . '/icons/mstile-310x150.png'; $meta_variables = array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-wide310x150logo', 'content' => $favicon)); drupal_add_html_head($meta_variables, 'msapplication_310x150'); $favicon = $base_url . '/' . path_to_theme() . '/icons/mstile-310x310.png'; $meta_variables = array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-square310x310logo', 'content' => $favicon)); drupal_add_html_head($meta_variables, 'msapplication_310x310'); }
/** * Preprocess variables for the html template. */ function iit_ethics_preprocess_html(&$vars) { global $theme_key; $openSansWebfontLink = array('href' => '//fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800,300italic,400italic,600italic,700italic,800italic|Open+Sans+Condensed:300,300italic,700', 'rel' => 'stylesheet', 'type' => 'text/css'); drupal_add_html_head_link($openSansWebfontLink); $oswaldWebfontLink = array('href' => '//fonts.googleapis.com/css?family=Oswald:300,400,700&subset=latin,latin-ext', 'rel' => 'stylesheet', 'type' => 'text/css'); drupal_add_html_head_link($oswaldWebfontLink); $fontAwesomefontLink = array('href' => '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', 'rel' => 'stylesheet', 'type' => 'text/css'); drupal_add_html_head_link($fontAwesomefontLink); // Two examples of adding custom classes to the body. // Add a body class for the active theme name. // $vars['classes_array'][] = drupal_html_class($theme_key); // Browser/platform sniff - adds body classes such as ipad, webkit, chrome etc. // $vars['classes_array'][] = css_browser_selector(); }
/** * Preprocess variables for the html template. */ function iit_humanscience_preprocess_html(&$vars) { global $theme_key; $openSansWebfontLink = array('href' => '//fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800,300italic,400italic,600italic,700italic,800italic|Open+Sans+Condensed:300,300italic,700', 'rel' => 'stylesheet', 'type' => 'text/css'); drupal_add_html_head_link($openSansWebfontLink); $oswaldWebfontLink = array('href' => '//fonts.googleapis.com/css?family=Oswald:300,400,700&subset=latin,latin-ext', 'rel' => 'stylesheet', 'type' => 'text/css'); drupal_add_html_head_link($oswaldWebfontLink); if ($_SERVER['SERVER_NAME'] == 'humansci-dev.iit.edu' || $_SERVER['SERVER_NAME'] == 'humansci-stg.iit.edu') { $metaNoIndex = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('name' => 'robots', 'content' => 'noindex')); drupal_add_html_head($metaNoIndex, 'dev_noindex'); } // Two examples of adding custom classes to the body. // Add a body class for the active theme name. // $vars['classes_array'][] = drupal_html_class($theme_key); // Browser/platform sniff - adds body classes such as ipad, webkit, chrome etc. // $vars['classes_array'][] = css_browser_selector(); }
/** * Override or insert variables into the html templates. * * @param array $variables * An array of variables to pass to the theme template. * @param string $hook * The name of the template being rendered ("html" in this case.) */ function fortytwo_preprocess_html(&$variables, $hook) { fortytwo_load_debuggers(); global $theme_key; $variables['staticpath'] = fortytwo_get_staticpath(TRUE, $theme_key); $variables['classes_array'][] = theme_get_setting('ft_layout_style'); $variables['grid'] = theme_get_setting('ft_show_grid'); $variables['grid'] ? $variables['classes_array'][] = 'show-grid' : ($variables['classes_array'][] = ''); $variables['responsive_identifier'] = theme_get_setting('ft_show_responsive_identifier'); $variables['responsive_identifier'] ? $variables['classes_array'][] = 'show-responsive-identifier' : ($variables['classes_array'][] = ''); $variables['classes_array'][] = theme_get_setting('ft_layout_responsive'); // Change the mime type of the favicon to amek it work in all browsers. $favicon = theme_get_setting('favicon'); $type = 'image/x-icon'; drupal_add_html_head_link(array('rel' => 'shortcut icon', 'href' => drupal_strip_dangerous_protocols($favicon), 'type' => $type)); // Add the profile to the head as link element. drupal_add_html_head_link(array('rel' => 'profile', 'href' => $variables['grddl_profile'])); unset($variables['grddl_profile']); }
/** * Implements hook_preprocess_html(). */ function perspective_preprocess_html(&$variables) { $theme_path = path_to_theme(); drupal_add_css($theme_path . '/css/reset.css'); drupal_add_css($theme_path . '/css/reset.css'); drupal_add_css($theme_path . '/css/grid.css'); drupal_add_css($theme_path . '/js/lightbox/themes/default/jquery.lightbox.css'); drupal_add_css($theme_path . '/css/flexslider.css'); drupal_add_css($theme_path . '/css/iview-slider/iview.css'); drupal_add_css($theme_path . '/css/iview-slider/style.css'); drupal_add_css($theme_path . '/css/jquery.onebyone.css'); drupal_add_css($theme_path . '/css/framework.css'); drupal_add_css($theme_path . '/css/style.css'); drupal_add_css($theme_path . '/css/responsive.css'); if (!empty($_GET['theme_skin'])) { $_SESSION['theme_skin'] = $_GET['theme_skin']; } $default_skin = theme_get_setting('default_skin', 'perspective'); if (!empty($_SESSION['theme_skin'])) { $default_skin = $_SESSION['theme_skin']; } //setting default skin css file if (file_exists($theme_path . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $default_skin . '.css')) { drupal_add_css($theme_path . '/css/themes/' . $default_skin . '.css'); } else { $_SESSION['theme_skin'] = FALSE; $default_skin = theme_get_setting('default_skin', 'perspective'); drupal_add_css($theme_path . '/css/themes/' . $default_skin . '.css'); } drupal_add_css($theme_path . '/css/perspective.css'); // Cache path to theme for duration of this function: $path_to_perspective = drupal_get_path('theme', 'perspective'); // Add 'viewport' meta tag: drupal_add_html_head(array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1')), 'perspective:viewport_meta'); $path_to_icons = $path_to_perspective . '/'; global $theme; if ($theme == 'perspective') { drupal_add_html_head_link(array('rel' => 'apple-touch-icon-precomposed', 'href' => $path_to_icons . 'apple-touch-icon-144-precomposed.png', 'sizes' => '144x144')); drupal_add_html_head_link(array('rel' => 'apple-touch-icon-precomposed', 'href' => $path_to_icons . 'apple-touch-icon-114-precomposed.png', 'sizes' => '114x114')); drupal_add_html_head_link(array('rel' => 'apple-touch-icon-precomposed', 'href' => $path_to_icons . 'apple-touch-icon-72-precomposed.png', 'sizes' => '72x72')); drupal_add_html_head_link(array('rel' => 'apple-touch-icon-precomposed', 'href' => $path_to_icons . 'apple-touch-icon-57-precomposed.png')); } }
/** * Override or insert variables into the html templates. * * @param $variables * An array of variables to pass to the theme template. * @param $hook * The name of the template being rendered ("html" in this case.) */ function amani_zen_preprocess_html(&$variables, $hook) { // The body tag's classes are controlled by the $classes_array variable. To // remove a class from $classes_array, use array_diff(). //$variables['classes_array'] = array_diff($variables['classes_array'], array('class-to-remove')); global $base_url; // Adding favicons and app icons // $theme_path = $base_url . '/' . drupal_get_path('theme', 'amani_zen'); $theme_path = drupal_get_path('theme', $GLOBALS['theme']); $app_icons_path = $base_url . '/' . $theme_path . '/app-icons/'; $icons = array(array('rel' => 'apple-touch-icon', 'href' => $app_icons_path . 'apple-icon-57x57.png', 'sizes' => '57x57'), array('rel' => 'apple-touch-icon', 'href' => $app_icons_path . 'apple-icon-60x60.png', 'sizes' => '60x60'), array('rel' => 'apple-touch-icon', 'href' => $app_icons_path . 'apple-icon-72x72.png', 'sizes' => '72x72'), array('rel' => 'apple-touch-icon', 'href' => $app_icons_path . 'apple-icon-76x76.png', 'sizes' => '76x76'), array('rel' => 'apple-touch-icon', 'href' => $app_icons_path . 'apple-icon-114x114.png', 'sizes' => '114x114'), array('rel' => 'apple-touch-icon', 'href' => $app_icons_path . 'apple-icon-120x120.png', 'sizes' => '120x120'), array('rel' => 'apple-touch-icon', 'href' => $app_icons_path . 'apple-icon-144x144.png', 'sizes' => '144x144'), array('rel' => 'apple-touch-icon', 'href' => $app_icons_path . 'apple-icon-152x152.png', 'sizes' => '152x152'), array('rel' => 'apple-touch-icon', 'href' => $app_icons_path . 'apple-icon-180x180.png', 'sizes' => '180x180'), array('rel' => 'icon', 'href' => $app_icons_path . 'android-icon-192x192.png', 'sizes' => '192x192', 'type' => 'image/png'), array('rel' => 'icon', 'href' => $app_icons_path . 'favicon-16x16.png', 'sizes' => '16x16', 'type' => 'image/png'), array('rel' => 'icon', 'href' => $app_icons_path . 'favicon-32x32.png', 'sizes' => '32x32', 'type' => 'image/png'), array('rel' => 'icon', 'href' => $app_icons_path . 'favicon-96x96.png', 'sizes' => '96x96', 'type' => 'image/png')); foreach ($icons as $icon) { drupal_add_html_head_link($icon); } drupal_add_html_head_link(array('rel' => 'manifest', 'href' => $app_icons_path . 'manifest.json')); // // Adding Fonts // // Google fonts drupal_add_css('//fonts.googleapis.com/css?family=Open+Sans:300italic,700,300,600,800,400', array('group' => CSS_THEME, 'every_page' => TRUE)); // SS Social drupal_add_css($theme_path . '/fonts/ss-social/ss-social.css', array('group' => CSS_THEME, 'every_page' => TRUE)); drupal_add_js($theme_path . '/fonts/ss-social/ss-social.js', array('type' => 'file', 'scope' => 'footer')); }
/** * Gets previous and next node. */ function node_sibling($node, $dir = 'next', $prepend_text = '', $append_text = '', $next_node_text = NULL) { $query = 'SELECT n.nid, n.title FROM {node} n WHERE ' . 'n.created ' . ($dir == 'prev' ? '<' : '>') . ' :created AND n.type = :type AND n.status = 1 ' . "AND language IN (:lang, 'und') " . 'ORDER BY n.created ' . ($dir == 'prev' ? 'DESC' : 'ASC') . ' LIMIT 1'; //use fetchObject to fetch a single row $row = db_query($query, array(':created' => $node->created, ':type' => $node->type, ':lang' => $node->language))->fetchObject(); if ($row) { drupal_add_html_head_link(array('rel' => $dir, 'type' => 'text/html', 'title' => $row->title, 'href' => url('node/' . $row->nid, array('absolute' => TRUE)))); $text = $next_node_text ? t($next_node_text) : $row->title; return t($prepend_text) . l($text, 'node/' . $row->nid, array('attributes' => array('rel' => array($dir)))) . t($append_text); } else { return FALSE; } }
/** * Add body classes if certain regions have content. */ function unikue_preprocess_html(&$vars) { global $base_url; $css = ""; $themepath = drupal_get_path('theme', 'unikue'); drupal_add_js(array('themePath' => $themepath), 'setting'); drupal_add_css($themepath . '/css/loading.css'); drupal_add_css($themepath . '/css/base.css'); drupal_add_css($themepath . '/css/normalize.css'); drupal_add_css($themepath . '/css/style.css'); drupal_add_css($themepath . '/css/drupal-additional.css'); drupal_add_js($themepath . '/js/jquery-migrate-1.2.1.js'); drupal_add_js($themepath . '/js/form.js'); //drupal_add_js($themepath . '/js/jquery.min.js'); drupal_add_js($themepath . '/js/jquery.countTo.js'); drupal_add_js($themepath . '/js/modernizr.js'); drupal_add_js($themepath . '/js/main.js'); drupal_add_js($themepath . '/js/woozy.js'); drupal_add_js($themepath . '/js/twd.js'); drupal_add_js($themepath . '/js/jquery-ui.min.js'); ///////////////////////////////////////// Construct page title //////////////////////////////////////////////////////. if (drupal_get_title()) { $head_title = array('title' => str_replace(array('<i>', '</i>'), '', drupal_get_title()), 'name' => check_plain(variable_get('site_name', 'Drupal'))); } else { $head_title = array('name' => check_plain(variable_get('site_name', 'Drupal'))); if (variable_get('site_slogan', '')) { $head_title['slogan'] = filter_xss_admin(variable_get('site_slogan', '')); } } $vars['head_title_array'] = $head_title; $vars['head_title'] = implode(' | ', $head_title); // Match path if necessary. $page_match = TRUE; $path = drupal_strtolower(drupal_get_path_alias($_GET['q'])); //////////////////////////////////////////// FAVICON SETTING //////////////////////////////////////////// // Add favicon. if (theme_get_setting('toggle_fvicon')) { $favicon_path = $base_url . '/' . $themepath . '/favicon.ico'; if (theme_get_setting('default_favicon') == 0) { if (module_exists('media')) { $favicon = theme_get_setting('fvicon_upload'); if (!empty($favicon)) { $file = json_decode($favicon); $favicon_path = $file->url; } } else { if ($favicon_file = theme_get_setting('fvicon_file')) { $favicon_path = file_create_url(file_build_uri($favicon_file)); } } } $type = theme_get_setting('favicon_mimetype'); drupal_add_html_head_link(array('rel' => 'shortcut icon', 'href' => drupal_strip_dangerous_protocols($favicon_path), 'type' => $type)); } // iOs webclip $vars['ios_57'] = ''; if (module_exists('media')) { if (theme_get_setting('ios_57x57_media_file')) { $file_upload = theme_get_setting('ios_57x57_media_file'); if (!empty($file_upload)) { $file = json_decode($file_upload); $vars['ios_57'] = $file->url; } } } else { if (theme_get_setting('ios_57x57_form_file')) { $vars['ios_57'] = file_create_url(file_build_uri(theme_get_setting('ios_57x57_form_file'))); } } $vars['ios_72'] = ''; if (module_exists('media')) { if (theme_get_setting('ios_72x72_media_file')) { $file_upload = theme_get_setting('ios_72x72_media_file'); if (!empty($file_upload)) { $file = json_decode($file_upload); $vars['ios_72'] = $file->url; } } } else { if (theme_get_setting('ios_72x72_form_file')) { $vars['ios_72'] = file_create_url(file_build_uri(theme_get_setting('ios_72x72_form_file'))); } } $vars['ios_114'] = ''; if (module_exists('media')) { if (theme_get_setting('ios_114x114_media_file')) { $file_upload = theme_get_setting('ios_114x114_media_file'); if (!empty($file_upload)) { $file = json_decode($file_upload); $vars['ios_114'] = $file->url; } } } else { if (theme_get_setting('ios_114x114_form_file')) { $vars['ios_114'] = file_create_url(file_build_uri(theme_get_setting('ios_114x114_form_file'))); } } $vars['ios_144'] = ''; if (module_exists('media')) { if (theme_get_setting('ios_144x144_media_file')) { $file_upload = theme_get_setting('ios_144x144_media_file'); if (!empty($file_upload)) { $file = json_decode($file_upload); $vars['ios_144'] = $file->url; } } } else { if (theme_get_setting('ios_144x144_form_file')) { $vars['ios_144'] = file_create_url(file_build_uri(theme_get_setting('ios_144x144_form_file'))); } } $vars['theme_setting_css'] = $css; //Google Fonts if (theme_get_setting('typo_hidden')) { $typo = theme_get_setting('typo_hidden'); $css .= unikue_typo_builder_to_css($typo); } /* Get theme settings ---------------------------------------------------------------------------------------- */ $vars['footer_text'] = theme_get_setting('footer_text'); $vars['header_code'] = theme_get_setting('header_code'); $vars['footer_code'] = theme_get_setting('footer_code'); if (theme_get_setting('custom_css')) { $vars['custom_css'] = theme_get_setting('custom_css'); } drupal_add_css(path_to_theme() . '/css/ie7.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'lte IE 7', '!IE' => FALSE), 'preprocess' => FALSE)); $vars['theme_setting_css'] = $css; }
/** * Preprocesses the wrapping HTML. * * @param array &$variables * Template variables. */ function us_ibtimes_preprocess_html(&$vars) { global $base_path; $directory = $vars['directory'] . '/favicons/'; $links[] = array('rel' => 'icon', 'type' => 'image/png', 'href' => $directory . 'favicon-194x194.png', 'sizes' => '194x194'); $links[] = array('rel' => 'icon', 'type' => 'image/png', 'href' => $directory . 'android-chrome-192x192.png', 'sizes' => '192x192'); $links[] = array('rel' => 'manifest', 'type' => 'json', 'href' => $directory . 'manifest.json'); $links[] = array('rel' => 'mask-icon', 'type' => 'image/svg', 'href' => $directory . 'safari-pinned-tab.svg'); foreach ($links as $link) { if (!empty($link['href'])) { if (strstr($link['href'], $directory)) { if (!file_exists(DRUPAL_ROOT . $base_path . $link['href'])) { continue; } $link['href'] = file_create_url($link['href']); } } drupal_add_html_head_link($link); } }
function bizutv_preprocess_html(&$variables) { $current_section = bizutv_helper_get_section(); if (!empty($current_section)) { $variables['classes_array'][] = "section-" . strtolower(drupal_clean_css_identifier($current_section->name)); } $path_to_theme = path_to_theme(); $js_settings = array('disqus_domain' => variable_get('disqus_domain', ''), 'oas_hostname' => variable_get('oas_hostname', 'bizu.tv'), 'auto_load_limit' => variable_get('auto_load_limit', '5'), 'path_to_theme' => $path_to_theme); drupal_add_js(array('bizutv' => $js_settings), array('type' => 'setting', 'scope' => JS_DEFAULT)); $path = libraries_get_path('writecapture'); drupal_add_js($path . '/jquery.writeCapture.js'); global $base_path; $directory = $base_path . $variables['directory'] . '/favicons/'; $links[] = array('rel' => 'apple-touch-icon', 'sizes' => '57x57', 'href' => $directory . 'apple-touch-icon-57x57.png'); $links[] = array('rel' => 'apple-touch-icon', 'sizes' => '114x114', 'href' => $directory . 'apple-touch-icon-114x114.png'); $links[] = array('rel' => 'apple-touch-icon', 'sizes' => '72x72', 'href' => $directory . 'apple-touch-icon-72x72.png'); $links[] = array('rel' => 'apple-touch-icon', 'sizes' => '144x144', 'href' => $directory . 'apple-touch-icon-144x144.png'); $links[] = array('rel' => 'apple-touch-icon', 'sizes' => '60x60', 'href' => $directory . 'apple-touch-icon-60x60.png'); $links[] = array('rel' => 'apple-touch-icon', 'sizes' => '120x120', 'href' => $directory . 'apple-touch-icon-120x120.png'); $links[] = array('rel' => 'apple-touch-icon', 'sizes' => '76x76', 'href' => $directory . 'apple-touch-icon-76x76.png'); $links[] = array('rel' => 'apple-touch-icon', 'sizes' => '152x152', 'href' => $directory . 'apple-touch-icon-152x152.png'); $links[] = array('rel' => 'apple-touch-icon', 'sizes' => '180x180', 'href' => $directory . 'apple-touch-icon-180x180.png'); $links[] = array('rel' => 'icon', 'type' => 'image/png', 'href' => $directory . 'favicon-192x192.png', 'sizes' => '192x192'); $links[] = array('rel' => 'icon', 'type' => 'image/png', 'href' => $directory . 'favicon-160x160.png', 'sizes' => '160x160'); $links[] = array('rel' => 'icon', 'type' => 'image/png', 'href' => $directory . 'favicon-96x96.png', 'sizes' => '96x96'); $links[] = array('rel' => 'icon', 'type' => 'image/png', 'href' => $directory . 'favicon-16x16.png', 'sizes' => '16x16'); $links[] = array('rel' => 'icon', 'type' => 'image/png', 'href' => $directory . 'favicon-32x32.png', 'sizes' => '32x32'); $meta_tags['msapplication-TileColor'] = array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-TileColor', 'content' => '#d54d25')); $meta_tags['msapplication-TileImage'] = array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-TileImage', 'content' => $directory . 'mstile-144x144.png')); $meta_tags['msapplication-config'] = array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-config', 'content' => $directory . 'browserconfig.xml')); foreach ($links as $link) { drupal_add_html_head_link($link); } foreach ($meta_tags as $key => $meta) { drupal_add_html_head($meta, $key); } }
/** * Preprocesses the wrapping HTML. * * @param array &$variables * Template variables. */ function newsweek_preprocess_html(&$vars) { global $base_path; $directory = $vars['directory'] . '/favicons/'; $links[] = array('rel' => 'icon', 'type' => 'image/png', 'href' => $directory . 'favicon-194x194.png', 'sizes' => '194x194'); $links[] = array('rel' => 'icon', 'type' => 'image/png', 'href' => $directory . 'android-chrome-192x192.png', 'sizes' => '192x192'); $links[] = array('rel' => 'manifest', 'type' => 'json', 'href' => $directory . 'manifest.json'); $links[] = array('rel' => 'mask-icon', 'type' => 'image/svg', 'href' => $directory . 'safari-pinned-tab.svg'); $meta_tags['msapplication-TileColor'] = array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-TileColor', 'content' => '#ff0000')); foreach ($links as $link) { if (!empty($link['href'])) { if (strstr($link['href'], $directory)) { if (!file_exists(DRUPAL_ROOT . $base_path . $link['href'])) { continue; } $link['href'] = file_create_url($link['href']); } } drupal_add_html_head_link($link); } foreach ($meta_tags as $key => $meta) { drupal_add_html_head($meta, $key); } }