Ejemplo n.º 1
0
function phptemplate_preprocess(&$vars, $hook)
{
    if ($hook == 'page') {
        // Add a 'page-node' class if this is a node that is rendered as page
        if (isset($vars['node']) && $vars['node']->type) {
            $vars['body_classes'] .= ' page-node';
        }
        // Add Feed icon
        $array_q = explode('/', $_GET['q']);
        if ($array_q[0] == 'blog') {
            drupal_add_feed(url('blog/rss.xml', array('absolute' => TRUE)));
        } elseif ($array_q[0] == 'projects') {
            drupal_add_feed(url('projects/rss.xml', array('absolute' => TRUE)));
        } elseif ($array_q[0] == '字') {
            drupal_add_feed(url('字/rss.xml', array('absolute' => TRUE)));
        } else {
            drupal_add_feed(url('rss.xml', array('absolute' => TRUE)));
        }
        $vars['head'] = drupal_get_html_head();
        // Refresh $head variable
        $vars['feed_icons'] = drupal_get_feeds();
        // Refresh $feed_icons variable
    }
    // Replace funny chinese characters in section name
    //$vars['body_classes'] = str_replace('-e6-bc-a2-e5-ad-97-e6-84-9f-e3-81-98', 'kanjikanji', $vars['body_classes']);
}
Ejemplo n.º 2
0
/**
 * Image assist module support.
 */
