Projet

Général

Profil

Révision b0dc3a2e

Ajouté par Julien Enselme il y a plus de 7 ans

Update to Drupal 7.52

Voir les différences:

drupal7/modules/system/system.module
2705 2705
 * @param $show
2706 2706
 *   Possible values: REGIONS_ALL or REGIONS_VISIBLE. Visible excludes hidden
2707 2707
 *   regions.
2708
 * @return
2709
 *   An array of regions in the form $region['name'] = 'description'.
2708
 * @param bool $labels
2709
 *   (optional) Boolean to specify whether the human readable machine names
2710
 *   should be returned or not. Defaults to TRUE, but calling code can set
2711
 *   this to FALSE for better performance, if it only needs machine names.
2712
 *
2713
 * @return array
2714
 *   An associative array of regions in the form $region['name'] = 'description'
2715
 *   if $labels is set to TRUE, or $region['name'] = 'name', if $labels is set
2716
 *   to FALSE.
2710 2717
 */
2711
function system_region_list($theme_key, $show = REGIONS_ALL) {
2718
function system_region_list($theme_key, $show = REGIONS_ALL, $labels = TRUE) {
2712 2719
  $themes = list_themes();
2713 2720
  if (!isset($themes[$theme_key])) {
2714 2721
    return array();
......
2719 2726
  // If requested, suppress hidden regions. See block_admin_display_form().
2720 2727
  foreach ($info['regions'] as $name => $label) {
2721 2728
    if ($show == REGIONS_ALL || !isset($info['regions_hidden']) || !in_array($name, $info['regions_hidden'])) {
2722
      $list[$name] = t($label);
2729
      if ($labels) {
2730
        $list[$name] = t($label);
2731
      }
2732
      else {
2733
        $list[$name] = $name;
2734
      }
2723 2735
    }
2724 2736
  }
2725

  
2726 2737
  return $list;
2727 2738
}
2728 2739

  
......
2743 2754
 *
2744 2755
 * @param $theme
2745 2756
 *   The name of a theme.
2757
 *
2746 2758
 * @return
2747 2759
 *   A string that is the region name.
2748 2760
 */
2749 2761
function system_default_region($theme) {
2750
  $regions = array_keys(system_region_list($theme, REGIONS_VISIBLE));
2751
  return isset($regions[0]) ? $regions[0] : '';
2762
  $regions = system_region_list($theme, REGIONS_VISIBLE, FALSE);
2763
  return $regions ? reset($regions) : '';
2752 2764
}
2753 2765

  
2754 2766
/**
......
2871 2883

  
2872 2884
  // Prepare cancel link.
2873 2885
  if (isset($_GET['destination'])) {
2874
    $options = drupal_parse_url(urldecode($_GET['destination']));
2886
    $options = drupal_parse_url($_GET['destination']);
2875 2887
  }
2876 2888
  elseif (is_array($path)) {
2877 2889
    $options = $path;
......
3317 3329
  $form['url'] = array(
3318 3330
    '#type' => 'textfield',
3319 3331
    '#title' => t('URL'),
3320
    '#description' => t('The URL to which the user should be redirected. This can be an internal URL like node/1234 or an external URL like http://drupal.org.'),
3332
    '#description' => t('The URL to which the user should be redirected. This can be an internal path like node/1234 or an external URL like http://example.com.'),
3321 3333
    '#default_value' => isset($context['url']) ? $context['url'] : '',
3322 3334
    '#required' => TRUE,
3323 3335
  );
......
3354 3366
 */
3355 3367
function system_block_ip_action() {
3356 3368
  $ip = ip_address();
3357
  db_insert('blocked_ips')
3369
  db_merge('blocked_ips')
3370
    ->key(array('ip' => $ip))
3358 3371
    ->fields(array('ip' => $ip))
3359 3372
    ->execute();
3360 3373
  watchdog('action', 'Banned IP address %ip', array('%ip' => $ip));
......
3516 3529
function system_page_alter(&$page) {
3517 3530
  // Find all non-empty page regions, and add a theme wrapper function that
3518 3531
  // allows them to be consistently themed.
3519
  $regions = system_region_list($GLOBALS['theme']);
3520
  foreach (array_keys($regions) as $region) {
3532
  foreach (system_region_list($GLOBALS['theme'], REGIONS_ALL, FALSE) as $region) {
3521 3533
    if (!empty($page[$region])) {
3522 3534
      $page[$region]['#theme_wrappers'][] = 'region';
3523 3535
      $page[$region]['#region'] = $region;

Formats disponibles : Unified diff