Implemented gist and pastebin loaders
This commit is contained in:
		@@ -9,5 +9,10 @@ class GistLoader implements LoaderInterface
 | 
				
			|||||||
        if (!preg_match('/^gist\:/i', $fix)) {
 | 
					        if (!preg_match('/^gist\:/i', $fix)) {
 | 
				
			||||||
            return false;
 | 
					            return false;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $url = "https://gist.githubusercontent.com/" . substr($fix, 5) . "/raw";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return file_get_contents($url);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,5 +9,15 @@ class PastebinLoader implements LoaderInterface
 | 
				
			|||||||
        if (!preg_match('/^pastebin\:/i', $fix)) {
 | 
					        if (!preg_match('/^pastebin\:/i', $fix)) {
 | 
				
			||||||
            return false;
 | 
					            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;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user