本文整理汇总了PHP中filter_xss_admin函数的典型用法代码示例。如果您正苦于以下问题:PHP filter_xss_admin函数的具体用法?PHP filter_xss_admin怎么用?PHP filter_xss_admin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了filter_xss_admin函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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');
}
}
示例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'));
}
示例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;
}
示例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;
}
}
示例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";
}
示例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;
}
示例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;
}
示例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;
}
示例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";
}
示例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;
}
示例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;
}
}
示例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)))));
}
示例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 : '';
}
示例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', ''));
}
}