Files
php-hotfix/src/Hotfix/Loader/PastebinLoader.php

24 lines
440 B
PHP
Raw Normal View History

2016-04-19 15:54:03 +02:00
<?php
namespace NoccyLabs\Hotfix\Hotfix\Loader;
class PastebinLoader implements LoaderInterface
{
public function load($fix)
{
if (!preg_match('/^pastebin\:/i', $fix)) {
return false;
}
2016-04-19 16:30:47 +02:00
$pasteId = substr($fix, 9);
$url = "https://pastebin.com/raw/{$pasteId}";
$body = file_get_contents($url);
$body = str_replace("\r\n", "\n", $body);
return $body;
2016-04-19 15:54:03 +02:00
}
}