本文整理汇总了PHP中filter_xss函数的典型用法代码示例。如果您正苦于以下问题:PHP filter_xss函数的具体用法?PHP filter_xss怎么用?PHP filter_xss使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了filter_xss函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: messaging_token_values
/**
* Implementation of hook_token_values()
*/
function messaging_token_values($type, $object = NULL, $options = array())
{
$language = isset($options['language']) ? $options['language'] : $GLOBALS['language'];
switch ($type) {
case 'message':
if ($message = messaging_check_object($object, 'Messaging_Message')) {
$values['message-subject'] = check_plain($message->get_subject());
$values['message-body'] = filter_xss($message->get_body());
$values['message-author-name'] = check_plain($message->get_sender_name());
$values['message-method'] = messaging_method_info($message->method, 'name');
$timezone = isset($options['timezone']) ? $options['timezone'] : variable_get('date_default_timezone', 0);
$values['message-date'] = format_date($message->sent, 'medium', '', $timezone, $language->language);
return $values;
}
break;
case 'destination':
// Messaging destinations
if ($destination = messaging_check_object($object, 'Messaging_Destination')) {
$values['destination-address'] = $destination->format_address(FALSE);
$values['destination-type'] = $destination->address_name();
return $values;
}
break;
}
}
开发者ID:BenK,项目名称:messaging,代码行数:28,代码来源:code_update.php
示例2: boron_breadcrumb
/**
* Return a themed breadcrumb trail.
*
* @param $breadcrumb
* An array containing the breadcrumb links.
* @return
* A string containing the breadcrumb output.
*/
function boron_breadcrumb($vars)
{
$breadcrumb = $vars['breadcrumb'];
// Determine if we are to display the breadcrumb.
$show_breadcrumb = theme_get_setting('breadcrumb_display');
if ($show_breadcrumb == 'yes') {
// Optionally get rid of the homepage link.
$show_breadcrumb_home = theme_get_setting('breadcrumb_home');
if (!$show_breadcrumb_home) {
array_shift($breadcrumb);
}
// Return the breadcrumb with separators.
if (!empty($breadcrumb)) {
$separator = filter_xss(theme_get_setting('breadcrumb_separator'));
$trailing_separator = $title = '';
// Add the title and trailing separator
if (theme_get_setting('breadcrumb_title')) {
if ($title = drupal_get_title()) {
$trailing_separator = $separator;
}
} elseif (theme_get_setting('breadcrumb_trailing')) {
$trailing_separator = $separator;
}
// Assemble the breadcrumb
return implode($separator, $breadcrumb) . $trailing_separator . $title;
}
}
// Otherwise, return an empty string.
return '';
}
开发者ID:AnneliesVDWee,项目名称:drupal_carpediem,代码行数:38,代码来源:template.php
示例3: getRequestKeyValueFromURL
/** Returns the request parameter value from URL */
static function getRequestKeyValueFromURL($key, $urlPath)
{
$value = NULL;
$pathParams = explode('/', $urlPath);
$index = array_search($key, $pathParams);
if ($index != FALSE) {
$value = filter_xss($pathParams[$index + 1]);
}
return $value;
}
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:11,代码来源:RequestUtil.php
示例4: filter_xss
public static function filter_xss($string, $allowedtags = '', $disabledattributes = array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavaible', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragdrop', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterupdate', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmoveout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload'))
{
if (is_array($string)) {
foreach ($string as $key => $val) {
$string[$key] = filter_xss($val, ALLOWED_HTMLTAGS);
}
} else {
$subject = preg_replace_callback('/<(.*?)>/i', 'prc_callback', strip_tags($string, $allowedtags));
$string = preg_replace('/\\s(' . implode('|', $disabledattributes) . ').*?([\\s\\>])/', '\\2', $subject);
}
return $string;
}
开发者ID:houhaitao,项目名称:hthoularavel,代码行数:12,代码来源:GlobalTools.php
示例5: settingsForm
/**
* Generate a settings form for this handler.
*/
public function settingsForm($field, $instance)
{
$form['action'] = array('#type' => 'select', '#title' => t('Action'), '#options' => array('none' => t('Do nothing'), 'hide' => t('Hide field'), 'disable' => t('Disable field')), '#description' => t('Action to take when prepopulating field with values via URL.'));
$form['action_on_edit'] = array('#type' => 'checkbox', '#title' => t('Apply action on edit'), '#description' => t('Apply action when editing an existing entity.'), '#states' => array('invisible' => array(':input[name="instance[settings][behaviors][prepopulate][action]"]' => array('value' => 'none'))));
$form['fallback'] = array('#type' => 'select', '#title' => t('Fallback behaviour'), '#description' => t('Determine what should happen if no values are provided via URL.'), '#options' => array('none' => t('Do nothing'), 'hide' => t('Hide field'), 'form_error' => t('Set form error'), 'redirect' => t('Redirect')));
// Get list of permissions.
$perms = array();
$perms[0] = t('- None -');
foreach (module_list(FALSE, FALSE, TRUE) as $module) {
// By keeping them keyed by module we can use optgroups with the
// 'select' type.
if ($permissions = module_invoke($module, 'permission')) {
foreach ($permissions as $id => $permission) {
$perms[$module][$id] = strip_tags($permission['title']);
}
}
}
$form['skip_perm'] = array('#type' => 'select', '#title' => t('Skip access permission'), '#description' => t('Set a permission that will not be affected by the fallback behavior.'), '#options' => $perms);
$form['providers'] = array('#type' => 'container', '#theme' => 'entityreference_prepopulate_providers_table', '#element_validate' => array('entityreference_prepopulate_providers_validate'));
$providers = entityreference_prepopulate_providers_info();
// Sort providers by weight.
$providers_names = !empty($instance['settings']['behaviors']['prepopulate']['providers']) ? array_keys($instance['settings']['behaviors']['prepopulate']['providers']) : array();
$providers_names = drupal_array_merge_deep($providers_names, array_keys($providers));
$weight = 0;
foreach ($providers_names as $name) {
// Validate that the provider exists.
if (!isset($providers[$name])) {
continue;
}
$provider = $providers[$name];
// Set default values.
$provider += array('disabled' => FALSE);
$form['providers']['title'][$name] = array('#type' => 'item', '#markup' => filter_xss($provider['title']), '#description' => filter_xss($provider['description']));
if (!isset($instance['settings']['behaviors']['prepopulate']['providers'][$name])) {
// backwards compatibility with version 1.4.
if ($name == 'url') {
// Enable the URL provider is it is not set in the instance yet.
$default_value = TRUE;
} elseif ($name == 'og_context') {
$default_value = !empty($instance['settings']['behaviors']['prepopulate']['og_context']);
}
} else {
$default_value = !empty($instance['settings']['behaviors']['prepopulate']['providers'][$name]);
}
$form['providers']['enabled'][$name] = array('#type' => 'checkbox', '#disabled' => $provider['disabled'], '#default_value' => $default_value);
$form['providers']['weight'][$name] = array('#type' => 'weight', '#default_value' => $weight, '#attributes' => array('class' => array('provider-weight')));
++$weight;
}
return $form;
}
开发者ID:elmsln,项目名称:spawn,代码行数:53,代码来源:EntityReferencePrepopulateInstanceBehavior.class.php
示例6: drupalmel_theme_preprocess_semantic_panels_pane
/**
* Implements hook_preprocess_panels_pane().
*/
function drupalmel_theme_preprocess_semantic_panels_pane(&$variables)
{
switch ($variables['pane']->subtype) {
// Add <span> to site name string.
case 'blockify-blockify-site-name':
preg_match_all('/([A-Z][a-z]+|[0-9]+)/', variable_get('site_name', NULL), $parts);
$name = '';
if (isset($parts[1])) {
foreach ($parts[1] as $delta => $part) {
$id = drupal_clean_css_identifier($part);
$name .= '<span class="part-' . $delta . ' part-' . $id . '">' . filter_xss($part) . '</span>';
}
}
$variables['content_html'] = str_replace('<span>' . variable_get('site_name', NULL) . '</span>', $name, $variables['content_html']);
break;
}
}
开发者ID:Decipher,项目名称:drupalmel,代码行数:20,代码来源:template.php
示例7: getExpenseCatIds
public static function getExpenseCatIds()
{
$bottomURL = $_REQUEST['expandBottomContURL'];
$expCatId = NULL;
$expCatIds = array();
if (isset($bottomURL) && preg_match("/expcategory/", $bottomURL)) {
$pathParams = explode('/', $bottomURL);
$index = array_search('expcategory', $pathParams);
$expCatId = filter_xss($pathParams[$index + 1]);
}
if ($expCatId) {
$query1 = "SELECT expenditure_object_code FROM ref_expenditure_object WHERE expenditure_object_id = " . $expCatId;
$expCatInfo = _checkbook_project_execute_sql($query1);
$query2 = "SELECT expenditure_object_id, fiscal_year, year_id FROM ref_expenditure_object e\r\n LEFT JOIN ref_year y ON e.fiscal_year = y.year_value\r\n WHERE expenditure_object_code = '" . $expCatInfo[0]['expenditure_object_code'] . "'";
$result = _checkbook_project_execute_sql($query2);
foreach ($result as $key => $value) {
$expCatIds[$value['year_id']] = $value['expenditure_object_id'];
}
}
return $expCatIds;
}
开发者ID:ecs-hk,项目名称:Checkbook,代码行数:21,代码来源:SpendingUtil.php
示例8: getJS
/**
* {@inheritdoc}
*/
public function getJS()
{
$js = parent::getJS();
// Ensure we've a sane url.
if (!empty($js['opt']['url'])) {
$js['opt']['url'] = url($js['opt']['url']);
} else {
// Remove the option as it is even used if empty.
unset($js['opt']['url']);
}
// @TODO Find a way how to do this just once per map / collection.
if ($this->getOption('devMode')) {
include 'forms.inc';
$form_state = array();
$form_state['build_info']['args'] = array($this);
$form = drupal_build_form('openlayers_dev_dialog_form', $form_state);
unset($form['options']['devMode']);
$js['opt']['devDialog'] = filter_xss(drupal_render($form), array('label', 'form', 'input', 'select', 'textarea', 'div', 'ul', 'ol', 'li', 'dl', 'dt', 'dd'));
}
return $js;
}
开发者ID:josemrc,项目名称:ae2web,代码行数:24,代码来源:GeoJSON.php
示例9: dynamo_preprocess_node
/**
* Preprocess node template variables.
*/
function dynamo_preprocess_node(&$variables)
{
$node = $variables['node'];
if (!$variables['page']) {
if (isset($variables['field_list_image_rendered']) && strlen($variables['field_list_image_rendered']) > 1) {
$variables['list_image'] = $variables['field_list_image_rendered'];
} else {
$variables['list_image'] = ' ';
}
}
$similar_nodes = similarterms_list(variable_get('ding_similarterms_vocabulary_id', 0));
if (count($similar_nodes)) {
$variables['similarterms'] = theme('similarterms', variable_get('similarterms_display_options', 'title_only'), $similar_nodes);
}
if ($variables['type'] == 'event') {
$date = strtotime($node->field_datetime[0]['value']);
$date2 = strtotime($node->field_datetime[0]['value2']);
// Find out the end time of the event. If there's no specified end
// time, we’ll use the start time. If the event is in the past, we
// create the alert box.
if ($date2 > 0 && $date2 < $_SERVER['REQUEST_TIME']) {
$variables['alertbox'] = '<div class="alert">' . t('NB! This event occurred in the past.') . '</div>';
}
// More human-friendly date formatting – try only to show the stuff
// that’s different when displaying a date range.
if (date("Ymd", $date) == date("Ymd", $date2)) {
$variables['event_date'] = format_date($date, 'custom', "j. F Y");
} elseif (date("Ym", $date) == date("Ym", $date2)) {
$variables['event_date'] = format_date($date, 'custom', "j.") . "–" . format_date($date2, 'custom', "j. F Y");
} else {
$variables['event_date'] = format_date($date, 'custom', "j. M.") . " – " . format_date($date2, 'custom', "j. M. Y");
}
// Display free if the price is zero.
if ($node->field_entry_price[0]['value'] == "0") {
$variables['event_price'] = t('free');
} else {
$variables['event_price'] = filter_xss($node->field_entry_price[0]['view']);
}
}
}
开发者ID:beltofte,项目名称:ding,代码行数:43,代码来源:template.php
示例10: bootstrap_psdpt_pager_link
/**
* Overrides theme_pager().
*/
function bootstrap_psdpt_pager_link($variables)
{
$text = $variables['text'];
$page_new = $variables['page_new'];
$element = $variables['element'];
$parameters = $variables['parameters'];
$attributes = $variables['attributes'];
$page = isset($_GET['page']) ? $_GET['page'] : '';
if ($new_page = implode(',', pager_load_array($page_new[$element], $element, explode(',', $page)))) {
$parameters['page'] = $new_page;
}
$query = array();
if (count($parameters)) {
$query = drupal_get_query_parameters($parameters, array());
}
if ($query_pager = pager_get_query_parameters()) {
$query = array_merge($query, $query_pager);
}
// Set each pager link title
if (!isset($attributes['title'])) {
static $titles = NULL;
if (!isset($titles)) {
$titles = array(t('« first') => t('Go to first page'), t('‹ previous') => t('Go to previous page'), t('next ›') => t('Go to next page'), t('last »') => t('Go to last page'));
}
if (isset($titles[$text])) {
$attributes['title'] = $titles[$text];
} elseif (is_numeric($text)) {
$attributes['title'] = t('Go to page @number', array('@number' => $text));
}
}
// @todo l() cannot be used here, since it adds an 'active' class based on the
// path only (which is always the current path for pager links). Apparently,
// none of the pager links is active at any time - but it should still be
// possible to use l() here.
// @see http://drupal.org/node/1410574
$attributes['href'] = url($_GET['q'], array('query' => $query));
$text = filter_xss($text, array('span', 'em', 'strong'));
return '<a' . drupal_attributes($attributes) . '>' . $text . '</a>';
}
开发者ID:atssc-scdata,项目名称:bootstrap_psdpt,代码行数:42,代码来源:pager-link.func.php
示例11: process_xss_weak
/**
* applies xss checks on string (weak version)
* @param string $string text to check
* @return string safe value
*/
public static function process_xss_weak($string)
{
return filter_xss($string, array('a|abbr|acronym|address|b|bdo|big|blockquote|br|caption|cite|code|col|colgroup|dd|del|dfn|div|dl|dt|em|h1|h2|h3|h4|h5|h6|hr|i|img|ins|kbd|li|ol|p|pre|q|samp|small|span|strong|sub|sup|table|tbody|td|tfoot|th|thead|tr|tt|ul|var'));
}
开发者ID:degami,项目名称:php-forms-api,代码行数:9,代码来源:form.php
示例12: ec_resp_preprocess_block
/**
* Implements template_preprocess_block().
*/
function ec_resp_preprocess_block(&$variables)
{
global $user, $language;
$block_no_panel = array('search' => 'form', 'print' => 'print-links', 'print_ui' => 'print-links', 'workbench' => 'block', 'social_bookmark' => 'social-bookmark', 'views' => 'view_ec_content_slider-block', 'om_maximenu' => array('om-maximenu-1', 'om-maximenu-2'), 'menu' => 'menu-service-tools', 'cce_basic_config' => 'footer_ipg');
// List of all blocks that don't need their title to be displayed.
$block_no_title = array('fat_footer' => 'fat-footer', 'om_maximenu' => array('om-maximenu-1', 'om-maximenu-2'), 'menu' => 'menu-service-tools', 'cce_basic_config' => 'footer_ipg');
$block_no_body_class = array();
$panel = TRUE;
foreach ($block_no_panel as $key => $value) {
if ($variables['block']->module == $key) {
if (is_array($value)) {
foreach ($value as $delta) {
if ($variables['block']->delta == $delta) {
$panel = FALSE;
break;
}
}
} else {
if ($variables['block']->delta == $value) {
$panel = FALSE;
break;
}
}
}
}
$title = TRUE;
foreach ($block_no_title as $key => $value) {
if ($variables['block']->module == $key) {
if (is_array($value)) {
foreach ($value as $delta) {
if ($variables['block']->delta == $delta) {
$title = FALSE;
break;
}
}
} else {
if ($variables['block']->delta == $value) {
$title = FALSE;
break;
}
}
}
}
$body_class = TRUE;
foreach ($block_no_body_class as $key => $value) {
if ($variables['block']->module == $key && $variables['block']->delta == $value) {
$body_class = FALSE;
}
}
$variables['panel'] = $panel;
$variables['title'] = $title;
$variables['body_class'] = $body_class;
if (isset($variables['block']->bid)) {
switch ($variables['block']->bid) {
case 'locale-language':
$languages = language_list();
$items = array();
$items[] = array('data' => '<span class="off-screen">' . t("Current language") . ':</span> ' . $language->language, 'class' => array('selected'), 'title' => $language->native, 'lang' => $language->language);
// Get path of translated content.
$translations = translation_path_get_translations(current_path());
$language_default = language_default();
foreach ($languages as $language_object) {
$prefix = $language_object->language;
$language_name = $language_object->name;
if (isset($translations[$prefix])) {
$path = $translations[$prefix];
} else {
$path = current_path();
}
// Get the related url alias
// Check if the multisite language negotiation
// with suffix url is enabled.
$language_negociation = variable_get('language_negotiation_language');
if (isset($language_negociation['locale-url-suffix'])) {
$delimiter = variable_get('language_suffix_delimiter', '_');
$alias = drupal_get_path_alias($path, $prefix);
if ($alias == variable_get('site_frontpage', 'node')) {
$path = $prefix == 'en' ? '' : 'index';
} else {
if ($alias != $path) {
$path = $alias;
} else {
$path = drupal_get_path_alias(isset($translations[$language_name]) ? $translations[$language_name] : $path, $language_name);
}
}
} else {
$path = drupal_get_path_alias($path, $prefix);
}
// Add enabled languages.
if ($language_name != $language->name) {
$items[] = array('data' => l($language_name, filter_xss($path), array('attributes' => array('hreflang' => $prefix, 'lang' => $prefix, 'title' => $language_name), 'language' => $language_object)));
}
}
$variables['language_list'] = theme('item_list', array('items' => $items));
break;
case 'system-user-menu':
if ($user->uid) {
//.........这里部分代码省略.........
开发者ID:ec-europa,项目名称:platform-dev,代码行数:101,代码来源:template.php
示例13: hook_tokens
/**
* Provide replacement values for placeholder tokens.
*
* This hook is invoked when someone calls token_replace(). That function first
* scans the text for [type:token] patterns, and splits the needed tokens into
* groups by type. Then hook_tokens() is invoked on each token-type group,
* allowing your module to respond by providing replacement text for any of
* the tokens in the group that your module knows how to process.
*
* A module implementing this hook should also implement hook_token_info() in
* order to list its available tokens on editing screens.
*
* @param $type
* The machine-readable name of the type (group) of token being replaced, such
* as 'node', 'user', or another type defined by a hook_token_info()
* implementation.
* @param $tokens
* An array of tokens to be replaced. The keys are the machine-readable token
* names, and the values are the raw [type:token] strings that appeared in the
* original text.
* @param $data
* (optional) An associative array of data objects to be used when generating
* replacement values, as supplied in the $data parameter to token_replace().
* @param $options
* (optional) An associative array of options for token replacement; see
* token_replace() for possible values.
*
* @return
* An associative array of replacement values, keyed by the raw [type:token]
* strings from the original text.
*
* @see hook_token_info()
* @see hook_tokens_alter()
*/
function hook_tokens($type, $tokens, array $data = array(), array $options = array())
{
$url_options = array('absolute' => TRUE);
if (isset($options['language'])) {
$url_options['language'] = $options['language'];
$language_code = $options['language']->language;
} else {
$language_code = NULL;
}
$sanitize = !empty($options['sanitize']);
$replacements = array();
if ($type == 'node' && !empty($data['node'])) {
$node = $data['node'];
foreach ($tokens as $name => $original) {
switch ($name) {
// Simple key values on the node.
case 'nid':
$replacements[$original] = $node->nid;
break;
case 'title':
$replacements[$original] = $sanitize ? check_plain($node->title) : $node->title;
break;
case 'edit-url':
$replacements[$original] = url('node/' . $node->nid . '/edit', $url_options);
break;
// Default values for the chained tokens handled below.
// Default values for the chained tokens handled below.
case 'author':
$name = $node->uid == 0 ? variable_get('anonymous', t('Anonymous')) : $node->name;
$replacements[$original] = $sanitize ? filter_xss($name) : $name;
break;
case 'created':
$replacements[$original] = format_date($node->created, 'medium', '', NULL, $language_code);
break;
}
}
if ($author_tokens = token_find_with_prefix($tokens, 'author')) {
$author = user_load($node->uid);
$replacements += token_generate('user', $author_tokens, array('user' => $author), $options);
}
if ($created_tokens = token_find_with_prefix($tokens, 'created')) {
$replacements += token_generate('date', $created_tokens, array('date' => $node->created), $options);
}
}
return $replacements;
}
开发者ID:jayelless,项目名称:beehive,代码行数:80,代码来源:system.api.php
示例14: color_glass_form_system_theme_settings_alter
/**
* Implements hook_form_system_theme_settings_alter().
*/
function color_glass_form_system_theme_settings_alter(&$form, $form_state)
{
// Get the theme name.
$theme = !empty($form_state['build_info']['args'][0]) ? $form_state['build_info']['args'][0] : FALSE;
$jquery_message = t('jQuery Update is not enabled, Bootstrap requires a minimum jQuery version of 1.9 or higher. Please enable the <a href="!jquery_update_project_url">jQuery Update</a> module @jquery_update_version or higher. If you are seeing this, then you must <a href="!jquery_update_configure">manually configuration</a> this setting or optionally <a href="!bootstrap_suppress_jquery_error">suppress this message</a> instead.', array('@jquery_update_version' => '7.x-2.5', '!jquery_update_project_url' => 'https://www.drupal.org/project/jquery_update', '!jquery_update_configure' => url('admin/config/development/jquery_update'), '!bootstrap_suppress_jquery_error' => url('admin/appearance/settings/' . $theme, array('fragment' => 'edit-bootstrap-toggle-jquery-error'))));
// Display a warning if jquery_update isn't enabled.
if ((!module_exists('jquery_update') || !version_compare(variable_get('jquery_update_jquery_version', '1.10'), '1.9', '>=')) && !_bootstrap_setting('toggle_jquery_error', $theme)) {
drupal_set_message(filter_xss($jquery_message), 'error', FALSE);
}
// Create vertical tabs for all Bootstrap related settings.
$form['bootstrap'] = array('#type' => 'vertical_tabs', '#attached' => array('js' => array(drupal_get_path('theme', 'bootstrap') . '/js/bootstrap.admin.js')), '#prefix' => '<h2><small>' . t('Bootstrap Settings') . '</small></h2>', '#weight' => -10);
// General.
$form['general'] = array('#type' => 'fieldset', '#title' => t('General'), '#group' => 'bootstrap');
// Container.
$form['general']['container'] = array('#type' => 'fieldset', '#title' => t('Container'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['general']['container']['bootstrap_fluid_container'] = array('#type' => 'checkbox', '#title' => t('Fluid container'), '#default_value' => _bootstrap_setting('fluid_container', $theme), '#description' => t('Use <code>.container-fluid</code> class. See <a href="http://getbootstrap.com/css/#grid-example-fluid">Fluid container</a>'));
// Buttons.
$form['general']['buttons'] = array('#type' => 'fieldset', '#title' => t('Buttons'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['general']['buttons']['bootstrap_button_size'] = array('#type' => 'select', '#title' => t('Default button size'), '#default_value' => _bootstrap_setting('button_size', $theme), '#empty_option' => t('Normal'), '#options' => array('btn-xs' => t('Extra Small'), 'btn-sm' => t('Small'), 'btn-lg' => t('Large')));
$form['general']['buttons']['bootstrap_button_colorize'] = array('#type' => 'checkbox', '#title' => t('Colorize Buttons'), '#default_value' => _bootstrap_setting('button_colorize', $theme), '#description' => t('Adds classes to buttons based on their text value. See: <a href="!bootstrap_url" target="_blank">Buttons</a> and <a href="!api_url" target="_blank">hook_bootstrap_colorize_text_alter()</a>', array('!bootstrap_url' => 'http://getbootstrap.com/css/#buttons', '!api_url' => 'http://drupalcode.org/project/bootstrap.git/blob/refs/heads/7.x-3.x:/bootstrap.api.php#l13')));
$form['general']['buttons']['bootstrap_button_iconize'] = array('#type' => 'checkbox', '#title' => t('Iconize Buttons'), '#default_value' => _bootstrap_setting('button_iconize', $theme), '#description' => t('Adds icons to buttons based on the text value. See: <a href="!api_url" target="_blank">hook_bootstrap_iconize_text_alter()</a>', array('!api_url' => 'http://drupalcode.org/project/bootstrap.git/blob/refs/heads/7.x-3.x:/bootstrap.api.php#l37')));
// Forms.
$form['general']['forms'] = array('#type' => 'fieldset', '#title' => t('Forms'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['general']['forms']['bootstrap_forms_required_has_error'] = array('#type' => 'checkbox', '#title' => t('Make required elements display as an error'), '#default_value' => _bootstrap_setting('forms_required_has_error', $theme), '#description' => t('If an element in a form is required, enabling this will always display the element with a <code>.has-error</code> class. This turns the element red and helps in usability for determining which form elements are required to submit the form. This feature compliments the "JavaScript > Forms > Automatically remove error classes when values have been entered" feature.'));
$form['general']['forms']['bootstrap_forms_smart_descriptions'] = array('#type' => 'checkbox', '#title' => t('Smart form descriptions (via Tooltips)'), '#description' => t('Convert descriptions into tooltips (must be enabled) automatically based on certain criteria. This helps reduce the, sometimes unnecessary, amount of noise on a page full of form elements.'), '#default_value' => _bootstrap_setting('forms_smart_descriptions', $theme));
$form['general']['forms']['bootstrap_forms_smart_descriptions_limit'] = array('#type' => 'textfield', '#title' => t('"Smart form descriptions" maximum character limit'), '#description' => t('Prevents descriptions from becoming tooltips by checking the character length of the description (HTML is not counted towards this limit). To disable this filtering criteria, leave an empty value.'), '#default_value' => _bootstrap_setting('forms_smart_descriptions_limit', $theme), '#states' => array('visible' => array(':input[name="bootstrap_forms_smart_descriptions"]' => array('checked' => TRUE))));
$form['general']['forms']['bootstrap_forms_smart_descriptions_allowed_tags'] = array('#type' => 'textfield', '#title' => t('"Smart form descriptions" allowed (HTML) tags'), '#description' => t('Prevents descriptions from becoming tooltips by checking for HTML not in the list above (i.e. links). Separate by commas. To disable this filtering criteria, leave an empty value.'), '#default_value' => _bootstrap_setting('forms_smart_descriptions_allowed_tags', $theme), '#states' => array('visible' => array(':input[name="bootstrap_forms_smart_descriptions"]' => array('checked' => TRUE))));
// Images.
$form['general']['images'] = array('#type' => 'fieldset', '#title' => t('Images'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['general']['images']['bootstrap_image_shape'] = array('#type' => 'select', '#title' => t('Default image shape'), '#description' => t('Add classes to an <code><img></code> element to easily style images in any project. Note: Internet Explorer 8 lacks support for rounded corners. See: <a href="!bootstrap_url" target="_blank">Image Shapes</a>', array('!bootstrap_url' => 'http://getbootstrap.com/css/#images-shapes')), '#default_value' => _bootstrap_setting('image_shape', $theme), '#empty_option' => t('None'), '#options' => array('img-rounded' => t('Rounded'), 'img-circle' => t('Circle'), 'img-thumbnail' => t('Thumbnail')));
$form['general']['images']['bootstrap_image_responsive'] = array('#type' => 'checkbox', '#title' => t('Responsive Images'), '#default_value' => _bootstrap_setting('image_responsive', $theme), '#description' => t('Images in Bootstrap 3 can be made responsive-friendly via the addition of the <code>.img-responsive</code> class. This applies <code>max-width: 100%;</code> and <code>height: auto;</code> to the image so that it scales nicely to the parent element.'));
// Tables.
$form['general']['tables'] = array('#type' => 'fieldset', '#title' => t('Tables'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['general']['tables']['bootstrap_table_bordered'] = array('#type' => 'checkbox', '#title' => t('Bordered table'), '#default_value' => _bootstrap_setting('table_bordered', $theme), '#description' => t('Add borders on all sides of the table and cells.'));
$form['general']['tables']['bootstrap_table_condensed'] = array('#type' => 'checkbox', '#title' => t('Condensed table'), '#default_value' => _bootstrap_setting('table_condensed', $theme), '#description' => t('Make tables more compact by cutting cell padding in half.'));
$form['general']['tables']['bootstrap_table_hover'] = array('#type' => 'checkbox', '#title' => t('Hover rows'), '#default_value' => _bootstrap_setting('table_hover', $theme), '#description' => t('Enable a hover state on table rows.'));
$form['general']['tables']['bootstrap_table_striped'] = array('#type' => 'checkbox', '#title' => t('Striped rows'), '#default_value' => _bootstrap_setting('table_striped', $theme), '#description' => t('Add zebra-striping to any table row within the <code><tbody></code>. <strong>Note:</strong> Striped tables are styled via the <code>:nth-child</code> CSS selector, which is not available in Internet Explorer 8.'));
$form['general']['tables']['bootstrap_table_responsive'] = array('#type' => 'checkbox', '#title' => t('Responsive tables'), '#default_value' => _bootstrap_setting('table_responsive', $theme), '#description' => t('Makes tables responsive by wrapping them in <code>.table-responsive</code> to make them scroll horizontally up to small devices (under 768px). When viewing on anything larger than 768px wide, you will not see any difference in these tables.'));
// Components.
$form['components'] = array('#type' => 'fieldset', '#title' => t('Components'), '#group' => 'bootstrap');
// Breadcrumbs.
$form['components']['breadcrumbs'] = array('#type' => 'fieldset', '#title' => t('Breadcrumbs'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['components']['breadcrumbs']['bootstrap_breadcrumb'] = array('#type' => 'select', '#title' => t('Breadcrumb visibility'), '#default_value' => _bootstrap_setting('breadcrumb', $theme), '#options' => array(0 => t('Hidden'), 1 => t('Visible'), 2 => t('Only in admin areas')));
$form['components']['breadcrumbs']['bootstrap_breadcrumb_home'] = array('#type' => 'checkbox', '#title' => t('Show "Home" breadcrumb link'), '#default_value' => _bootstrap_setting('breadcrumb_home', $theme), '#description' => t('If your site has a module dedicated to handling breadcrumbs already, ensure this setting is enabled.'), '#states' => array('invisible' => array(':input[name="bootstrap_breadcrumb"]' => array('value' => 0))));
$form['components']['breadcrumbs']['bootstrap_breadcrumb_title'] = array('#type' => 'checkbox', '#title' => t('Show current page title at end'), '#default_value' => _bootstrap_setting('breadcrumb_title', $theme), '#description' => t('If your site has a module dedicated to handling breadcrumbs already, ensure this setting is disabled.'), '#states' => array('invisible' => array(':input[name="bootstrap_breadcrumb"]' => array('value' => 0))));
// Navbar.
$form['components']['navbar'] = array('#type' => 'fieldset', '#title' => t('Navbar'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['components']['navbar']['bootstrap_navbar_position'] = array('#type' => 'select', '#title' => t('Navbar Position'), '#description' => t('Select your Navbar position.'), '#default_value' => _bootstrap_setting('navbar_position', $theme), '#options' => array('static-top' => t('Static Top'), 'fixed-top' => t('Fixed Top'), 'fixed-bottom' => t('Fixed Bottom')), '#empty_option' => t('Normal'));
$form['components']['navbar']['bootstrap_navbar_inverse'] = array('#type' => 'checkbox', '#title' => t('Inverse navbar style'), '#description' => t('Select if you want the inverse navbar style.'), '#default_value' => _bootstrap_setting('navbar_inverse', $theme));
// Region wells.
$wells = array('' => t('None'), 'well' => t('.well (normal)'), 'well well-sm' => t('.well-sm (small)'), 'well well-lg' => t('.well-lg (large)'));
$form['components']['region_wells'] = array('#type' => 'fieldset', '#title' => t('Region wells'), '#description' => t('Enable the <code>.well</code>, <code>.well-sm</code> or <code>.well-lg</code> classes for specified regions. See: documentation on !wells.', array('!wells' => l(t('Bootstrap Wells'), 'http://getbootstrap.com/components/#wells'))), '#collapsible' => TRUE, '#collapsed' => TRUE);
// Get defined regions.
$regions = system_region_list($theme);
foreach ($regions as $name => $title) {
$form['components']['region_wells']['bootstrap_region_well-' . $name] = array('#title' => $title, '#type' => 'select', '#attributes' => array('class' => array('input-sm')), '#options' => $wells, '#default_value' => _bootstrap_setting('region_well-' . $name, $theme));
}
// JavaScript settings.
$form['javascript'] = array('#type' => 'fieldset', '#title' => t('JavaScript'), '#group' => 'bootstrap');
// Anchors.
$form['javascript']['anchors'] = array('#type' => 'fieldset', '#title' => t('Anchors'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['javascript']['anchors']['bootstrap_anchors_fix'] = array('#type' => 'checkbox', '#title' => t('Fix anchor positions'), '#default_value' => _bootstrap_setting('anchors_fix', $theme), '#description' => t('Ensures anchors are correctly positioned only when there is margin or padding detected on the BODY element. This is useful when fixed navbar or administration menus are used.'));
$form['javascript']['anchors']['bootstrap_anchors_smooth_scrolling'] = array('#type' => 'checkbox', '#title' => t('Enable smooth scrolling'), '#default_value' => _bootstrap_setting('anchors_smooth_scrolling', $theme), '#description' => t('Animates page by scrolling to an anchor link target smoothly when clicked.'), '#states' => array('invisible' => array(':input[name="bootstrap_anchors_fix"]' => array('checked' => FALSE))));
// Forms.
$form['javascript']['forms'] = array('#type' => 'fieldset', '#title' => t('Forms'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['javascript']['forms']['bootstrap_forms_has_error_value_toggle'] = array('#type' => 'checkbox', '#title' => t('Automatically remove error classes when values have been entered'), '#default_value' => _bootstrap_setting('forms_has_error_value_toggle', $theme), '#description' => t('If an element has a <code>.has-error</code> class attached to it, enabling this will automatically remove that class when a value is entered. This feature compliments the "General > Forms > Make required elements display as an error" feature.'));
// Popovers.
$form['javascript']['popovers'] = array('#type' => 'fieldset', '#title' => t('Popovers'), '#description' => t('Add small overlays of content, like those on the iPad, to any element for housing secondary information.'), '#collapsible' => TRUE, '#collapsed' => TRUE);
$form['javascript']['popovers']['bootstrap_popover_enabled'] = array('#type' => 'checkbox', '#title' => t('Enable popovers.'), '#description' => t('Elements that have the !code attribute set will automatically initialize the popover upon page load. !warning', array('!code' => '<code>data-toggle="popover"</code>', '!warning' => '<strong class="error text-error">WARNING: This feature can sometimes impact performance. Disable if pages appear to "hang" after initial load.</strong>')), '#default_value' => _bootstrap_setting('popover_enabled', $theme));
$form['javascript']['popovers']['options'] = array('#type' => 'fieldset', '#title' => t('Options'), '#description' => t('These are global options. Each popover can independently override desired settings by appending the option name to !data. Example: !data-animation.', array('!data' => '<code>data-</code>', '!data-animation' => '<code>data-animation="false"</code>')), '#collapsible' => TRUE, '#collapsed' => TRUE, '#states' => array('visible' => array(':input[name="bootstrap_popover_enabled"]' => array('checked' => TRUE))));
$form['javascript']['popovers']['options']['bootstrap_popover_animation'] = array('#type' => 'checkbox', '#title' => t('animate'), '#description' => t('Apply a CSS fade transition to the popover.'), '#default_value' => _bootstrap_setting('popover_animation', $theme));
$form['javascript']['popovers']['options']['bootstrap_popover_html'] = array('#type' => 'checkbox', '#title' => t('HTML'), '#description' => t("Insert HTML into the popover. If false, jQuery's text method will be used to insert content into the DOM. Use text if you're worried about XSS attacks."), '#default_value' => _bootstrap_setting('popover_html', $theme));
$form['javascript']['popovers']['options']['bootstrap_popover_placement'] = array('#type' => 'select', '#title' => t('placement'), '#description' => t('Where to position the popover. When "auto" is specified, it will dynamically reorient the popover. For example, if placement is "auto left", the popover will display to the left when possible, otherwise it will display right.'), '#default_value' => _bootstrap_setting('popover_placement', $theme), '#options' => drupal_map_assoc(array('top', 'bottom', 'left', 'right', 'auto', 'auto top', 'auto bottom', 'auto left', 'auto right')));
$form['javascript']['popovers']['options']['bootstrap_popover_selector'] = array('#type' => 'textfield', '#title' => t('selector'), '#description' => t('If a selector is provided, tooltip objects will be delegated to the specified targets. In practice, this is used to enable dynamic HTML content to have popovers added. See !this and !example.', array('!this' => l(t('this'), 'https://github.com/twbs/bootstrap/issues/4215'), '!example' => l(t('an informative example'), 'http://jsfiddle.net/fScua/'))), '#default_value' => _bootstrap_setting('popover_selector', $theme));
$form['javascript']['popovers']['options']['bootstrap_popover_trigger'] = array('#type' => 'checkboxes', '#title' => t('trigger'), '#description' => t('How a popover is triggered.'), '#default_value' => _bootstrap_setting('popover_trigger', $theme), '#options' => drupal_map_assoc(array('click', 'hover', 'focus', 'manual')));
$form['javascript']['popovers']['options']['bootstrap_popover_trigger_autoclose'] = array('#type' => 'checkbox', '#title' => t('Auto-close on document click'), '#description' => t('Will automatically close the current popover if a click occurs anywhere else other than the popover element.'
|
请发表评论