当前位置: 首页>>代码示例>>PHP>>正文


PHP drupal_add_http_header函数代码示例

本文整理汇总了PHP中drupal_add_http_header函数的典型用法代码示例。如果您正苦于以下问题:PHP drupal_add_http_header函数的具体用法?PHP drupal_add_http_header怎么用?PHP drupal_add_http_header使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了drupal_add_http_header函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: gd_dashboard_admin_page_edit

/**
 * @param $dashboardId
 * @return array
 */
function gd_dashboard_admin_page_edit ( $dashboardId ) {
    $dashboardNode = gd_dashboard_load($dashboardId);
    if ( !$dashboardNode ) {
        return MENU_NOT_FOUND;
    }

    gd_datasource_set_active(get_node_field_value($dashboardNode,'field_dashboard_datasource'));

    if ( !gd_account_user_is_admin() && !gd_account_user_is_datasource_admin(null,gd_datasource_get_active()) ) {
        return MENU_ACCESS_DENIED;
    }

    drupal_add_library('gd_dashboard_admin', 'GD_Admin_DashboardSection_Builder');
    drupal_add_js(drupal_get_path('module','gd_dashboard_admin').'/js/builder/button/action/DashboardDeleteButton.js');

    drupal_add_library('gd','datatables');
    drupal_add_library('gd','highcharts');
    drupal_add_js('sites/all/libraries/sparkline/jquery.sparkline.min.js');

    $options = array('fields'=>array('filters','drilldowns','reports','css'));
    $dashboard = gd_dashboard_create_api_object_from_node($dashboardNode,$options);

    drupal_add_http_header('Cache-Control','no-cache, max-age=0, must-revalidate, no-store');

    return gd_dashboard_admin_page($dashboard);
}
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:30,代码来源:gd_dashboard_admin.pages.php

示例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');
}
开发者ID:kreynen,项目名称:elmsln,代码行数:32,代码来源:template.php

示例3: sendResponseHeaders

 public function sendResponseHeaders()
 {
     $default_headers = array('Expires' => 'Sun, 19 Nov 1978 05:00:00 GMT', 'Last-Modified' => gmdate(DATE_RFC1123, REQUEST_TIME), 'Cache-Control' => 'no-cache, must-revalidate, post-check=0, pre-check=0', 'ETag' => '"' . REQUEST_TIME . '"');
     foreach ($default_headers as $name => $value) {
         drupal_add_http_header($name, $value);
     }
 }
开发者ID:bangpound,项目名称:drupal-bridge,代码行数:7,代码来源:HeaderListener.php

示例4: authorize_access_denied_page

/**
 * Render a 403 access denied page for authorize.php
 */
function authorize_access_denied_page()
{
    drupal_add_http_header('Status', '403 Forbidden');
    watchdog('access denied', 'authorize.php', NULL, WATCHDOG_WARNING);
    drupal_set_title('Access denied');
    return t('You are not allowed to access this page.');
}
开发者ID:aslakhellesoy,项目名称:drupal,代码行数:10,代码来源:authorize.php

示例5: churchcore__filedownload

/**
 * Return an CT file for download
 */
function churchcore__filedownload()
{
    global $files_dir;
    include_once CHURCHCORE . "/churchcore_db.php";
    $mime_types = getMimeTypes();
    $file = db_query("select * from {cc_file} f where f.id=:id and filename=:filename", array(":id" => $_GET["id"], ":filename" => $_GET["filename"]))->fetch();
    $filename = "{$files_dir}/files/{$file->domain_type}/{$file->domain_id}/{$file->filename}";
    $handle = fopen($filename, "rb");
    if ($handle == false) {
        echo "Die Datei konnte nicht gefunden werden!";
    } else {
        $contents = fread($handle, filesize($filename));
        fclose($handle);
        if (isset($mime_types[substr(strrchr($filename, '.'), 1)])) {
            drupal_add_http_header('Content-Type', $mime_types[substr(strrchr($filename, '.'), 1)], false);
        } else {
            drupal_add_http_header('Content-Type', 'application/unknown', false);
        }
        if (isset($_GET["type"]) && $_GET["type"] == "download") {
            drupal_add_http_header('Content-Disposition', 'attachment;filename="' . $file->bezeichnung . '"', false);
        } else {
            drupal_add_http_header('Content-Disposition', 'inline;filename="' . $file->bezeichnung . '"', false);
        }
        drupal_add_http_header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', false);
        drupal_add_http_header('Cache-Control', 'private', true);
        $content = drupal_get_header();
        echo $contents;
    }
}
开发者ID:lhaselauer,项目名称:churchtools_basic,代码行数:32,代码来源:churchcore.php

