Project

General

Profile

Revision b0dc3a2e

Added by Julien Enselme over 7 years ago

Update to Drupal 7.52

View differences:

drupal7/includes/common.inc
760 760
 *   - headers: An array containing request headers to send as name/value pairs.
761 761
 *   - method: A string containing the request method. Defaults to 'GET'.
762 762
 *   - data: A string containing the request body, formatted as
763
 *     'param=value&param=value&...'. Defaults to NULL.
763
 *     'param=value&param=value&...'; to generate this, use http_build_query().
764
 *     Defaults to NULL.
764 765
 *   - max_redirects: An integer representing how many times a redirect
765 766
 *     may be followed. Defaults to 3.
766 767
 *   - timeout: A float representing the maximum number of seconds the function
......
785 786
 *     HTTP header names are case-insensitive (RFC 2616, section 4.2), so for
786 787
 *     easy access the array keys are returned in lower case.
787 788
 *   - data: A string containing the response body that was received.
789
 *
790
 * @see http_build_query()
788 791
 */
789 792
function drupal_http_request($url, array $options = array()) {
790 793
  // Allow an alternate HTTP client library to replace Drupal's default
......
1767 1770
 *     - 'key': element name
1768 1771
 *     - 'value': element contents
1769 1772
 *     - 'attributes': associative array of element attributes
1773
 *     - 'encoded': TRUE if 'value' is already encoded
1770 1774
 *
1771 1775
 * In both cases, 'value' can be a simple string, or it can be another array
1772 1776
 * with the same format as $array itself for nesting.
1777
 *
1778
 * If 'encoded' is TRUE it is up to the caller to ensure that 'value' is either
1779
 * entity-encoded or CDATA-escaped. Using this option is not recommended when
1780
 * working with untrusted user input, since failing to escape the data
1781
 * correctly has security implications.
1773 1782
 */
1774 1783
function format_xml_elements($array) {
1775 1784
  $output = '';
......
1782 1791
        }
1783 1792

  
1784 1793
        if (isset($value['value']) && $value['value'] != '') {
1785
          $output .= '>' . (is_array($value['value']) ? format_xml_elements($value['value']) : check_plain($value['value'])) . '</' . $value['key'] . ">\n";
1794
          $output .= '>' . (is_array($value['value']) ? format_xml_elements($value['value']) : (!empty($value['encoded']) ? $value['value'] : check_plain($value['value']))) . '</' . $value['key'] . ">\n";
1786 1795
        }
1787 1796
        else {
1788 1797
          $output .= " />\n";
......
2644 2653
  global $language;
2645 2654
  drupal_add_http_header('Content-Language', $language->language);
2646 2655

  
2656
  // By default, do not allow the site to be rendered in an iframe on another
2657
  // domain, but provide a variable to override this. If the code running for
2658
  // this page request already set the X-Frame-Options header earlier, don't
2659
  // overwrite it here.
2660
  $frame_options = variable_get('x_frame_options', 'SAMEORIGIN');
2661
  if ($frame_options && is_null(drupal_get_http_header('X-Frame-Options'))) {
2662
    drupal_add_http_header('X-Frame-Options', $frame_options);
2663
  }
2664

  
2647 2665
  // Menu status constants are integers; page content is a string or array.
2648 2666
  if (is_int($page_callback_result)) {
2649 2667
    // @todo: Break these up into separate functions?
......
2758 2776
  _registry_check_code(REGISTRY_WRITE_LOOKUP_CACHE);
2759 2777
  drupal_cache_system_paths();
2760 2778
  module_implements_write_cache();
2779
  drupal_file_scan_write_cache();
2761 2780
  system_run_automated_cron();
2762 2781
}
2763 2782

  
......
3025 3044
 */
3026 3045
function drupal_add_css($data = NULL, $options = NULL) {
3027 3046
  $css = &drupal_static(__FUNCTION__, array());
3047
  $count = &drupal_static(__FUNCTION__ . '_count', 0);
3048

  
3049
  // If the $css variable has been reset with drupal_static_reset(), there is
3050
  // no longer any CSS being tracked, so set the counter back to 0 also.
3051
  if (count($css) === 0) {
3052
    $count = 0;
3053
  }
3028 3054

  
3029 3055
  // Construct the options, taking the defaults into consideration.
3030 3056
  if (isset($options)) {
......
3060 3086
    }
3061 3087

  
3062 3088
    // Always add a tiny value to the weight, to conserve the insertion order.
3063
    $options['weight'] += count($css) / 1000;
3089
    $options['weight'] += $count / 1000;
3090
    $count++;
3064 3091

  
3065 3092
    // Add the data to the CSS array depending on the type.
3066 3093
    switch ($options['type']) {
......
3873 3900
 *   The cleaned identifier.
3874 3901
 */
3875 3902
function drupal_clean_css_identifier($identifier, $filter = array(' ' => '-', '_' => '-', '/' => '-', '[' => '-', ']' => '')) {
3903
  // Use the advanced drupal_static() pattern, since this is called very often.
3904
  static $drupal_static_fast;
3905
  if (!isset($drupal_static_fast)) {
3906
    $drupal_static_fast['allow_css_double_underscores'] = &drupal_static(__FUNCTION__ . ':allow_css_double_underscores');
3907
  }
3908
  $allow_css_double_underscores = &$drupal_static_fast['allow_css_double_underscores'];
3909
  if (!isset($allow_css_double_underscores)) {
3910
    $allow_css_double_underscores = variable_get('allow_css_double_underscores', FALSE);
3911
  }
3912

  
3913
  // Preserve BEM-style double-underscores depending on custom setting.
3914
  if ($allow_css_double_underscores) {
3915
    $filter['__'] = '__';
3916
  }
3917

  
3876 3918
  // By default, we filter using Drupal's coding standards.
3877 3919
  $identifier = strtr($identifier, $filter);
3878 3920

  

Also available in: Unified diff