- private function removeFirefoxAboutReader($input){
- $output_array = [];
- preg_match("%^about://reader\?url=(.*)%", $input, $output_array);
- if(!empty($output_array)){
- $extractedUrl = preg_replace("%^about://reader\?url=(.*)%", "$1", $input);
- $url = urldecode($extractedUrl);
- }else{
- $url = $input;
- }
- return $url;
+ /**
+ * Remove Firefox Reader prefix if it's present.
+ *
+ * @param string $input url
+ *
+ * @return string cleaned url
+ */
+ protected static function removeFirefoxAboutReader($input)
+ {
+ $firefoxPrefix = 'about://reader?url=';
+ if (startsWith($input, $firefoxPrefix)) {
+ return urldecode(ltrim($input, $firefoxPrefix));
+ }
+ return $input;