You are here

function brb_process_html in Browser Bouncer (brb) 7

Implementation of hook_preprocess_html().

The script and style will be added for any not supported browser before the page is rendered.

File

./brb.module, line 161
Display a message to let the user knows his/her browser is not supported. This message also offer to the user different browsers that can be used instead.

Code

function brb_process_html(&$variables) {
  global $user;
  if (user_access('browse without warning', $user) == FALSE) {
    $module_path = drupal_get_path('module', 'brb');
    $clean_widget = str_replace(array(
      "\r\n",
      "\n",
      "\r",
      '"',
    ), array(
      "",
      "",
      "",
      '\\"',
    ), brb_widget());

    //$clean_widget = brb_widget();

    /* This is the way around */
    global $base_path;
    $variables['scripts'] .= '
      <!--[if ' . variable_get('brb_ie_conditional', BRB_IE_CONDITIONAL_DEFAULT) . ']>
        <script type="text/javascript">
          var brb = {
            overlay: ' . strtolower(variable_get('brb_overlay', TRUE)) . ',
            title: "' . variable_get('brb_title', BRB_TITLE) . '",
            widget: "' . $clean_widget . '"
          };
        </script>
        <script type="text/javascript" src="' . $base_path . $module_path . '/brb.js"></script>
      <![endif]-->
    ';
  }
}