function lotusPD_img_assist_page($content, $attributes = NULL)
{
    $title = drupal_get_title();
    $output = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
    $output .= '<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">' . "\n";
    $output .= "<head>\n";
    $output .= '<title>' . $title . "</title>\n";
    // Note on CSS files from Benjamin Shell:
    // Stylesheets are a problem with image assist. Image assist works great as a
    // TinyMCE plugin, so I want it to LOOK like a TinyMCE plugin. However, it's
    // not always a TinyMCE plugin, so then it should like a themed Drupal page.
    // Advanced users will be able to customize everything, even TinyMCE, so I'm
    // more concerned about everyone else. TinyMCE looks great out-of-the-box so I
    // want image assist to look great as well. My solution to this problem is as
    // follows:
    // If this image assist window was loaded from TinyMCE, then include the
    // TinyMCE popups_css file (configurable with the initialization string on the
    // page that loaded TinyMCE). Otherwise, load drupal.css and the theme's
    // styles. This still leaves out sites that allow users to use the TinyMCE
    // plugin AND the Add Image link (visibility of this link is now a setting).
    // However, on my site I turned off the text link since I use TinyMCE. I think
    // it would confuse users to have an Add Images link AND a button on the
    // TinyMCE toolbar.
    //
    // Note that in both cases the img_assist.css file is loaded last. This
    // provides a way to make style changes to img_assist independently of how it
    // was loaded.
    $output .= drupal_get_html_head();
    $output .= drupal_get_js();
    $output .= "\n<script type=\"text/javascript\"><!-- \n";
    $output .= "  if (parent.tinyMCE && parent.tinyMCEPopup && parent.tinyMCEPopup.getParam('popups_css')) {\n";
    $output .= "    document.write('<link href=\"' + parent.tinyMCEPopup.getParam('popups_css') + '\" rel=\"stylesheet\" type=\"text/css\">');\n";
    $output .= "  } else {\n";
    foreach (drupal_add_css() as $media => $type) {
        $paths = array_merge($type['module'], $type['theme']);
        foreach (array_keys($paths) as $path) {
            // Don't import img_assist.css twice.
            if (!strstr($path, 'img_assist.css')) {
                $output .= "  document.write('<style type=\"text/css\" media=\"{$media}\">@import \"" . base_path() . $path . "\";<\\/style>');\n";
            }
        }
    }
    $output .= "  }\n";
    $output .= "--></script>\n";
    // Ensure that img_assist.js is imported last.
    $path = drupal_get_path('module', 'img_assist') . '/img_assist_popup.css';
    $output .= "<style type=\"text/css\" media=\"all\">@import \"" . base_path() . $path . "\";</style>\n";
    $output .= '<!--[if IE 6]><link rel="stylesheet" href="' . get_full_path_to_theme() . '/style.ie6.css" type="text/css" /><![endif]-->' . "\n";
    $output .= '<!--[if IE 7]><link rel="stylesheet" href="' . get_full_path_to_theme() . '/style.ie7.css" type="text/css" /><![endif]-->' . "\n";
    $output .= "</head>\n";
    $output .= '<body' . drupal_attributes($attributes) . ">\n";
    $output .= theme_status_messages();
    $output .= "\n";
    $output .= $content;
    $output .= "\n";
    $output .= '</body>';
    $output .= '</html>';
    return $output;
}
Ejemplo n.º 3
0
function instant_indicia_preprocess_page(&$variables)
{
    // Check path to determine widget pages
    $pathargs = explode('/', drupal_get_path_alias($_GET['q']));
    if ($pathargs[0] == 'external' || !empty($_GET['external']) && $_GET['external'] === 't') {
        // Use template: page__widgets
        $variables['template_file'] = 'page-iframe';
    } elseif ($pathargs[0] == 'popup' || !empty($_GET['popup']) && $_GET['popup'] === 't') {
        // Use template: page__widgets
        $variables['template_file'] = 'page-popup';
    }
    drupal_set_html_head('<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">');
    $variables['head'] = drupal_get_html_head();
}
Ejemplo n.º 4
0
 /**
  * Tests attaching feeds with paths, URLs, and titles.
  */
 function testBasicFeedAddNoTitle()
 {
     $path = $this->randomMachineName(12);
     $external_url = 'http://' . $this->randomMachineName(12) . '/' . $this->randomMachineName(12);
     $fully_qualified_local_url = Url::fromUri('base:' . $this->randomMachineName(12), array('absolute' => TRUE))->toString();
     $path_for_title = $this->randomMachineName(12);
     $external_for_title = 'http://' . $this->randomMachineName(12) . '/' . $this->randomMachineName(12);
     $fully_qualified_for_title = Url::fromUri('base:' . $this->randomMachineName(12), array('absolute' => TRUE))->toString();
     $urls = array('path without title' => array('url' => Url::fromUri('base:' . $path, array('absolute' => TRUE))->toString(), 'title' => ''), 'external URL without title' => array('url' => $external_url, 'title' => ''), 'local URL without title' => array('url' => $fully_qualified_local_url, 'title' => ''), 'path with title' => array('url' => Url::fromUri('base:' . $path_for_title, array('absolute' => TRUE))->toString(), 'title' => $this->randomMachineName(12)), 'external URL with title' => array('url' => $external_for_title, 'title' => $this->randomMachineName(12)), 'local URL with title' => array('url' => $fully_qualified_for_title, 'title' => $this->randomMachineName(12)));
     $build = [];
     foreach ($urls as $feed_info) {
         $build['#attached']['feed'][] = [$feed_info['url'], $feed_info['title']];
     }
     drupal_process_attached($build);
     $this->setRawContent(drupal_get_html_head());
     foreach ($urls as $description => $feed_info) {
         $this->assertPattern($this->urlToRSSLinkPattern($feed_info['url'], $feed_info['title']), format_string('Found correct feed header for %description', array('%description' => $description)));
     }
 }
Ejemplo n.º 5
0
function navin_process_maintenance_page(&$variables)
{
    // Include @font-your-face support
    if (module_exists('fontyourface')) {
        fontyourface_preprocess_page($variables);
        $fonts = (array) $variables['fontyourface'];
        foreach ($fonts as $font) {
            if (module_hook($font->provider, 'preprocess_page')) {
                call_user_func_array($font->provider . '_preprocess_page', array(&$variables));
            }
        }
    }
    // Add theme's maintenance CSS
    drupal_add_css(path_to_theme() . '/css/maintenance.css', array('group' => CSS_THEME, 'weight' => 10));
    // Reset variables
    $variables['head'] = drupal_get_html_head();
    $variables['css'] = drupal_add_css();
    $variables['styles'] = drupal_get_css();
    $variables['scripts'] = drupal_get_js();
}
Ejemplo n.º 6
0
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php 
print $GLOBALS['language']->language;
?>
" xml:lang="<?php 
print $GLOBALS['language']->language;
?>
">
<head>
  <title><?php 
