本文整理汇总了PHP中drupal_get_http_header函数的典型用法代码示例。如果您正苦于以下问题:PHP drupal_get_http_header函数的具体用法?PHP drupal_get_http_header怎么用?PHP drupal_get_http_header使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drupal_get_http_header函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: intranet_preprocess_page
function intranet_preprocess_page(&$vars)
{
if (isset($vars['node'])) {
$vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
if ($vars['node']->type == 'cxo_messages') {
drupal_set_title('');
}
}
//404 page
$status = drupal_get_http_header("status");
if ($status == "404 Not Found") {
$vars['theme_hook_suggestions'][] = 'page__404';
}
$br_banner_var = array('path' => theme_get_setting('bg_image_path', 'intranet'));
$vars['bg_image'] = theme('image', $br_banner_var);
$header_banner_var = array('style_name' => 'header_banner', 'path' => theme_get_setting('header_image_path', 'intranet'), 'alt' => 'header_banner', 'title' => 'Sakal header banner', 'attributes' => array('class' => 'headerImage'));
$vars['header_image'] = theme('image_style', $header_banner_var);
$footer_banner_var = array('style_name' => 'footer_banner', 'path' => theme_get_setting('footer_image_path', 'intranet'), 'alt' => 'footer_banner', 'title' => 'Sakal footer banner', 'attributes' => array('class' => 'footerImage'));
$vars['footer_image'] = theme('image_style', $footer_banner_var);
//set page title
if (isset($vars['node'])) {
$default_value = ucfirst(str_replace("_", " ", $vars['node']->type));
drupal_set_title(variable_get('page_title_' . $vars['node']->type, $default_value));
}
}
示例2: fontfolio_preprocess_html
/**
* Override or insert variables into the html template.
*
* @param $vars
* An array of variables to pass to the theme template.
*/
function fontfolio_preprocess_html(&$vars)
{
// We want to use core's body class 'no-sidebars' but is useless for us
// because it doesn't ccounts fontfolio's 'sidebar' region as sidebar.
// So we first remove it.
$vars['classes_array'] = array_diff($vars['classes_array'], array('no-sidebars'));
// And restore it if appropriate.
if (empty($vars['page']['sidebar'])) {
$vars['classes_array'][] = 'no-sidebars';
}
$vars['path_to_fontfolio'] = drupal_get_path('theme', 'fontfolio');
$vars['base_path'] = base_path();
// Attributes for html element.
$vars['html_attributes_array'] = array('lang' => $vars['language']->language, 'dir' => $vars['language']->dir);
// Send X-UA-Compatible HTTP header to force IE to use the most recent
// rendering engine or use Chrome's frame rendering engine if available.
// This also prevents the IE compatibility mode button to appear when using
// conditional classes on the html tag.
if (is_null(drupal_get_http_header('X-UA-Compatible'))) {
drupal_add_http_header('X-UA-Compatible', 'IE=edge,chrome=1');
}
// We want to insert inline css rules based on fonfolio theme settings.
$bg_color = check_plain(theme_get_setting('body_bg_color'));
$data = 'body { background-color: ' . $bg_color . '}';
drupal_add_css($data, 'inline');
}
示例3: THEME_NAME_preprocess_page
function THEME_NAME_preprocess_page(&$variables)
{
$header = drupal_get_http_header('status');
if ($header == '404 Not Found') {
$vars['theme_hook_suggestions'][] = 'page__404';
}
}
示例4: millerLiteColTheme_preprocess_page
/**
* Override or insert variables for the page templates.
*/
function millerLiteColTheme_preprocess_page(&$vars)
{
if (arg(0) == "node" && arg(1) == "99") {
$vars['theme_hook_suggestions'][] = 'page__lived';
}
$header = drupal_get_http_header('status');
if ($header == '404 Not Found') {
$vars['theme_hook_suggestions'][] = 'page__404';
}
//drupal_add_css(path_to_theme() . '/css/styles.css' , array('group' => CSS_DEFAULT, 'every_page' => TRUE));
//drupal_add_js('https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js', array( 'scope' => 'header', 'weight' => -20 , 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js('https://maps.googleapis.com/maps/api/js?key=AIzaSyBDUCrY-Ih_wLT96QyP2yu7ARawGCbjPjM', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/jquery-11.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/libs/bootstrap.min.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/tabs/jquery.tabslet.min.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/tabs/jquery.tabslet.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/vendor/jquery.tabslet.min.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/vendor/rainbow-custom.min.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/vendor/jquery.anchor.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/tabs/initializers.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/popup.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/jasny-bootstrap.min.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
//drupal_add_css(path_to_theme() . '/css/brmfiles/bootstrap.min.css' , array('group' => CSS_DEFAULT, 'every_page' => TRUE));
drupal_add_css(path_to_theme() . '/css/brmfiles/jasny-bootstrap.min.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
drupal_add_css(path_to_theme() . '/css/style-beertime.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
drupal_add_css(path_to_theme() . '/css/brmfiles/millerLite-drupal.min.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
//drupal_add_css(path_to_theme() . '/css/brmfiles/style.css' , array('group' => CSS_DEFAULT, 'every_page' => TRUE));
//setcookie('ml_accesoF', '', time() - 60);
// Se valida si existe una cookie de la edad
//var_dump($_COOKIE['ml_accesoF']);
if ($_COOKIE['ml_accesoF'] == 'n0') {
//drupal_add_js(path_to_theme() . '/js/jquery.js', array( 'scope' => 'header', 'weight' => -20 , 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/libs/bootstrap.min.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_css(path_to_theme() . '/css/styleHaspe.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
drupal_add_js(path_to_theme() . '/js/validacionInicio.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(drupal_get_path('module', 'BRM_millerlite') . '/js/brmMiller.js');
drupal_add_js(path_to_theme() . '/bxslider/jquery.bxslider.min.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_css(path_to_theme() . '/bxslider/jquery.bxslider.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
} elseif (!isset($_COOKIE['ml_accesoF']) || $_COOKIE['ml_accesoF'] == '3sm3nor43d4d') {
drupal_add_js(path_to_theme() . '/js/tabs/jquery.tabslet.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/vendor/jquery.tabslet.min.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/vendor/rainbow-custom.min.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/vendor/jquery.anchor.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/tabs/initializers.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/popup.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/vendor/modernizr.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/jquery.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/validacionInicio.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/ga.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_js(path_to_theme() . '/js/tabs/jquery.tabslet.min.js', array('scope' => 'header', 'weight' => -20, 'group' => JS_LIBRARY, 'preprocess' => FALSE));
drupal_add_css(path_to_theme() . '/css/estilos-ss.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
drupal_add_css(path_to_theme() . '/fonts/fonts.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
drupal_add_css(path_to_theme() . '/css/testCris.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
drupal_add_css(path_to_theme() . '/css/webfonkit.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
drupal_add_css(path_to_theme() . '/css/animate.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
drupal_add_css(path_to_theme() . '/js/chosen/chosen.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
$vars['theme_hook_suggestions'][] = 'page__validarEdad';
}
}
示例5: blocks_preprocess_page
/**
* Assign theme hook suggestions for custom templates.
*/
function blocks_preprocess_page(&$vars, $hook)
{
if (isset($vars['node'])) {
$suggest = "page__node__{$vars['node']->type}";
$vars['theme_hook_suggestions'][] = $suggest;
}
$status = drupal_get_http_header("status");
if ($status == "404 Not Found") {
$vars['theme_hook_suggestions'][] = 'page__404';
}
}
示例6: ipress_preprocess_page
function ipress_preprocess_page(&$vars)
{
if (isset($vars['node'])) {
$vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
}
//404 page
$status = drupal_get_http_header("status");
if ($status == "404 Not Found") {
$vars['theme_hook_suggestions'][] = 'page__404';
}
}
示例7: glisseo_preprocess_page
/**
* Implements hook_preprocess_page().
*/
function glisseo_preprocess_page(&$variables, $hook)
{
// Add template suggestions for 404 and 403 errors.
// F.e.: page--404.tpl.php
$status = drupal_get_http_header("status");
if ($status == "404 Not Found") {
$variables['theme_hook_suggestions'][] = 'page__404';
}
if ($status == "403 Forbidden") {
$variables['theme_hook_suggestions'][] = 'page__403';
}
}
示例8: drupalcamp_preprocess_html
/**
* Implements theme_process_html().
*/
function drupalcamp_preprocess_html(&$vars)
{
$headers = drupal_get_http_header();
if (isset($headers['status'])) {
$vars['classes_array'][] = 'error-page';
if ($headers['status'] == '404 Not Found') {
$vars['classes_array'][] = 'error-page-404';
} elseif ($headers['status'] == '403 Forbidden') {
$vars['classes_array'][] = 'error-page-403';
}
}
}
示例9: kalypso_preprocess_page
function kalypso_preprocess_page(&$vars, $hook)
{
if (isset($vars['node'])) {
$suggest = "page__node__{$vars['node']->type}";
$vars['theme_hook_suggestions'][] = $suggest;
}
$status = drupal_get_http_header("status");
if ($status == "404 Not Found") {
$vars['theme_hook_suggestions'][] = 'page__404';
}
// We need to rebuild the scripts variable with the new script included.
$variables['scripts'] = drupal_get_js();
}
示例10: goodnex_preprocess_page
/**
* Modify theme_preprocess_page()
*/
function goodnex_preprocess_page(&$vars, $hook)
{
if (isset($vars['node'])) {
$suggest = "page__node__{$vars['node']->type}";
$vars['theme_hook_suggestions'][] = $suggest;
}
$status = drupal_get_http_header("status");
if ($status == "404 Not Found") {
$vars['theme_hook_suggestions'][] = 'page__404';
}
if (arg(0) == 'taxonomy' && arg(1) == 'term') {
$term = taxonomy_term_load(arg(2));
$vars['theme_hook_suggestions'][] = 'page--taxonomy--vocabulary--' . $term->vid;
}
}
示例11: realia_preprocess_page
/**
* Implements HOOK_preprocess_THEME()
* @param $variables
*/
function realia_preprocess_page(&$variables)
{
if (arg(0) == 'node' && arg(2) == 'edit' && isset($variables['node'])) {
$nodeObj = $variables['node'];
if ($nodeObj->type == 'apartment') {
drupal_set_title(t('Edit Machinery @title', array('@title' => $nodeObj->title)));
}
}
if (current_path() == 'node/add/apartment') {
drupal_set_title(t('Add your machine'));
}
$status = drupal_get_http_header("status");
if ($status == "404 Not Found") {
$variables['theme_hook_suggestions'][] = 'page__404';
}
}
示例12: onKernelResponse
/**
* Add response status and headers from legacy controllers.
*
* @param FilterResponseEvent $event
*/
public function onKernelResponse(FilterResponseEvent $event)
{
$request = $event->getRequest();
if (null === $this->matcher || $this->matcher->matches($request)) {
$response = $event->getResponse();
$headers = drupal_get_http_header();
$header_names = _drupal_set_preferred_header_name();
foreach ($headers as $name_lower => $value) {
if ($name_lower == 'status') {
$response->setStatusCode($value);
} elseif ($value !== FALSE) {
$response->headers->set($header_names[$name_lower], $value);
}
}
}
}
示例13: BaseBuildingBlocks_preprocess_page
/**
* Implimenting hook_process_page
* Allows you to use node-type based page templates.
* Adds admininstration menu
*/
function BaseBuildingBlocks_preprocess_page(&$vars)
{
global $user;
global $base_url;
//Allows you to use node-type, and node ID base page templates
//Adds custom 404 error page template
if (!empty($vars['node'])) {
$vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
$vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->vid;
} elseif (drupal_get_http_header('status')) {
$vars['theme_hook_suggestions'][] = 'page__404';
}
//Construct the Management Menu
if (theme_get_setting('admin_menu_on_off') == 1 && in_array('administrator', array_values($user->roles))) {
//Get the management menu from the drupal menu system, construct menu
$vars['admin_menu_expanded'] = BaseBuildingBlocks_build_navbar('management');
}
}
示例14: manis_preprocess_page
function manis_preprocess_page(&$vars)
{
if (isset($vars['node'])) {
$vars['theme_hook_suggestions'][] = 'page__' . $vars['node']->type;
}
//404 page
$status = drupal_get_http_header("status");
if ($status == "404 Not Found") {
$vars['theme_hook_suggestions'][] = 'page__404';
}
//Taxonomy page
if (arg(0) == 'taxonomy') {
$vars['theme_hook_suggestions'][] = 'page__taxonomy';
}
//View template
if (views_get_page_view()) {
$vars['theme_hook_suggestions'][] = 'page__view';
}
drupal_add_js('jQuery.extend(Drupal.settings, { "pathToTheme": "' . base_path() . path_to_theme() . '" });', 'inline');
}
示例15: start_html_head_alter
/**
* Fix for SEO
*/
function start_html_head_alter(&$head_elements)
{
// Unset canonical metatag from 404 pages
$status = drupal_get_http_header("status");
if ($status === '404 Not Found') {
if (isset($head_elements['metatag_canonical'])) {
unset($head_elements['metatag_canonical']);
}
}
// Unset Short link metatag
if (isset($head_elements['metatag_shortlink'])) {
unset($head_elements['metatag_shortlink']);
}
// Fix canonical metatag for Frontpage
if (drupal_is_front_page()) {
if (isset($head_elements['metatag_canonical'])) {
$head_elements['metatag_canonical']['#value'] = '/';
}
}
}