示例6: churchcore__filedownload

/**
 * Return a CT file for download
 */
function churchcore__filedownload()
{
    global $files_dir;
    include_once CHURCHCORE . "/churchcore_db.php";
    $mime_types = getMimeTypes();
    $file = db_query("SELECT * FROM {cc_file} f\n                    WHERE f.id=:id AND filename=:filename", array(":id" => getVar("id"), ":filename" => getVar("filename")))->fetch();
    if (preg_match('/^[0-9a-f]{64}$/i', $file->filename)) {
        $filename = "{$files_dir}/blobs/{$file->filename}";
    } else {
        $filename = "{$files_dir}/files/{$file->domain_type}/{$file->domain_id}/{$file->filename}";
    }
    //open file for binary read
    $handle = fopen($filename, "rb");
    if ($handle === false) {
        echo "Die Datei konnte nicht gelesen werden!";
    } else {
        if (isset($mime_types[substr(strrchr($file->bezeichnung, '.'), 1)])) {
            drupal_add_http_header('Content-Type', $mime_types[substr(strrchr($filename, '.'), 1)], false);
        } else {
            drupal_add_http_header('Content-Type', 'application/unknown', false);
        }
        if (getVar("type") == "download") {
            drupal_add_http_header('Content-Disposition', 'attachment;filename="' . $file->bezeichnung . '"', false);
        } else {
            drupal_add_http_header('Content-Disposition', 'inline;filename="' . $file->bezeichnung . '"', false);
        }
        drupal_add_http_header('Cache-Control', 'private', true);
        //disable output buffer and delete contents
        ob_end_clean();
        //steam all data to apache output buffer
        fpassthru($handle);
        //close file handle
        fclose($handle);
    }
}
开发者ID:toXel,项目名称:churchtools_basic,代码行数:38,代码来源:churchcore.php

示例7: suitcase_preprocess_html

function suitcase_preprocess_html(&$vars)
{
    //  ISU Bar responsive classes added to body
    $vars['attributes_array']['class'][] = 'responsive';
    $vars['attributes_array']['class'][] = 'wd-show-sidebar';
    // Drupal 7 in hook_preprocess_html()
    drupal_add_http_header('X-UA-Compatible', 'IE=edge,chrome=1');
}
开发者ID:rlfrahm,项目名称:suitcase,代码行数:8,代码来源:template.php

示例8: get_output

 /**
  *  @method:
  *    Public method that is used to get the output based on the request
  */
 public function get_output()
 {
     $break_cache = isset($_GET['break_cache']) ? $_GET['break_cache'] : FALSE;
     //only cache if break_cache is not set
     if (!$break_cache) {
         $cached = $this->_cache();
     }
     //default variables
     $this->_load_project_node();
     $contents = $this->_load_project_contents();
     $this->nodes = $contents;
     $this->_parse_nodes($this->nodes);
     $this->nodes = $contents;
     //switches based on the format requested
     switch ($this->format) {
         case 'xml':
             drupal_add_http_header('Content-Type', 'application/xml; charset=utf-8');
             if (empty($cached)) {
                 $data = $this->_array_to_xml($this);
             } else {
                 $data = $cached;
             }
             break;
         default:
             drupal_add_http_header('Content-Type', 'application/json');
             if (empty($cached)) {
                 $data = $this->_array_to_json($this);
             } else {
                 $data = $cached;
             }
             break;
     }
     //adds data into the cache
     if (empty($cached)) {
         $data = json_decode(json_encode($data), true);
         $this->_cache('set', $data);
     }
     //download the files once the parameter is set
     if (isset($_GET['download']) && $_GET['download']) {
         //generates the download portion once download is required
         $file_path = $this->_download_project($data);
         $filename = explode('/', $file_path);
         $filename = $filename[count($filename) - 1];
         //sets all the headers for the download to work
         header("Pragma: public");
         header("Expires: 0");
         header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
         header("Cache-Control: private", false);
         // required for certain browsers
         header('Content-Disposition: attachment; filename="' . $filename . '"');
         header("Content-Transfer-Encoding: binary");
         header("Content-Length: " . filesize($file_path));
         readfile("{$file_path}");
     }
     $output = $data;
     return $output;
 }
