Projet

Général

Profil

Révision b4adf10d

Ajouté par Assos Assos il y a plus de 9 ans

Udpate to 7.33

Voir les différences:

drupal7/includes/common.inc
985 985
  $response = preg_split("/\r\n|\n|\r/", $response);
986 986

  
987 987
  // Parse the response status line.
988
  list($protocol, $code, $status_message) = explode(' ', trim(array_shift($response)), 3);
989
  $result->protocol = $protocol;
990
  $result->status_message = $status_message;
988
  $response_status_array = _drupal_parse_response_status(trim(array_shift($response)));
989
  $result->protocol = $response_status_array['http_version'];
990
  $result->status_message = $response_status_array['reason_phrase'];
991
  $code = $response_status_array['response_code'];
991 992

  
992 993
  $result->headers = array();
993 994

  
......
1078 1079
      }
1079 1080
      break;
1080 1081
    default:
1081
      $result->error = $status_message;
1082
      $result->error = $result->status_message;
1082 1083
  }
1083 1084

  
1084 1085
  return $result;
1085 1086
}
1086 1087

  
1088
/**
1089
 * Splits an HTTP response status line into components.
1090
 *
1091
 * See the @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html status line definition @endlink
1092
 * in RFC 2616.
1093
 *
1094
 * @param string $respone
1095
 *   The response status line, for example 'HTTP/1.1 500 Internal Server Error'.
1096
 *
1097
 * @return array
1098
 *   Keyed array containing the component parts. If the response is malformed,
1099
 *   all possible parts will be extracted. 'reason_phrase' could be empty.
1100
 *   Possible keys:
1101
 *   - 'http_version'
1102
 *   - 'response_code'
1103
 *   - 'reason_phrase'
1104
 */
1105
function _drupal_parse_response_status($response) {
1106
  $response_array = explode(' ', trim($response), 3);
1107
  // Set up empty values.
1108
  $result = array(
1109
    'reason_phrase' => '',
1110
  );
1111
  $result['http_version'] = $response_array[0];
1112
  $result['response_code'] = $response_array[1];
1113
  if (isset($response_array[2])) {
1114
    $result['reason_phrase'] = $response_array[2];
1115
  }
1116
  return $result;
1117
}
1118

  
1087 1119
/**
1088 1120
 * Helper function for determining hosts excluded from needing a proxy.
1089 1121
 *
......
3442 3474
            $import_batch = array_slice($import, 0, 31);
3443 3475
            $import = array_slice($import, 31);
3444 3476
            $element = $style_element_defaults;
3445
            $element['#value'] = implode("\n", $import_batch);
3477
            // This simplifies the JavaScript regex, allowing each line
3478
            // (separated by \n) to be treated as a completely different string.
3479
            // This means that we can use ^ and $ on one line at a time, and not
3480
            // worry about style tags since they'll never match the regex.
3481
            $element['#value'] = "\n" . implode("\n", $import_batch) . "\n";
3446 3482
            $element['#attributes']['media'] = $group['media'];
3447 3483
            $element['#browsers'] = $group['browsers'];
3448 3484
            $elements[] = $element;
......
3768 3804
  // Alter all internal url() paths. Leave external paths alone. We don't need
3769 3805
  // to normalize absolute paths here (i.e. remove folder/... segments) because
3770 3806
  // that will be done later.
3771
  return preg_replace('/url\(\s*([\'"]?)(?![a-z]+:|\/+)/i', 'url(\1'. $directory, $file);
3807
  return preg_replace('/url\(\s*([\'"]?)(?![a-z]+:|\/+)([^\'")]+)([\'"]?)\s*\)/i', 'url(\1' . $directory . '\2\3)', $file);
3772 3808
}
3773 3809

  
3774 3810
/**
......
5255 5291
    foreach ($queues as $queue_name => $info) {
5256 5292
      DrupalQueue::get($queue_name)->createQueue();
5257 5293
    }
5258
    // Register shutdown callback.
5259
    drupal_register_shutdown_function('drupal_cron_cleanup');
5260 5294

  
5261 5295
    // Iterate through the modules calling their cron handlers (if any):
5262 5296
    foreach (module_implements('cron') as $module) {
......
5308 5342
}
5309 5343

  
5310 5344
/**
5311
 * Shutdown function: Performs cron cleanup.
5345
 * DEPRECATED: Shutdown function: Performs cron cleanup.
5312 5346
 *
5313
 * @see drupal_cron_run()
5314
 * @see drupal_register_shutdown_function()
5347
 * This function is deprecated because the 'cron_semaphore' variable it
5348
 * references no longer exists. It is therefore no longer used as a shutdown
5349
 * function by Drupal core.
5350
 *
5351
 * @deprecated
5315 5352
 */
