Code Duplication    Length = 9-9 lines in 2 locations

Sources/Subs-Editor.php 2 locations

@@ 704-712 (lines=9) @@
701
		if (!empty($src))
702
		{
703
			// Attempt to fix the path in case it's not present.
704
			if (preg_match('~^https?://~i', $src) === 0 && is_array($parsedURL = parse_url($scripturl)) && isset($parsedURL['host']))
705
			{
706
				$baseURL = (isset($parsedURL['scheme']) ? $parsedURL['scheme'] : 'http') . '://' . $parsedURL['host'] . (empty($parsedURL['port']) ? '' : ':' . $parsedURL['port']);
707
708
				if (substr($src, 0, 1) === '/')
709
					$src = $baseURL . $src;
710
				else
711
					$src = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $src;
712
			}
713
714
			$tag = '[img' . $params . ']' . $src . '[/img]';
715
		}
@@ 927-935 (lines=9) @@
924
				}
925
926
				// No http(s), so attempt to fix this potential relative URL.
927
				elseif (preg_match('~^https?://~i', $href) === 0 && is_array($parsedURL = parse_url($scripturl)) && isset($parsedURL['host']))
928
				{
929
					$baseURL = (isset($parsedURL['scheme']) ? $parsedURL['scheme'] : 'http') . '://' . $parsedURL['host'] . (empty($parsedURL['port']) ? '' : ':' . $parsedURL['port']);
930
931
					if (substr($href, 0, 1) === '/')
932
						$href = $baseURL . $href;
933
					else
934
						$href = $baseURL . (empty($parsedURL['path']) ? '/' : preg_replace('~/(?:index\\.php)?$~', '', $parsedURL['path'])) . '/' . $href;
935
				}
936
			}
937
938
			// External URL?