summaryrefslogtreecommitdiff
path: root/scripts/ext_skel_ng/license.php
blob: a2ed8799024a9e60e078e75907f80800093db975 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php

abstract class license 
{
	function __construct($options = array()) {
		$this->options = $options;
	}

	static function factory($name, $options=array()) {
		$classname = "license_".strtolower($name);

		if (!class_exists($classname)) {
			if (file_exists("./$classname.php")) {
				require_once "./$classname.php";
			}
		}

		return 
			class_exists($classname) 
			? new $classname($options) 
			: false;
	}

	abstract function license_comment();

	function write_license_file($path = "./LICENSE") {
		$fp = fopen($path, "w");

		if (is_resource($fp)) {
			fputs($fp, $this->license_file_text()); 
			fclose($fp);
			return true;
		}

		return false;
	}
	
	abstract function license_file_text();
}


?>