Revision 1f623f01
Added by Assos Assos almost 8 years ago
drupal7/sites/all/themes/bootstrap/includes/common.inc | ||
---|---|---|
575 | 575 |
return $files[$hash]; |
576 | 576 |
} |
577 | 577 |
|
578 |
/** |
|
579 |
* Filters HTML to prevent cross-site-scripting (XSS) vulnerabilities. |
|
580 |
* |
|
581 |
* Very similar to core's filter_xss(). It does, however, include the addition |
|
582 |
* of the "span", "div" and "i" elements which are commonly used in Bootstrap. |
|
583 |
* |
|
584 |
* @param string $string |
|
585 |
* The string with raw HTML in it. It will be stripped of everything that can |
|
586 |
* cause an XSS attack. |
|
587 |
* @param array $allowed_tags |
|
588 |
* An array of allowed tags. |
|
589 |
* |
|
590 |
* @return string |
|
591 |
* An XSS safe version of $string, or an empty string if $string is not |
|
592 |
* valid UTF-8. |
|
593 |
* |
|
594 |
* @see filter_xss() |
|
595 |
*/ |
|
596 |
function _bootstrap_filter_xss($string, array $allowed_tags = NULL) { |
|
597 |
if (is_null($allowed_tags)) { |
|
598 |
$allowed_tags = array( |
|
599 |
// Inline elements. |
|
600 |
'a', |
|
601 |
'cite', |
|
602 |
'em', |
|
603 |
'i', |
|
604 |
'span', |
|
605 |
'strong', |
|
606 |
|
|
607 |
// Block elements. |
|
608 |
'blockquote', |
|
609 |
'code', |
|
610 |
'div', |
|
611 |
'ul', |
|
612 |
'ol', |
|
613 |
'li', |
|
614 |
'dl', |
|
615 |
'dt', |
|
616 |
'dd', |
|
617 |
); |
|
618 |
} |
|
619 |
return filter_xss($string, $allowed_tags); |
|
620 |
} |
|
621 |
|
|
578 | 622 |
/** |
579 | 623 |
* Returns a list of available Bootstrap Glyphicons. |
580 | 624 |
* |
... | ... | |
1058 | 1102 |
t('Filter') => 'primary', |
1059 | 1103 |
t('Submit') => 'primary', |
1060 | 1104 |
t('Search') => 'primary', |
1105 |
t('Log in') => 'primary', |
|
1061 | 1106 |
|
1062 | 1107 |
// Success class. |
1063 | 1108 |
t('Add') => 'success', |
... | ... | |
1156 | 1201 |
t('Delete') => 'trash', |
1157 | 1202 |
t('Remove') => 'trash', |
1158 | 1203 |
t('Upload') => 'upload', |
1204 |
t('Log In') => 'log-in', |
|
1159 | 1205 |
), |
1160 | 1206 |
); |
1161 | 1207 |
|
Also available in: Unified diff
Weekly update of contrib modules