本文整理汇总了PHP中filter_xss_admin函数的典型用法代码示例。如果您正苦于以下问题:PHP filter_xss_admin函数的具体用法?PHP filter_xss_admin怎么用?PHP filter_xss_admin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了filter_xss_admin函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: garland_preprocess_page
/**
* Override or insert variables into the page template.
*/
function garland_preprocess_page(&$vars)
{
$vars['tabs2'] = menu_secondary_local_tasks();
if (isset($vars['main_menu'])) {
$vars['primary_nav'] = theme('links__system_main_menu', array('links' => $vars['main_menu'], 'attributes' => array('class' => array('links', 'main-menu')), 'heading' => array('text' => t('Main menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
} else {
$vars['primary_nav'] = FALSE;
}
if (isset($vars['secondary_menu'])) {
$vars['secondary_nav'] = theme('links__system_secondary_menu', array('links' => $vars['secondary_menu'], 'attributes' => array('class' => array('links', 'secondary-menu')), 'heading' => array('text' => t('Secondary menu'), 'level' => 'h2', 'class' => array('element-invisible'))));
} else {
$vars['secondary_nav'] = FALSE;
}
// Prepare header.
$site_fields = array();
if (!empty($vars['site_name'])) {
$site_fields[] = check_plain($vars['site_name']);
}
if (!empty($vars['site_slogan'])) {
$site_fields[] = check_plain($vars['site_slogan']);
}
$vars['site_title'] = implode(' ', $site_fields);
if (!empty($site_fields)) {
$site_fields[0] = '<span>' . $site_fields[0] . '</span>';
}
$vars['site_html'] = implode(' ', $site_fields);
// Set a variable for the site name title and logo alt attributes text.
$slogan_text = filter_xss_admin(variable_get('site_slogan', ''));
$site_name_text = filter_xss_admin(variable_get('site_name', 'Drupal'));
$vars['site_name_and_slogan'] = $site_name_text . ' ' . $slogan_text;
}
开发者ID:sdboyer,项目名称:drupal-c2g,代码行数:34,代码来源:template.php
示例2: zen_preprocess_breadcrumb
/**
* Override or insert variables for the breadcrumb theme function.
*
* @param $variables
* An array of variables to pass to the theme function.
* @param $hook
* The name of the theme hook being called ("breadcrumb" in this case).
*
* @see zen_breadcrumb()
*/
function zen_preprocess_breadcrumb(&$variables, $hook)
{
// Define variables for the breadcrumb-related theme settings. This is done
// here so that sub-themes can dynamically change the settings under
// particular conditions in a preprocess function of their own.
$variables['display_breadcrumb'] = check_plain(theme_get_setting('zen_breadcrumb'));
$variables['display_breadcrumb'] = $variables['display_breadcrumb'] == 'yes' || $variables['display_breadcrumb'] == 'admin' && arg(0) == 'admin' ? TRUE : FALSE;
$variables['breadcrumb_separator'] = filter_xss_admin(theme_get_setting('zen_breadcrumb_separator'));
$variables['display_trailing_separator'] = theme_get_setting('zen_breadcrumb_trailing') ? TRUE : FALSE;
// Optionally get rid of the homepage link.
if (!theme_get_setting('zen_breadcrumb_home')) {
array_shift($variables['breadcrumb']);
}
// Add the title of the page to the end of the breadcrumb list.
if (!empty($variables['breadcrumb']) && theme_get_setting('zen_breadcrumb_title')) {
$item = menu_get_item();
if (!empty($item['tab_parent'])) {
// If we are on a non-default tab, use the tab's title.
$variables['breadcrumb'][] = check_plain($item['title']);
} else {
$variables['breadcrumb'][] = drupal_get_title();
}
// Turn off the trailing separator.
$variables['display_trailing_separator'] = FALSE;
}
// Provide a navigational heading to give context for breadcrumb links to
// screen-reader users.
if (empty($variables['title'])) {
$variables['title'] = t('You are here');
}
}
开发者ID:kaligulasz,项目名称:Distro,代码行数:41,代码来源:template.php
示例3: denholo_preprocess_page
/**
* Override or insert variables into the page template.
*/
function denholo_preprocess_page(&$vars)
{
$vars['slideshow_display'] = theme_get_setting('slideshow_display', 'denholo');
$vars['slide1_title'] = theme_get_setting('slide1_title', 'denholo');
$vars['slide2_title'] = theme_get_setting('slide2_title', 'denholo');
$vars['slide3_title'] = theme_get_setting('slide3_title', 'denholo');
$vars['slide1_desc'] = theme_get_setting('slide1_desc', 'denholo');
$vars['slide2_desc'] = theme_get_setting('slide2_desc', 'denholo');
$vars['slide3_desc'] = theme_get_setting('slide3_desc', 'denholo');
$vars['img1'] = base_path() . drupal_get_path('theme', 'denholo') . '/images/slideshow/cat12_slide2.jpg';
$vars['img2'] = base_path() . drupal_get_path('theme', 'denholo') . '/images/slideshow/rsz_2delta.jpg';
$vars['img3'] = base_path() . drupal_get_path('theme', 'denholo') . '/images/slideshow/scenic_hills.jpg';
$image1var = array('path' => $vars['img1'], 'alt' => $vars['slide1_title'], 'title' => $vars['slide1_title'], 'attributes' => array('class' => 'slide-img'));
$vars['slideimage1'] = theme('image', $image1var);
$image2var = array('path' => $vars['img2'], 'alt' => $vars['slide2_title'], 'title' => $vars['slide2_title'], 'attributes' => array('class' => 'slide-img'));
$vars['slideimage2'] = theme('image', $image2var);
$image3var = array('path' => $vars['img3'], 'alt' => $vars['slide3_title'], 'title' => $vars['slide3_title'], 'attributes' => array('class' => 'slide-img'));
$vars['slideimage3'] = theme('image', $image3var);
$vars['columns_display'] = filter_xss_admin(theme_get_setting('columns_display', 'denholo'));
$vars['col1'] = filter_xss_admin(theme_get_setting('colone', 'denholo'));
$vars['col1title'] = filter_xss_admin(theme_get_setting('colonetitle', 'denholo'));
$vars['col1image'] = filter_xss_admin(theme_get_setting('coloneimage', 'denholo'));
$vars['col2'] = filter_xss_admin(theme_get_setting('coltwo', 'denholo'));
$vars['col2title'] = filter_xss_admin(theme_get_setting('coltwotitle', 'denholo'));
$vars['col2image'] = filter_xss_admin(theme_get_setting('coltwoimage', 'denholo'));
$vars['col3'] = filter_xss_admin(theme_get_setting('colthree', 'denholo'));
$vars['col3title'] = filter_xss_admin(theme_get_setting('colthreetitle', 'denholo'));
$vars['col3image'] = filter_xss_admin(theme_get_setting('colthreeimage', 'denholo'));
}
开发者ID:hntan,项目名称:denholo_new,代码行数:32,代码来源:template.php
示例4: dms_form_element
function dms_form_element($element, $value)
{
// This is also used in the installer, pre-database setup.
$t = get_t();
$output = '<div class="form-item"';
if (!empty($element['#id'])) {
$output .= ' id="' . $element['#id'] . '-wrapper"';
}
$output .= ">\n";
$required = !empty($element['#required']) ? '<span class="form-required" title="' . $t('This field is required.') . '">(Required)</span>' : '';
if (!empty($element['#title'])) {
$title = $element['#title'];
if (!empty($element['#id'])) {
$label = trim(str_replace(":", "", $t('!title !required:', array('!title' => filter_xss_admin($title), '!required' => $required)))) . ":";
$output .= ' <label for="' . $element['#id'] . '">' . $label . "</label>\n";
} else {
$output .= ' <label>' . $t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
}
}
$output .= " {$value}\n";
if (!empty($element['#description'])) {
$output .= ' <div class="description">' . $element['#description'] . "</div>\n";
}
$output .= "</div>\n";
return $output;
}
开发者ID:maduhu,项目名称:opengovplatform-alpha,代码行数:26,代码来源:template.php
示例5: razorDrupal_process_page
function razorDrupal_process_page(&$variables)
{
// Hook into color.module.
if (module_exists('color')) {
_color_page_alter($variables);
}
// Always print the site name and slogan, but if they are toggled off, we'll
// just hide them visually.
$variables['hide_site_name'] = theme_get_setting('toggle_name') ? FALSE : TRUE;
$variables['hide_site_slogan'] = theme_get_setting('toggle_slogan') ? FALSE : TRUE;
if ($variables['hide_site_name']) {
// If toggle_name is FALSE, the site_name will be empty, so we rebuild it.
$variables['site_name'] = filter_xss_admin(variable_get('site_name', 'Drupal'));
}
if ($variables['hide_site_slogan']) {
// If toggle_site_slogan is FALSE, the site_slogan will be empty, so we rebuild it.
$variables['site_slogan'] = filter_xss_admin(variable_get('site_slogan', ''));
}
// Since the title and the shortcut link are both block level elements,
// positioning them next to each other is much simpler with a wrapper div.
if (!empty($variables['title_suffix']['add_or_remove_shortcut']) && $variables['title']) {
// Add a wrapper div using the title_prefix and title_suffix render elements.
$variables['title_prefix']['shortcut_wrapper'] = array('#markup' => '<div class="shortcut-wrapper clearfix">', '#weight' => 100);
$variables['title_suffix']['shortcut_wrapper'] = array('#markup' => '</div>', '#weight' => -99);
// Make sure the shortcut link is the first item in title_suffix.
$variables['title_suffix']['add_or_remove_shortcut']['#weight'] = -100;
}
}
开发者ID:RazorEdgeLabs,项目名称:razordrupal,代码行数:28,代码来源:template.php
示例6: bootstrap_psdpt_form_element_label
/**
* Overrides theme_form_element_label().
*/
function bootstrap_psdpt_form_element_label(&$variables)
{
$element = $variables['element'];
// This is also used in the installer, pre-database setup.
$t = get_t();
// Determine if certain things should skip for checkbox or radio elements.
$skip = isset($element['#type']) && ('checkbox' === $element['#type'] || 'radio' === $element['#type']);
// If title and required marker are both empty, output no label.
if ((!isset($element['#title']) || $element['#title'] === '' && !$skip) && empty($element['#required'])) {
return '';
}
// If the element is required, a required marker is appended to the label.
$required = !empty($element['#required']) ? theme('form_required_marker', array('element' => $element)) : '';
$title = filter_xss_admin($element['#title']);
$attributes = array();
// Style the label as class option to display inline with the element.
if ($element['#title_display'] == 'after' && !$skip) {
$attributes['class'][] = $element['#type'];
} elseif ($element['#title_display'] == 'invisible') {
$attributes['class'][] = 'element-invisible';
}
if (!empty($element['#id'])) {
$attributes['for'] = $element['#id'];
}
// Insert radio and checkboxes inside label elements.
$output = '';
if (isset($variables['#children'])) {
$output .= $variables['#children'];
}
// Append label.
$output .= $t('!title !required', array('!title' => $title, '!required' => $required));
// The leading whitespace helps visually separate fields from inline labels.
return ' <label' . drupal_attributes($attributes) . '>' . $output . "</label>\n";
}
开发者ID:atssc-scdata,项目名称:bootstrap_psdpt,代码行数:37,代码来源:form-element-label.func.php
示例7: mothership_form_element
function mothership_form_element($element, $value)
{
// This is also used in the installer, pre-database setup.
$t = get_t();
//$output = '<div>';
// removed $output = '<div class="form-item"';
//so we dont know its a div hmm? form>div ....
$output = '<div ';
// removed the ID wrapper?
if (!empty($element['#id'])) {
$output .= ' id="' . $element['#id'] . '-wrapper"';
}
$output .= ">\n";
$required = !empty($element['#required']) ? '<span class="form-required" title="' . $t('This field is required.') . '">*</span>' : '';
if (!empty($element['#title'])) {
$title = $element['#title'];
if (!empty($element['#id'])) {
$output .= ' <label for="' . $element['#id'] . '">' . $t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
} else {
$output .= ' <label>' . $t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
}
}
//TODO test to see if this is clean text - then we might need a <span> etc
$output .= "{$value}\n";
if (!empty($element['#description'])) {
$output .= '<div class="description">' . $element['#description'] . "</div>\n";
}
$output .= "</div>\n";
return $output;
}
开发者ID:Joanl,项目名称:ding,代码行数:30,代码来源:template.form.php
示例8: tagcloudsListVocs
public function tagcloudsListVocs($tagclouds_vocs = NULL)
{
$vocs = tagclouds_vocs_load($tagclouds_vocs);
if (empty($vocs)) {
throw new NotFoundHttpException();
}
$output = '';
foreach ($vocs as $vid) {
$vocabulary = entity_load('taxonomy_vocabulary', $vid);
if ($vocabulary == FALSE) {
throw new NotFoundHttpException();
}
// Clean out vocabulary, so that we don't have to leave security to our
// theme layer.
$vocabulary->description = filter_xss_admin($vocabulary->description);
$vocabulary->name = filter_xss_admin($vocabulary->name);
$config = \Drupal::config('tagclouds.admin_page');
$tags = tagclouds_get_tags(array($vocabulary->vid), $config->get('tagclouds_levels'), $config->get('tagclouds_page_amount'));
$tags = tagclouds_sort_tags($tags);
$output .= _theme('tagclouds_list_box', array('vocabulary' => $vocabulary, 'tags' => $tags));
}
if (!$output) {
throw new NotFoundHttpException();
}
$output = "<div class=\"wrapper tagclouds\">{$output}</div>";
return $output;
}
开发者ID:neetumorwani,项目名称:blogging,代码行数:27,代码来源:TagcloudsListVocs.php
示例9: mothership_form_element
/**
* @file
* form mothership overwrites
*/
function mothership_form_element($element, $value)
{
// This is also used in the installer, pre-database setup.
$t = get_t();
//add a more specific form-item-$type
$output = "<div class=\"form-item form-item-" . $element['#type'] . " \" ";
// TODO cant this be dublicated on a page?
//and then its not unique
if (!empty($element['#id'])) {
$output .= ' id="' . $element['#id'] . '-wrapper"';
}
$output .= ">\n";
$required = !empty($element['#required']) ? '<span class="form-required" title="' . $t('This field is required.') . '">*</span>' : '';
if (!empty($element['#title'])) {
$title = $element['#title'];
if (!empty($element['#id'])) {
$output .= ' <label for="' . $element['#id'] . '">' . $t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
} else {
$output .= ' <label>' . $t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
}
}
//TODO test to see if this is clean text - then we might need a <span>
//if we need to catch the content with
$output .= "{$value}\n";
if (!empty($element['#description'])) {
$output .= '<div class="form-description">' . $element['#description'] . "</div>\n";
}
$output .= "</div>\n";
return $output;
}
开发者ID:victoriachan,项目名称:victoriac-blog,代码行数:34,代码来源:template.form.php
示例10: tibco_styles_form_element_label
/**
* Implements theme_form_element_label().
*/
function tibco_styles_form_element_label($variables)
{
$element = $variables['element'];
// This is also used in the installer, pre-database setup.
$t = get_t();
// If title and required marker are both empty, output no label.
if ((!isset($element['#title']) || $element['#title'] === '') && empty($element['#required'])) {
return '';
}
// If the element is required, a required marker is appended to the label.
$required = !empty($element['#required']) ? theme('form_required_marker', array('element' => $element)) : '';
$title = filter_xss_admin($element['#title']);
$attributes = array();
// Style the label as class option to display inline with the element.
if ($element['#title_display'] == 'after') {
$attributes['class'] = 'option';
} elseif ($element['#title_display'] == 'invisible') {
$attributes['class'] = 'element-invisible';
}
if (!empty($element['#id'])) {
$attributes['for'] = $element['#id'];
}
$help = '';
if ($element['#type'] == 'checkbox' && $element['#entity_type'] == 'entityform') {
$help = $element['#checkbox_suffix'];
}
// The leading whitespace helps visually separate fields from inline labels.
return ' <label' . drupal_attributes($attributes) . '>' . $t('!title !required', array('!title' => $title, '!required' => $required)) . $help . "</label>\n";
}
开发者ID:JaspersoftMarketing,项目名称:design_guide,代码行数:32,代码来源:template.php
示例11: badm_links__ucms_dashboard_filter
/**
* Overrides theme_links().
*/
function badm_links__ucms_dashboard_filter($variables)
{
$links = $variables['links'];
$heading = $variables['heading'];
$output = '';
if (count($links) > 0) {
if (!empty($heading)) {
if (is_string($heading)) {
$heading = ['text' => $heading, 'level' => 'strong', 'class' => []];
}
$output .= '<' . $heading['level'];
if (!empty($heading['class'])) {
$output .= drupal_attributes(['class' => $heading['class']]);
}
$output .= '>' . check_plain($heading['text']) . '</' . $heading['level'] . '>';
}
$output .= '<ul class="list-unstyled">';
foreach ($links as $link) {
if (isset($link['href'])) {
$link['attributes']['class'][] = 'list-group-item';
// Deal with title manually because we are going to force HTML code anyway
if (empty($link['html'])) {
$r_title = check_plain($link['title']);
} else {
$r_title = filter_xss_admin($link['title']);
}
$r_href = url($link['href'], $link);
// And we must manually handle the active class too for the checkbox.
if (!empty($link['attributes']['class']) && in_array('active', $link['attributes']['class'])) {
$r_c_attributes = ' checked="checked"';
} else {
$r_c_attributes = '';
}
// Also link attributes, and it should it.
if (empty($links['attributes'])) {
$r_attributes = '';
} else {
unset($links['attributes']['href']);
// Just in case...
$r_attributes = drupal_attributes($links['attributes']);
}
$output .= <<<EOT
<li>
<div class="checkbox">
<label>
<a href="{$r_href}"{$r_attributes}>
<input type="checkbox"{$r_c_attributes}>
{$r_title}
</a>
</label>
</div>
</li>
EOT;
}
}
$output .= '</ul>';
}
return $output;
}
开发者ID:makinacorpus,项目名称:drupal-badm,代码行数:62,代码来源:template.php
示例12: hook_regions_blocks_alter
/**
* Hook allowing other modules to alter any newly defined regions blocks.
*
* This happens before the each block object is rendered by theme_block().
*
* @param array $blocks
* A keyed array of block objects provided by core block and context modules.
* @param string $region_name
* machine name of the region.
*
* @see _regions_blocks()
* @see theme_block()
*/
function hook_regions_blocks_alter(&$blocks = array(), $region_name = NULL)
{
// Example to support HTML titles, with a safe but unorthodox workaround.
foreach ($blocks as $key => $block) {
$block->subject = filter_xss_admin(html_entity_decode($block->subject));
$blocks[$key] = $block;
}
}
开发者ID:kreynen,项目名称:elmsln,代码行数:21,代码来源:regions.api.php
示例13: neb_blockify_logo
function neb_blockify_logo($variables)
{
$site_name = filter_xss_admin(variable_get('site_name', 'Drupal'));
// Strip the base_path from the beginning of the logo path.
$path = preg_replace('|^' . base_path() . '|', '', $variables['logo_path']);
$image = array('#theme' => 'image', '#path' => $path, '#alt' => t('!site_name logo', array('!site_name' => $site_name)));
return l(render($image), '<front>', array('html' => TRUE, 'attributes' => array('id' => 'logo', 'rel' => 'home', 'title' => t('Return to the !site_name home page', array('!site_name' => $site_name)))));
}
开发者ID:rolfvandekrol,项目名称:neb,代码行数:8,代码来源:blockify.php
示例14: phptemplate_mission
/**
* Return a themed mission trail.
*
* @return
* a string containing the mission output, or execute PHP code snippet if
* mission is enclosed with <?php ?>.
*/
function phptemplate_mission()
{
$mission = theme_get_setting('mission');
if (preg_match('/^<\\?php/', $mission)) {
$mission = drupal_eval($mission);
} else {
$mission = filter_xss_admin($mission);
}
return isset($mission) ? $mission : '';
}
开发者ID:jaredly,项目名称:GameCC,代码行数:17,代码来源:template.php
示例15: bartik_less_process_maintenance_page
function bartik_less_process_maintenance_page(&$variables)
{
$variables['hide_site_name'] = theme_get_setting('toggle_name') ? FALSE : TURE;
$variables['hide_site_slogan'] = theme_get_setting('toggle_slogan') ? FALSE : TURE;
if ($variables['hide_site_name']) {
$variables['site_name'] = filter_xss_admin(variale_get('site_name', 'Drupal'));
}
if ($variables['hide_side_slogan']) {
$variables['site_slogan'] = filter_xss_admin(variable_get('site_slogan', ''));
}
}
开发者ID:siberlee526,项目名称:faa7419db,代码行数:11,代码来源:template.php
示例16: spacelab_preprocess_page
/**
* Preprocess variables for page template.
*/
function spacelab_preprocess_page(&$vars)
{
// Get the entire main menu tree.
$main_menu_tree = array();
$main_menu_tree = menu_tree_all_data('main-menu', NULL, 2);
// Add the rendered output to the $main_menu_expanded variable.
$vars['main_menu_expanded'] = menu_tree_output($main_menu_tree);
// Always print the site name and slogan, but if they are toggled off, we'll
// just hide them visually.
$vars['hide_site_name'] = theme_get_setting('toggle_name') ? FALSE : TRUE;
$vars['hide_site_slogan'] = theme_get_setting('toggle_slogan') ? FALSE : TRUE;
if ($vars['hide_site_name']) {
// If toggle_name is FALSE, the site_name will be empty, so we rebuild it.
$vars['site_name'] = filter_xss_admin(variable_get('site_name', 'Drupal'));
}
if ($vars['hide_site_slogan']) {
// If toggle_site_slogan is FALSE, the site_slogan will be empty,
// so we rebuild it.
$vars['site_slogan'] = filter_xss_admin(variable_get('site_slogan', ''));
}
// Since the title and the shortcut link are both block level elements,
// positioning them next to each other is much simpler with a wrapper div.
if (!empty($vars['title_suffix']['add_or_remove_shortcut']) && $vars['title']) {
// Add a wrapper div using title_prefix and title_suffix render elements.
$vars['title_prefix']['shortcut_wrapper'] = array('#markup' => '<div class="shortcut-wrapper clearfix">', '#weight' => 100);
$vars['title_suffix']['shortcut_wrapper'] = array('#markup' => '</div>', '#weight' => -99);
// Make sure the shortcut link is the first item in title_suffix.
$vars['title_suffix']['add_or_remove_shortcut']['#weight'] = -100;
}
// If panels arent being used at all.
$vars['no_panels'] = !(module_exists('page_manager') && page_manager_get_current_page());
// Check if we're to always print the page title, even on panelized pages.
$vars['always_show_page_title'] = theme_get_setting('always_show_page_title') ? TRUE : FALSE;
/**
* insert variables into page template.
*/
if ($vars['page']['sidebar_first'] && $vars['page']['sidebar_second']) {
$vars['sidebar_grid_class'] = 'col-md-3';
$vars['main_grid_class'] = 'col-md-6';
} elseif ($vars['page']['sidebar_first'] || $vars['page']['sidebar_second']) {
$vars['sidebar_grid_class'] = 'col-md-3';
$vars['main_grid_class'] = 'col-md-9';
} else {
$vars['main_grid_class'] = 'col-md-12';
}
if ($vars['page']['header_top_left'] && $vars['page']['header_top_right']) {
$vars['header_top_left_grid_class'] = 'col-md-8';
$vars['header_top_right_grid_class'] = 'col-md-4';
} elseif ($vars['page']['header_top_right'] || $vars['page']['header_top_left']) {
$vars['header_top_left_grid_class'] = 'col-md-12';
$vars['header_top_right_grid_class'] = 'col-md-12';
}
}
开发者ID:creazy412,项目名称:vmware-win10-c65-drupal7,代码行数:56,代码来源:template.php
示例17: ginkgo_preprocess_page
/**
* Preprocessor for theme_page().
*/
function ginkgo_preprocess_page(&$vars)
{
// Add icon markup to main menu
ginkgo_icon_links($vars['primary_links']);
// If tabs are active, the title is likely shown in them. Don't show twice.
$vars['title'] = !empty($vars['tabs']) ? '' : $vars['title'];
// Respect anything people are requesting through context.
if (module_exists('context')) {
$vars['custom_layout'] = context_get('theme', 'layout') == 'custom' ? TRUE : FALSE;
$vars['attr']['class'] .= context_isset('theme', 'body_classes') ? " " . context_get('theme', 'body_classes') : '';
}
// Add a smarter body class than "not logged in" for determining whether
// we are on a login/password/user registration related page.
global $user;
$vars['mission'] = '';
if (!$user->uid && arg(0) == 'user') {
$vars['attr']['class'] .= ' anonymous-login';
$vars['mission'] = filter_xss_admin(variable_get('site_mission', ''));
}
// Theme specific settings
$settings = theme_get_settings('ginkgo');
// Show site title/emblem ?
$vars['site_name'] = isset($settings['emblem']) && !$settings['emblem'] ? '' : $vars['site_name'];
// Footer links
$vars['footer_links'] = isset($vars['footer_links']) ? $vars['footer_links'] : array();
$item = menu_get_item('admin');
if ($item && $item['access']) {
$vars['footer_links']['admin'] = $item;
}
// IE7 CSS
// @TODO: Implement IE styles key in tao.
$ie = base_path() . path_to_theme() . '/ie.css';
$vars['ie'] = "<!--[if lte IE 8]><style type='text/css' media='screen'>@import '{$ie}';</style><![endif]-->";
// Add spaces design CSS back in
if (!isset($_GET['print'])) {
if (empty($vars['spaces_design_styles'])) {
global $theme_info;
$space = spaces_get_space();
// Retrieve default colors from info file
if (isset($theme_info->info["spaces_design_{$space->type}"])) {
$default = $theme_info->info["spaces_design_{$space->type}"];
} else {
$default = '#3399aa';
}
$color = !empty($settings["color_{$space->type}"]) ? $settings["color_{$space->type}"] : $default;
$vars['styles'] .= theme('spaces_design', $color);
$vars['attr']['class'] .= ' spaces-design';
} else {
$vars['styles'] .= $vars['spaces_design_styles'];
}
}
}
开发者ID:kkaefer,项目名称:Atrium,代码行数:55,代码来源:template.php
示例18: zen_breadcrumb
/**
* Return a themed breadcrumb trail.
*
* @param $variables
* - title: An optional string to be used as a navigational heading to give
* context for breadcrumb links to screen-reader users.
* - title_attributes_array: Array of HTML attributes for the title. It is
* flattened into a string within the theme function.
* - breadcrumb: An array containing the breadcrumb links.
* @return
* A string containing the breadcrumb output.
*/
function zen_breadcrumb($variables) {
$breadcrumb = $variables['breadcrumb'];
$output = '';
// Determine if we are to display the breadcrumb.
$show_breadcrumb = theme_get_setting('zen_breadcrumb');
if ($show_breadcrumb == 'yes' || $show_breadcrumb == 'admin' && arg(0) == 'admin') {
// Optionally get rid of the homepage link.
$show_breadcrumb_home = theme_get_setting('zen_breadcrumb_home');
if (!$show_breadcrumb_home) {
array_shift($breadcrumb);
}
// Return the breadcrumb with separators.
if (!empty($breadcrumb)) {
$breadcrumb_separator = filter_xss_admin(theme_get_setting('zen_breadcrumb_separator'));
$trailing_separator = $title = '';
if (theme_get_setting('zen_breadcrumb_title')) {
$item = menu_get_item();
if (!empty($item['tab_parent'])) {
// If we are on a non-default tab, use the tab's title.
$breadcrumb[] = check_plain($item['title']);
}
else {
$breadcrumb[] = drupal_get_title();
}
}
elseif (theme_get_setting('zen_breadcrumb_trailing')) {
$trailing_separator = $breadcrumb_separator;
}
// Provide a navigational heading to give context for breadcrumb links to
// screen-reader users.
if (empty($variables['title'])) {
$variables['title'] = t('You are here');
}
// Unless overridden by a preprocess function, make the heading invisible.
if (!isset($variables['title_attributes_array']['class'])) {
$variables['title_attributes_array']['class'][] = 'element-invisible';
}
// Build the breadcrumb trail.
$output = '<nav class="breadcrumb" role="navigation">';
$output .= '<h2' . drupal_attributes($variables['title_attributes_array']) . '>' . $variables['title'] . '</h2>';
$output .= '<ol><li>' . implode($breadcrumb_separator . '</li><li>', $breadcrumb) . $trailing_separator . '</li></ol>';
$output .= '</nav>';
}
}
return $output;
}
开发者ID:Vaibhav14890,项目名称:dsource,代码行数:64,代码来源:template.php
示例19: blocks_process_page
/**
* Define some variables for use in theme templates.
*/
function blocks_process_page(&$variables)
{
// Assign site name and slogan toggle theme settings to variables.
$variables['disable_site_name'] = theme_get_setting('toggle_name') ? FALSE : TRUE;
$variables['disable_site_slogan'] = theme_get_setting('toggle_slogan') ? FALSE : TRUE;
// Assign site name/slogan defaults if there is no value.
if ($variables['disable_site_name']) {
$variables['site_name'] = filter_xss_admin(variable_get('site_name', 'Drupal'));
}
if ($variables['disable_site_slogan']) {
$variables['site_slogan'] = filter_xss_admin(variable_get('site_slogan', ''));
}
}
开发者ID:redcrackle,项目名称:blocks,代码行数:16,代码来源:template.php
示例20: bootstrap_form_element_label
/**
* Returns HTML for a form element label and required marker.
*
* Form element labels include the #title and a #required marker. The label is
* associated with the element itself by the element #id. Labels may appear
* before or after elements, depending on theme_form_element() and
* #title_display.
*
* This function will not be called for elements with no labels, depending on
* #title_display. For elements that have an empty #title and are not required,
* this function will output no label (''). For required elements that have an
* empty #title, this will output the required marker alone within the label.
* The label will use the #id to associate the marker with the field that is
* required. That is especially important for screenreader users to know
* which field is required.
*
* @param array $variables
* An associative array containing:
* - element: An associative array containing the properties of the element.
* Properties used: #required, #title, #id, #value, #description.
*
* @return string
* The constructed HTML.
*
* @see theme_form_element_label()
*
* @ingroup theme_functions
*/
function bootstrap_form_element_label(&$variables)
{
$element = $variables['element'];
// Extract variables.
$output = '';
$title = !empty($element['#title']) ? filter_xss_admin($element['#title']) : '';
// Only show the required marker if there is an actual title to display.
if ($title && ($required = !empty($element['#required']) ? theme('form_required_marker', array('element' => $element)) : '')) {
$title .= ' ' . $required;
}
$display = isset($element['#title_display']) ? $element['#title_display'] : 'before';
$type = !empty($element['#type']) ? $element['#type'] : FALSE;
$checkbox = $type && $type === 'checkbox';
$radio = $type && $type === 'radio';
// Immediately return if the element is not a checkbox or radio and there is
// no label to be rendered.
if (!$checkbox && !$radio && ($display === 'none' || !$title)) {
return '';
}
// Retrieve the label attributes array.
$attributes =& _bootstrap_get_attributes($element, 'label_attributes');
// Add Bootstrap label class.
$attributes['class'][] = 'control-label';
// Add the necessary 'for' attribute if the element ID exists.
if (!empty($element['#id'])) {
$attributes['for'] = $element['#id'];
}
// Checkboxes and radios must construct the label differently.
if ($checkbox || $radio) {
if ($display === 'before') {
$output .= $title;
} elseif ($display === 'none' || $display === 'invisible') {
$output .= '<span class="element-invisible">' . $title . '</span>';
}
// Inject the rendered checkbox or radio element inside the label.
if (!empty($element['#children'])) {
$output .= $element['#children'];
}
if ($display === 'after') {
$output .= $title;
}
} else {
// Show label only to screen readers to avoid disruption in visual flows.
if ($display === 'invisible') {
$attributes['class'][] = 'element-invisible';
}
$output .= $title;
}
// The leading whitespace helps visually separate fields from inline labels.
return ' <label' . drupal_attributes($attributes) . '>' . $output . "</label>\n";
}
开发者ID:PixelGarage,项目名称:hso2,代码行数:79,代码来源:form-element-label.func.php
注:本文中的filter_xss_admin函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论