29 lines
560 B
PHP
29 lines
560 B
PHP
<?php
|
|
|
|
namespace NoccyLabs\Hotfix\Hotfix\Loader;
|
|
|
|
class PastebinLoader implements LoaderInterface
|
|
{
|
|
public function load($fix)
|
|
{
|
|
if (!preg_match('/^pastebin\:/i', $fix)) {
|
|
return false;
|
|
}
|
|
|
|
$pasteId = substr($fix, 9);
|
|
|
|
$url = "https://pastebin.com/raw/{$pasteId}";
|
|
$body = file_get_contents($url);
|
|
|
|
$body = str_replace("\r\n", "\n", $body);
|
|
|
|
return $body;
|
|
|
|
}
|
|
|
|
public function getInfo()
|
|
{
|
|
return "pastebin:<info>paste-id</info> - Read hotfix from Pastebin";
|
|
}
|
|
}
|