print t('File Browser');
?>
</title>
  <?php 
print drupal_get_html_head();
print elfinder_browser_css();
print elfinder_browser_js();
?>
</head>
<body class="elfinder">
<div id="elfinder-messages"><?php 
print theme('status_messages');
?>
</div>
<div id="finder"></div>
<?php 
print drupal_get_js('footer');
?>
</body>
</html>
Ejemplo n.º 7
0
/**
 * Overrides template_process_html().
 */
function omega_template_process_html_override(&$variables)
{
    // Render page_top and page_bottom into top level variables.
    $variables['page_top'] = drupal_render($variables['page']['page_top']);
    $variables['page_bottom'] = drupal_render($variables['page']['page_bottom']);
    // Place the rendered HTML for the page body into a top level variable.
    $variables['page'] = $variables['page']['#children'];
    $variables['page_bottom'] .= omega_get_js('footer');
    $variables['head'] = drupal_get_html_head();
    $variables['css'] = drupal_add_css();
    $variables['styles'] = drupal_get_css();
    $variables['scripts'] = omega_get_js();
}
Ejemplo n.º 8
0
function phptemplate_maintenance_page($content, $messages = TRUE, $partial = FALSE)
{
    drupal_set_header('Content-Type: text/html; charset=utf-8');
    //drupal_set_html_head('<style type="text/css" media="all">@import "'. base_path() .'misc/maintenance.css";</style>');
    drupal_set_html_head('<style type="text/css" media="all">@import "' . base_path() . drupal_get_path('theme', 'newsflash') . '/maintenance.css";</style>');
    drupal_set_html_head('<style type="text/css" media="all">@import "' . base_path() . drupal_get_path('module', 'system') . '/defaults.css";</style>');
    drupal_set_html_head('<style type="text/css" media="all">@import "' . base_path() . drupal_get_path('module', 'system') . '/system.css";</style>');
    //drupal_set_html_head('<style type="text/css" media="all">@import "'. base_path() . drupal_get_path('theme', 'newsflash') .'/style.css";</style>');
    drupal_set_html_head('<link rel="shortcut icon" href="' . base_path() . 'misc/favicon.ico" type="image/x-icon" />');
    $output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
    $output .= '<html xmlns="http://www.w3.org/1999/xhtml">';
    $output .= '<head>';
    $output .= '<title>Tribute Media</title>';
    $output .= drupal_get_html_head();
    $output .= drupal_get_js();
    $output .= '</head>';
    $output .= '<body>';
    $output .= '<div class="logo"><img src="' . drupal_get_path('theme', 'newsflash') . '/images/tribute_comingsoon.png" id="logo"/></div>';
    //$output .= '<h1 id="title">' . drupal_get_title() . '</h1>';
    if ($messages) {
        $output .= theme('status_messages');
    }
    $output .= "\n<!-- begin content -->\n";
    //$output .= $content;
    $output .= "\n<!-- end content -->\n";
    if (!$partial) {
        $output .= '</body></html>';
    }
    return $output;
}
Ejemplo n.º 9
0
function drupal_13584_img_assist_page($content, $attributes = NULL)
{
    $title = drupal_get_title();
    $output = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
    $output .= '<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">' . "\n";
    $output .= "<head>\n";
    $output .= '<title>' . $title . "</title>\n";
    $output .= drupal_get_html_head();
    $output .= drupal_get_js();
    $output .= "\n<script type=\"text/javascript\"><!-- \n";
    $output .= "  if (parent.tinyMCE && parent.tinyMCEPopup && parent.tinyMCEPopup.getParam('popups_css')) {\n";
    $output .= "    document.write('<link href=\"' + parent.tinyMCEPopup.getParam('popups_css') + '\" rel=\"stylesheet\" type=\"text/css\">');\n";
    $output .= "  } else {\n";
    foreach (drupal_add_css() as $media => $type) {
        $paths = array_merge($type['module'], $type['theme']);
        foreach (array_keys($paths) as $path) {
            if (!strstr($path, 'img_assist.css')) {
                $output .= "  document.write('<style type=\"text/css\" media=\"{$media}\">@import \"" . base_path() . $path . "\";<\\/style>');\n";
            }
        }
    }
    $output .= "  }\n";
    $output .= "--></script>\n";
    $path = drupal_get_path('module', 'img_assist') . '/img_assist_popup.css';
    $output .= "<style type=\"text/css\" media=\"all\">@import \"" . base_path() . $path . "\";</style>\n";
    $output .= '<link rel="stylesheet" href="' . get_full_path_to_theme() . '/style.css" type="text/css" />' . "\n";
    $output .= '<!--[if IE 6]><link rel="stylesheet" href="' . get_full_path_to_theme() . '/style.ie6.css" type="text/css" /><![endif]-->' . "\n";
    $output .= '<!--[if IE 7]><link rel="stylesheet" href="' . get_full_path_to_theme() . '/style.ie7.css" type="text/css" /><![endif]-->' . "\n";
    $output .= "</head>\n";
    $output .= '<body' . drupal_attributes($attributes) . ">\n";
    $output .= theme_status_messages();
    $output .= "\n";
    $output .= $content;
    $output .= "\n";
    $output .= '</body>';
    $output .= '</html>';
    return $output;
}
Ejemplo n.º 10
0
" xml:lang="<?php 
print $language->language;
?>
" dir="<?php 
print $language->dir;
?>
">
<head>
<title><?php 
print $head_title;
?>
</title>
<?php 
drupal_add_feed('http://feeds.feedburner.com/pandionblog', t('Pandion Blog'));
drupal_add_feed('http://twitter.com/statuses/user_timeline/pandion.rss', t('Pandion Tweets'));
$head = drupal_get_html_head();
print $head;
print $styles;
$js = drupal_add_js('misc/jquery.js', 'core', 'header');
print drupal_get_js('header', $js);
?>
<!--[if lt IE 7]>
	<script type="text/javascript" src="js/unitpngfix.js"></script>