开发者ID:OpenTechStrategies,项目名称:GettyScholarsWorkspace,代码行数:61,代码来源:getty_expose_project.class.php

示例9: post

 /**
  * Processes a payment POST from the CyberSource Hosted Order Page API.
  */
 public static function post()
 {
     if (!uc_cybersource_hop_include()) {
         \Drupal::logger('uc_cybersource_hop')->error('Unable to receive HOP POST due to missing or unreadable HOP.php file.');
         drupal_add_http_header('Status', '503 Service unavailable');
         print $this->t('The site was unable to receive a HOP post because of a missing or unreadble HOP.php');
         exit;
     }
     $verify = VerifyTransactionSignature($_POST);
     \Drupal::logger('uc_cybersource_hop')->notice('Receiving payment notification at URL for order @orderNumber', array('@orderNumber' => $_POST['orderNumber']));
     if (!isset($_POST['orderNumber'])) {
         \Drupal::logger('uc_cybersource_hop')->error('CS HOP attempted with invalid order number.');
         return;
     }
     if (!$verify) {
         \Drupal::logger('uc_cybersource_hop')->notice('Receiving invalid payment notification at URL for order @orderNumber. <pre>@debug</pre>', array('@orderNumber' => $_POST['orderNumber'], '@debug' => print_r($_POST, TRUE)));
         return;
     }
     // Assign posted variables to local variables.
     $decision = SafeMarkup::checkPlain($_POST['decision']);
     $reason_code = SafeMarkup::checkPlain($_POST['reasonCode']);
     $reason = _parse_cs_reason_code($reason_code);
     $payment_amount = SafeMarkup::checkPlain($_POST['orderAmount']);
     $payment_currency = SafeMarkup::checkPlain($_POST['paymentCurrency']);
     $request_id = SafeMarkup::checkPlain($_POST['requestID']);
     $request_token = SafeMarkup::checkPlain($_POST['orderPage_requestToken']);
     $reconciliation_id = SafeMarkup::checkPlain($_POST['reconciliationID']);
     $order_id = SafeMarkup::checkPlain($_POST['orderNumber']);
     $payer_email = SafeMarkup::checkPlain($_POST['billTo_email']);
     $order = Order::load($_POST['orderNumber']);
     switch ($decision) {
         case 'ACCEPT':
             \Drupal::logger('uc_cybersource_hop')->notice('CyberSource verified successful payment.');
             $duplicate = (bool) db_query_range('SELECT 1 FROM {uc_payment_cybersource_hop_post} WHERE order_id = :order_id AND decision = :decision', 0, 1, array(':order_id' => $order_id, ':decision' => 'ACCEPT'))->fetchField();
             if ($duplicate) {
                 \Drupal::logger('uc_cybersource_hop')->notice('CS HOP transaction for order @order-id has been processed before.', array('@order_id' => $order_id));
                 return;
             }
             db_insert('uc_payment_cybersource_hop_post')->fields(array('order_id' => $order_id, 'request_id' => $request_id, 'request_token' => $request_token, 'reconciliation_id' => $reconciliation_id, 'gross' => $payment_amount, 'decision' => $decision, 'reason_code' => $reason_code, 'payer_email' => $payer_email, 'received' => REQUEST_TIME))->execute();
             $comment = $this->t('CyberSource request ID: @txn_id', array('@txn_id' => $request_id));
             uc_payment_enter($order_id, 'cybersource_hop', $payment_amount, $order->getUserId(), NULL, $comment);
             uc_cart_complete_sale($order);
             uc_order_comment_save($order_id, 0, $this->t('Payment of @amount @currency submitted through CyberSource with request ID @rid.', array('@amount' => $payment_amount, '@currency' => $payment_currency, '@rid' => $request_id)), 'order', 'payment_received');
             break;
         case 'ERROR':
             uc_order_comment_save($order_id, 0, $this->t("Payment error:@reason with request ID @rid", array('@reason' => $reason, '@rid' => '@request_id')), 'admin');
             break;
         case 'REJECT':
             uc_order_comment_save($order_id, 0, $this->t("Payment is rejected:@reason with request ID @rid", array('@reason' => $reason, '@rid' => '@request_id')), 'admin');
             break;
         case 'REVIEW':
             $order->setStatusId('review')->save();
             uc_order_comment_save($order_id, 0, $this->t('Payment is in review & not complete: @reason. Request ID @rid', array('@reason' => $reason, '@rid' => '@request_id')), 'admin');
             break;
     }
 }
