hotfix: Removed old code
This commit is contained in:
		@@ -1,23 +0,0 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace NoccyLabs\Hotfix\Hotfix\Loader;
 | 
			
		||||
 | 
			
		||||
class FileLoader implements LoaderInterface
 | 
			
		||||
{
 | 
			
		||||
    public function load($fix)
 | 
			
		||||
    {
 | 
			
		||||
        if ($fix[0] !== '/') {
 | 
			
		||||
            $fix = getcwd()."/".$fix;
 | 
			
		||||
        }
 | 
			
		||||
        if (file_exists($fix)) {
 | 
			
		||||
            $hotfix = file_get_contents($fix);
 | 
			
		||||
            return $hotfix;
 | 
			
		||||
        }
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getInfo()
 | 
			
		||||
    {
 | 
			
		||||
        return "<info>filename</info> - Read a hotfix from a file";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,23 +0,0 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace NoccyLabs\Hotfix\Hotfix\Loader;
 | 
			
		||||
 | 
			
		||||
class GistLoader implements LoaderInterface
 | 
			
		||||
{
 | 
			
		||||
    public function load($fix)
 | 
			
		||||
    {
 | 
			
		||||
        if (!preg_match('/^gist\:/i', $fix)) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $url = "https://gist.githubusercontent.com/" . substr($fix, 5) . "/raw";
 | 
			
		||||
 | 
			
		||||
        return file_get_contents($url);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getInfo()
 | 
			
		||||
    {
 | 
			
		||||
        return "gist:<info>user</info>/<info>gist-id</info> - Read hotfix from a Gist";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,20 +0,0 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace NoccyLabs\Hotfix\Hotfix\Loader;
 | 
			
		||||
 | 
			
		||||
class HttpLoader implements LoaderInterface
 | 
			
		||||
{
 | 
			
		||||
    public function load($fix)
 | 
			
		||||
    {
 | 
			
		||||
        if (preg_match("/^http[s]?:/", $fix)) {
 | 
			
		||||
            $body = file_get_contents($fix);
 | 
			
		||||
            return $body;
 | 
			
		||||
        }
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getInfo()
 | 
			
		||||
    {
 | 
			
		||||
        return "http(s)://<info>url</info> - Read hotfix from a URL";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,8 +0,0 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
namespace NoccyLabs\Hotfix\Hotfix\Loader;
 | 
			
		||||
 | 
			
		||||
interface LoaderInterface
 | 
			
		||||
{
 | 
			
		||||
    public function load($fix);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,28 +0,0 @@
 | 
			
		||||
<?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";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user