<![endif]--> 
</head>
<body>

<?php 
// print($site_name)
// print($site_title)
// print($site_slogan)
 /**
  * {@inheritdoc}
  */
 public function processAttachments(AttachmentsInterface $response)
 {
     // @todo Convert to assertion once https://www.drupal.org/node/2408013 lands
     if (!$response instanceof HtmlResponse) {
         throw new \InvalidArgumentException('\\Drupal\\Core\\Render\\HtmlResponse instance expected.');
     }
     $attached = $response->getAttachments();
     // Get the placeholders from attached and then remove them.
     $placeholders = $attached['html_response_placeholders'];
     unset($attached['html_response_placeholders']);
     $variables = $this->processAssetLibraries($attached, $placeholders);
     // Handle all non-asset attachments. This populates drupal_get_html_head()
     // and drupal_get_http_header().
     $all_attached = ['#attached' => $attached];
     drupal_process_attached($all_attached);
     // Get HTML head elements - if present.
     if (isset($placeholders['head'])) {
         $variables['head'] = drupal_get_html_head(FALSE);
     }
     // Now replace the placeholders in the response content with the real data.
     $this->renderPlaceholders($response, $placeholders, $variables);
     // Finally set the headers on the response.
     $headers = drupal_get_http_header();
     $this->setHeaders($response, $headers);
     return $response;
 }
 /**
  * {@inheritdoc}
  */
 public function processAttachments(AttachmentsInterface $response)
 {
     // @todo Convert to assertion once https://www.drupal.org/node/2408013 lands
     if (!$response instanceof HtmlResponse) {
         throw new \InvalidArgumentException('\\Drupal\\Core\\Render\\HtmlResponse instance expected.');
     }
     // First, render the actual placeholders; this may cause additional
     // attachments to be added to the response, which the attachment
     // placeholders rendered by renderHtmlResponseAttachmentPlaceholders() will
     // need to include.
     //
     // @todo Exceptions should not be used for code flow control. However, the
     //   Form API does not integrate with the HTTP Kernel based architecture of
     //   Drupal 8. In order to resolve this issue properly it is necessary to
     //   completely separate form submission from rendering.
     //   @see https://www.drupal.org/node/2367555
     try {
         $response = $this->renderPlaceholders($response);
     } catch (EnforcedResponseException $e) {
         return $e->getResponse();
     }
     $attached = $response->getAttachments();
     // Get the placeholders from attached and then remove them.
     $attachment_placeholders = $attached['html_response_attachment_placeholders'];
     unset($attached['html_response_attachment_placeholders']);
     $variables = $this->processAssetLibraries($attached, $attachment_placeholders);
     // Handle all non-asset attachments. This populates drupal_get_html_head().
     $all_attached = ['#attached' => $attached];
     drupal_process_attached($all_attached);
     // Get HTML head elements - if present.
     if (isset($attachment_placeholders['head'])) {
         $variables['head'] = drupal_get_html_head(FALSE);
     }
     // Now replace the attachment placeholders.
     $this->renderHtmlResponseAttachmentPlaceholders($response, $attachment_placeholders, $variables);
     // Finally set the headers on the response if any bubbled.
     if (!empty($attached['http_header'])) {
         $this->setHeaders($response, $attached['http_header']);
     }
     return $response;
 }