开发者ID:pedrocones,项目名称:hydrotools,代码行数:59,代码来源:HOPController.php

示例10: getPayload

 /**
  * jsonp payload wrapper
  *
  * prepend jsonp callbacks with a comment to prevent the rosetta-flash vulnerability
  */
 public static function getPayload ( $data, $callback = null ) {
     if ( !isset($callback) ) {
         drupal_add_http_header('Content-Type', 'application/json');
         return json_encode($data);
     } else {
         drupal_add_http_header('Content-Type', 'text/javascript');
         drupal_add_http_header('X-Content-Type-Options', 'nosniff');
         return '/**/'.$callback.'('.json_encode($data).');';
     }
 }
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:15,代码来源:Json.php

示例11: content

 /**
  * {@inheritdoc}
  */
 public function content(Request $request)
 {
     $token = $request->get('token');
     // Get the font from the given font token.
     if ($token == 'BUILTIN') {
         $font = 'BUILTIN';
     } else {
         // Get the mapping of font tokens to font file objects.
         $fonts = \Drupal::config('image_captcha.settings')->get('image_captcha_fonts_preview_map_cache');
         $config = \Drupal::config('captcha.settings');
         $fonts = $config->get('image_captcha_fonts_preview_map_cache');
         if (!isset($fonts[$token])) {
             echo 'bad token';
             exit;
         }
         // Get the font path.
         $font = $fonts[$token]->uri;
         // Some sanity checks if the given font is valid.
         if (!is_file($font) || !is_readable($font)) {
             echo 'bad font';
             exit;
         }
     }
     // Settings of the font preview.
     $width = 120;
     $text = 'AaBbCc123';
     $font_size = 14;
     $height = 2 * $font_size;
     // Allocate image resource.
     $image = imagecreatetruecolor($width, $height);
     if (!$image) {
         exit;
     }
     // White background and black foreground.
     $background_color = imagecolorallocate($image, 255, 255, 255);
     $color = imagecolorallocate($image, 0, 0, 0);
     imagefilledrectangle($image, 0, 0, $width, $height, $background_color);
     // Draw preview text.
     if ($font == 'BUILTIN') {
         imagestring($image, 5, 1, 0.5 * $height - 10, $text, $color);
     } else {
         imagettftext($image, $font_size, 0, 1, 1.5 * $font_size, $color, realpath($font), $text);
     }
     // Set content type.
     drupal_add_http_header('Content-Type', 'image/png');
     // Dump image data to client.
     imagepng($image);
     // Release image memory.
     imagedestroy($image);
     // Close connection.
     exit;
 }
开发者ID:Wylbur,项目名称:gj,代码行数:55,代码来源:CaptchaFontPreview.php

