summaryrefslogtreecommitdiff
path: root/scripts/ext_skel_ng/license.php
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/ext_skel_ng/license.php')
-rw-r--r--scripts/ext_skel_ng/license.php42
1 files changed, 42 insertions, 0 deletions
diff --git a/scripts/ext_skel_ng/license.php b/scripts/ext_skel_ng/license.php
new file mode 100644
index 0000000000..a2ed879902
--- /dev/null
+++ b/scripts/ext_skel_ng/license.php
@@ -0,0 +1,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();
+}
+
+
+?> \ No newline at end of file