From a29d9984fab22ad4c9f5b4282b918f9709059790 Mon Sep 17 00:00:00 2001 From: samiahmedsiddiqui Date: Thu, 21 Feb 2019 12:59:57 +0500 Subject: [PATCH] Issue #3034591 by sasiddiqui: stripping out value from script src --- header_and_footer_scripts.module | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) mode change 100755 => 100644 header_and_footer_scripts.module diff --git a/header_and_footer_scripts.module b/header_and_footer_scripts.module old mode 100755 new mode 100644 index 5a796c1..0655f71 --- a/header_and_footer_scripts.module +++ b/header_and_footer_scripts.module @@ -68,8 +68,8 @@ function header_and_footer_scripts_page_top(array &$page_top) { } $attr_key_value = explode('=', $attr); - if (isset($attr_key_value[0]) && isset($attr_key_value[1])) { - $style_attr[$attr_key_value[0]] = $attr_key_value[1]; + if (2 <= count($attr_key_value)) { + $style_attr[$attr_key_value[0]] = preg_replace('/' . $attr_key_value[0] . '=/', '', $attr, 1); } else { $style_attr[$attr_key_value[0]] = $attr_key_value[0]; @@ -126,8 +126,8 @@ function header_and_footer_scripts_page_top(array &$page_top) { } $attr_key_value = explode('=', $attr); - if (isset($attr_key_value[0]) && isset($attr_key_value[1])) { - $script_attr[$attr_key_value[0]] = $attr_key_value[1]; + if (2 <= count($attr_key_value)) { + $script_attr[$attr_key_value[0]] = preg_replace('/' . $attr_key_value[0] . '=/', '', $attr, 1); } else { $script_attr[$attr_key_value[0]] = $attr_key_value[0]; @@ -194,8 +194,8 @@ function header_and_footer_scripts_page_bottom(array &$page_bottom) { } $attr_key_value = explode('=', $attr); - if (isset($attr_key_value[0]) && isset($attr_key_value[1])) { - $style_attr[$attr_key_value[0]] = $attr_key_value[1]; + if (2 <= count($attr_key_value)) { + $style_attr[$attr_key_value[0]] = preg_replace('/' . $attr_key_value[0] . '=/', '', $attr, 1); } else { $style_attr[$attr_key_value[0]] = $attr_key_value[0]; @@ -252,8 +252,8 @@ function header_and_footer_scripts_page_bottom(array &$page_bottom) { } $attr_key_value = explode('=', $attr); - if (isset($attr_key_value[0]) && isset($attr_key_value[1])) { - $script_attr[$attr_key_value[0]] = $attr_key_value[1]; + if (2 <= count($attr_key_value)) { + $script_attr[$attr_key_value[0]] = preg_replace('/' . $attr_key_value[0] . '=/', '', $attr, 1); } else { $script_attr[$attr_key_value[0]] = $attr_key_value[0]; @@ -320,8 +320,8 @@ function header_and_footer_scripts_page_attachments_alter(array &$attachments) { } $attr_key_value = explode('=', $attr); - if (isset($attr_key_value[0]) && isset($attr_key_value[1])) { - $style_attr[$attr_key_value[0]] = $attr_key_value[1]; + if (2 <= count($attr_key_value)) { + $style_attr[$attr_key_value[0]] = preg_replace('/' . $attr_key_value[0] . '=/', '', $attr, 1); } else { $style_attr[$attr_key_value[0]] = $attr_key_value[0]; @@ -381,8 +381,8 @@ function header_and_footer_scripts_page_attachments_alter(array &$attachments) { } $attr_key_value = explode('=', $attr); - if (isset($attr_key_value[0]) && isset($attr_key_value[1])) { - $script_attr[$attr_key_value[0]] = $attr_key_value[1]; + if (2 <= count($attr_key_value)) { + $script_attr[$attr_key_value[0]] = preg_replace('/' . $attr_key_value[0] . '=/', '', $attr, 1); } else { $script_attr[$attr_key_value[0]] = $attr_key_value[0];