+ /**
+ * @param string $name
+ * Name of the variable to be retrieved.
+ *
+ * @param array $method - '$_GET', '$_POST' or '$_REQUEST'.
+ *
+ * @return mixed
+ * The value of the variable
+ */
+ public static function getValue($name, $method) {
+ if (isset($method[$name])) {
+ return $method[$name];
+ }
+ // CRM-18384 - decode incorrect keys generated when & is present in url
+ foreach ($method as $key => $value) {
+ if (strpos($key, 'amp;') !== FALSE) {
+ $method[str_replace('amp;', '', $key)] = $method[$key];
+ if (isset($method[$name])) {
+ return $method[$name];
+ }
+ else {
+ continue;
+ }
+ }
+ }
+ return NULL;
+ }
+