示例12: system_watchdog

 function system_watchdog($log_entry = array())
 {
     static $logs = array();
     $logs[] = $log_entry;
     $data = urlencode(serialize($logs));
     if (function_exists('drupal_add_http_header')) {
         // Drupal 7
         drupal_add_http_header('X-Runserver-Watchdog', $data);
     } else {
         // Drupal 6
         drupal_set_header('X-Runserver-Watchdog: ' . $data);
     }
 }
开发者ID:redb,项目名称:MNPP,代码行数:13,代码来源:runserver-prepend.php

示例13: innovation_preprocess_html

/**
 * Load Kalatheme dependencies.
 *
 * Implements template_preprocess_html().
 */
function innovation_preprocess_html(&$variables)
{
    // Add theme js file here rather than in .info to add a weight and ensure it loads last
    drupal_add_js(drupal_get_path('theme', 'innovation') . '/js/innovation.js', array('scope' => 'footer', 'group' => JS_THEME, 'weight' => 200));
    // Add IE meta tag to force IE rendering mode
    $meta_ie_render_engine = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('content' => 'IE=edge,chrome=1', 'http-equiv' => 'X-UA-Compatible'));
    drupal_add_html_head($meta_ie_render_engine, 'meta_ie_render_engine');
    // WEBSPARK-189 - add actual HTTP header along with meta tag
    drupal_add_http_header('X-UA-Compatible', 'IE=Edge,chrome=1');
    // Add conditional stylesheets for IE
    drupal_add_css(path_to_theme() . '/css/ie9.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 9', '!IE' => FALSE), 'preprocess' => FALSE));
    drupal_add_css(path_to_theme() . '/css/ie8.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 8', '!IE' => FALSE), 'preprocess' => FALSE));
}
开发者ID:niner9,项目名称:webspark-drops-drupal7,代码行数:18,代码来源:template.php

示例14: deliverRawHtmlPage

 public static function deliverRawHtmlPage($result)
 {
     if (is_int($result)) {
         drupal_deliver_html_page($result);
         return;
     }
     // Emit the correct charset HTTP header, but not if the page callback
     // result is NULL, since that likely indicates that it printed something
     // in which case, no further headers may be sent, and not if code running
     // for this page request has already set the content type header.
     if (isset($result) && is_null(drupal_get_http_header('Content-Type'))) {
         drupal_add_http_header('Content-Type', 'text/html; charset=utf-8');
     }
     // Send appropriate HTTP-Header for browsers and search engines.
     global $language;
     drupal_add_http_header('Content-Language', $language->language);
     if (isset($result)) {
         print render($result);
     }
     drupal_page_footer();
 }
开发者ID:juampynr,项目名称:DrupalCampEs,代码行数:21,代码来源:DeliveryHelper.php

示例15: gd_report_admin_page_edit

/**
 * @param $reportId
 * @return array
 * @throws Exception
 * @throws IllegalArgumentException
 */
function gd_report_admin_page_edit ( $reportId ) {
    $reportNode = gd_report_load($reportId);
    if ( !$reportNode ) {
        return MENU_NOT_FOUND;
    }

    gd_datasource_set_active(get_node_field_value($reportNode,'field_report_datasource'));

    if ( !gd_account_user_is_admin() && !gd_account_user_is_datasource_admin(null,gd_datasource_get_active()) ) {
        return MENU_ACCESS_DENIED;
    }

    drupal_add_library('gd_report_admin', 'GD_Admin_ReportSection_Builder');

    $options = array('fields' => array('datasource', 'config', 'filters', 'data', 'customview', 'tags'));
    $report = gd_report_create_api_object_from_node($reportNode,$options);

    $reportDataset = gd_data_controller_ui_metadata_get_dataset_ui_metadata($report->config->model->datasets[0],array_slice($report->config->model->datasets,1));

    drupal_add_http_header('Cache-Control','no-cache, max-age=0, must-revalidate, no-store');

    return gd_report_admin_page($report,$reportDataset);
}
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:29,代码来源:gd_report_admin.pages.php


注:本文中的drupal_add_http_header函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。