Ejemplo n.º 13
0
 function test_foundation_utf8_charset()
 {
     $headers = drupal_get_html_head();
     $this->assertContains('<meta charset="utf-8" />', $headers, "utf-8 charset not found");
 }
Ejemplo n.º 14
0
/**
 ***********************************************************************************
 * Preprocess page templates
 */
function leggy_preprocess(&$vars, $hook)
{
    if ($hook == 'page') {
        // Add a 'page-node' class if this is a node that is rendered as page
        if (isset($vars['node']) && $vars['node']->type) {
            $vars['body_classes'] .= ' page-node';
        }
        // remove 'Notification settings' tab from user page
        $array_q = explode('/', $_REQUEST['q']);
        if ($array_q[0] == 'user') {
            _leggy_removetab('Notification settings', $vars);
            _leggy_removetab('Track', $vars);
        }
        // Add Feed icon
        if ($array_q[0] == 'geek') {
            drupal_add_feed(url('geek/feed', array('absolute' => TRUE)), 'VictoriaC RSS | Geek');
        } elseif ($array_q[0] == 'life') {
            drupal_add_feed(url('life/feed', array('absolute' => TRUE)), 'VictoriaC RSS | Life');
        } elseif ($array_q[0] == 'today') {
            drupal_add_feed(url('today/feed', array('absolute' => TRUE)), 'VictoriaC RSS | Today');
        } elseif ($array_q[0] == '漢字感じ') {
            drupal_add_feed(url('漢字感じ/feed', array('absolute' => TRUE)), 'VictoriaC RSS | 漢字感じ');
        } else {
            drupal_add_feed(url('feed', array('absolute' => TRUE)), 'VictoriaC RSS | All');
        }
        $vars['head'] = drupal_get_html_head();
        // Refresh $head variable
        $vars['feed_icons'] = drupal_get_feeds();
        // Refresh $feed_icons variable
    }
    // Replace funny kanji characters in section name
    $vars['body_classes'] = str_replace('-e6-bc-a2-e5-ad-97-e6-84-9f-e3-81-98', 'kanjikanji', $vars['body_classes']);
}
 /**
  * {@inheritdoc}
  */
 public function processAttachments(AttachmentsInterface $response)
 {
     // @todo Convert to assertion once https://www.drupal.org/node/2408013 lands
     if (!$response instanceof HtmlResponse) {
         throw new \InvalidArgumentException('\\Drupal\\Core\\Render\\HtmlResponse instance expected.');
     }
     // First, render the actual placeholders; this may cause additional
     // attachments to be added to the response, which the attachment
     // placeholders rendered by renderHtmlResponseAttachmentPlaceholders() will
     // need to include.
     $response = $this->renderPlaceholders($response);
     $attached = $response->getAttachments();
     // Get the placeholders from attached and then remove them.
     $attachment_placeholders = $attached['html_response_attachment_placeholders'];
     unset($attached['html_response_attachment_placeholders']);
     $variables = $this->processAssetLibraries($attached, $attachment_placeholders);
     // Handle all non-asset attachments. This populates drupal_get_html_head().
     $all_attached = ['#attached' => $attached];
     drupal_process_attached($all_attached);
     // Get HTML head elements - if present.
     if (isset($attachment_placeholders['head'])) {
         $variables['head'] = drupal_get_html_head(FALSE);
     }
     // Now replace the attachment placeholders.
     $this->renderHtmlResponseAttachmentPlaceholders($response, $attachment_placeholders, $variables);
     // Finally set the headers on the response if any bubbled.
     if (!empty($attached['http_header'])) {
         $this->setHeaders($response, $attached['http_header']);
     }
     return $response;
 }
