php-src/scripts/ext_skel_ng/license.php
Hartmut Holzgraefe ddefccd04a license comment headers and license files are now created
by seperate classes for each license
2003-04-26 15:01:31 +00:00

42 lines
No EOL
711 B
PHP

<?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();
}
?>