5316 5353
function drupal_cron_cleanup() {
5317 5354
  // See if the semaphore is still locked.
......
6636 6673
 * $value = drupal_array_get_nested_value($form, $parents);
6637 6674
 * @endcode
6638 6675
 *
6639
 * The return value will be NULL, regardless of whether the actual value is NULL
6640
 * or whether the requested key does not exist. If it is required to know
6641
 * whether the nested array key actually exists, pass a third argument that is
6642
 * altered by reference:
6676
 * A return value of NULL is ambiguous, and can mean either that the requested
6677
 * key does not exist, or that the actual value is NULL. If it is required to
6678
 * know whether the nested array key actually exists, pass a third argument that
6679
 * is altered by reference:
6643 6680
 * @code
6644 6681
 * $key_exists = NULL;
6645 6682
 * $value = drupal_array_get_nested_value($form, $parents, $key_exists);
......
7898 7935
  }
7899 7936
}
7900 7937

  
7938
/**
7939
 * Invoke hook_entity_view_mode_alter().
7940
 *
7941
 * If adding a new entity similar to nodes, comments or users, you should invoke
7942
 * this function during the ENTITY_build_content() or ENTITY_view_multiple()
7943
 * phases of rendering to allow other modules to alter the view mode during this
7944
 * phase. This function needs to be called before field_attach_prepare_view() to
7945
 * ensure that the correct content is loaded by field API.
7946
 *
7947
 * @param $entity_type
7948
 *   The type of entity, i.e. 'node', 'user'.
7949
 * @param $entities
7950
 *   The entity objects which are being prepared for view, keyed by object ID.
7951
 * @param $view_mode
7952
 *   The original view mode e.g. 'full', 'teaser'...
7953
 * @param $langcode
7954
 *   (optional) A language code to be used for rendering. Defaults to the global
7955
 *   content language of the current request.
7956
 * @return
7957
 *   An associative array with arrays of entities keyed by view mode.
7958
 *
7959
 * @see hook_entity_view_mode_alter()
7960
 */
7961
function entity_view_mode_prepare($entity_type, $entities, $view_mode, $langcode = NULL) {
7962
  if (!isset($langcode)) {
7963
    $langcode = $GLOBALS['language_content']->language;
7964
  }
7965

  
7966
  // To ensure hooks are never run after field_attach_prepare_view() only
7967
  // process items without the entity_view_prepared flag.
7968
  $entities_by_view_mode = array();
7969
  foreach ($entities as $id => $entity) {
7970
    $entity_view_mode = $view_mode;
7971
    if (empty($entity->entity_view_prepared)) {
7972

  
7973
      // Allow modules to change the view mode.
7974
      $context = array(
7975
        'entity_type' => $entity_type,
7976
        'entity' => $entity,
7977
        'langcode' => $langcode,
7978
      );
7979
      drupal_alter('entity_view_mode', $entity_view_mode, $context);
7980
    }
7981

  
7982
    $entities_by_view_mode[$entity_view_mode][$id] = $entity;
7983
  }
7984

  
7985
  return $entities_by_view_mode;
7986
}
7987

  
7901 7988
/**
7902 7989
 * Returns the URI elements of an entity.
7903 7990
 *

Formats disponibles : Unified diff