Ejemplo n.º 16
0
/**
 * Prepares variables for certificate-certificate.tpl.php
 */
function elearning_preprocess_certificate_certificate(&$variables)
{
    global $base_url, $language;
    // Get basic information.
    $variables['language'] = $language->language;
    $variables['head'] = drupal_get_html_head();
    $variables['base_url'] = $base_url;
    $node = $variables['node'];
    $node_wrapper = entity_metadata_wrapper('node', $node);
    $user = $variables['account'];
    $template = $variables['template'];
    $variables['url'] = $base_url . '/node/' . $node->nid . '/certificate';
    $variables['student_name'] = format_username($user);
    // Get course information.
    $variables['course']['title'] = $node_wrapper->title->raw();
    $credits = credit_calculate($node, $user);
    $grades = course_get_course_grades($node);
    $grade_name = '';
    if ($grades) {
        foreach ($grades as $score => $name) {
            if ($credits >= $score) {
                $grade_name = $name;
            }
        }
    }
    $variables['course']['grade_name'] = $grade_name;
    $variables['course']['grade_score'] = $credits . ' ' . t('(out of !count)', array('!count' => 100));
    $variables['course']['teacher_name'] = $node_wrapper->field_teacher->field_first_name->raw();
    $variables['course']['teacher_surname'] = $node_wrapper->field_teacher->field_surname->raw();
    // Get logo of course provider.
    $logo_file = $node_wrapper->field_provider->field_logo->value() ? $node_wrapper->field_provider->field_logo->file->value() : '';
    $logo_image = !empty($logo_file) ? theme_image_style(array('style_name' => 'provider_logo_certificate', 'path' => $logo_file->uri, 'width' => $logo_file->image_dimensions['width'], 'height' => $logo_file->image_dimensions['height'])) : '';
    $variables['course']['provider_logo'] = !empty($logo_image) ? render($logo_image) : '';
    // Get signature from certificate's template.
    $template_wrapper = entity_metadata_wrapper('node', $template);
    if (isset($template_wrapper->field_signature)) {
        $signature_file = $template_wrapper->field_signature->value();
        $field_signature = !empty($signature_file) ? theme_image_style(array('style_name' => 'certificate_signature', 'path' => $signature_file['uri'], 'width' => $signature_file['image_dimensions']['width'], 'height' => $signature_file['image_dimensions']['height'])) : '';
        $variables['course']['teacher_signature'] = !empty($field_signature) ? render($field_signature) : '';
    }
}