|
From: alex <bin...@li...> - 2001-08-24 19:29:48
|
alex Fri Aug 24 12:29:37 2001 EDT
Modified files:
/r2/binarycloud/base/init prepend.php
/r2/binarycloud/user/htdocs index.xml.php
Log:
Added Andi's params function
Index: r2/binarycloud/base/init/prepend.php
diff -u r2/binarycloud/base/init/prepend.php:1.4 r2/binarycloud/base/init/prepend.php:1.5
--- r2/binarycloud/base/init/prepend.php:1.4 Mon Aug 20 12:30:29 2001
+++ r2/binarycloud/base/init/prepend.php Fri Aug 24 12:29:36 2001
@@ -1,7 +1,7 @@
<?php
// {{{ Header
/*
- * -File $Id: prepend.php,v 1.4 2001/08/20 19:30:29 alex Exp $
+ * -File $Id: prepend.php,v 1.5 2001/08/24 19:29:36 alex Exp $
* -License LGPL (http://www.gnu.org/copyleft/lesser.html)
* -Copyright 2001, Intacct Corp.
* -Author odysseas tsatalos, ody...@ya...
@@ -18,6 +18,17 @@
// }}}
// function import($_file) {{{
+/**
+ * This function allows developers to specify a package & class name, and
+ * have a class included from that.
+ *
+ * @param object The object instance this functions should applied to
+ * @param array The parameter array passed to the constructor
+ * @return bool True/false
+ * @author odysseas, ody...@bi...
+ * @access public
+ */
+
function import($_file) {
global $sImportMap;
if ($sImportMap[$_file]) { return true; }
@@ -35,6 +46,38 @@
}
return false;
}
+// }}}
+
+// function extract_params {{{
+/**
+ * Non class method extract_params extracts the params passed to
+ * a module to class vars.
+ * Called within the constructor method of you module like:
+ *
+ * extract_params($this, $_params)
+ *
+ * It actually does the following:
+ *
+ * - copies $_params to $this->params
+ * - references each key of $this->params to $this->key
+ *
+ * @param object The object instance this functions should applied to
+ * @param array The parameter array passed to the constructor
+ * @return bool True/false
+ * @author Andreas Aderhold, an...@bi...
+ * @access public
+ */
+
+function extract_params(&$_cls, $_params) {
+ if (!is_array($_params)) {
+ return;
+}
+ $_cls->params = $_params;
+ foreach (array_keys($_cls->params) as $name) {
+ $_cls->$name =& $_cls->params[$name];
+ }
+}
+
// }}}
?>
Index: r2/binarycloud/user/htdocs/index.xml.php
diff -u r2/binarycloud/user/htdocs/index.xml.php:1.1 r2/binarycloud/user/htdocs/index.xml.php:1.2
--- r2/binarycloud/user/htdocs/index.xml.php:1.1 Thu Aug 23 17:09:11 2001
+++ r2/binarycloud/user/htdocs/index.xml.php Fri Aug 24 12:29:36 2001
@@ -1,101 +1,100 @@
-<?xml version="1.0" ?>
-<!-- Header {{{
-*******************************************************************************
-** -File $Id: index.xml.php,v 1.1 2001/08/24 00:09:11 alex Exp $
-** -License LGPL (http://www.gnu.org/copyleft/lesser.html)
-** -Copyright 2001, The Turing Studio, Inc.
-** -Author alex black, en...@tu...
-******************************************************************************
-}}} -->
-<page>
- <init>
- <ini>TRUE</ini>
- <sess>TRUE</sess>
- <lang>TRUE</lang>
- <auth>FALSE</auth>
- <perm>FALSE</perm>
- <output>FALSE</output>
- <debug>FALSE</debug>
- <cache>TRUE</cache>
- <database>TRUE</database>
- </init>
- <database>
- <source>mysql_base</source>
- </database>
- <cache>
- <expires>20</expires>
-
- </cache>
- <templates>
- <default>
- <name>example</name>
- <package>html.masters</package>
- <type>html</type>
- </default>
- <other>
- <name>other</name>
- <package>html.masters</package>
- <type>html</type>
- </other>
- </templates>
- <modules>
- <content>
- <layout>
- <name>example</name>
- <package>html.layouts</package>
- </layout>
- <load>
- <module>
- <id>mooboo</id>
- <name>OtherWorld</name>
- <package>hello_world</package>
- <load_order>3</load_order>
- </module>
- <module>
- <id>some_other_unique_name</id>
- <name>SetLangExample</name>
- <package>set_lang_example</package>
- <load_order>6</load_order>
- </module>
- <module>
- <name>HelloWorld</name>
- <package>hello_world</package>
- <load_order>1</load_order>
- <params>
- <example>something I want this module to know</example>
- <another>1</another>
- </params>
- </module>
- <module>
- <name>HelloWorld</name>
- <package>hello_world</package>
- <load_order>5</load_order>
- </module>
- <module>
- <name>HelloWorld</name>
- <package>hello_world</package>
- <load_order>4</load_order>
- </module>
- <module>
- <name>HelloWorld</name>
- <package>hello_world</package>
- <load_order>2</load_order>
- </module>
- </load>
- </content>
- <left>
- <load>
- <module>
- <name>HelloWorld</name>
- <package>hello_world</package>
- <load_order>2</load_order>
- </module>
- <module>
- <name>HelloWorld</name>
- <package>hello_world</package>
- <load_order>1</load_order>
- </module>
- </load>
- </left>
- </modules>
-</page>
+<?xml version="1.0" ?>
+<!-- Header {{{
+*******************************************************************************
+** -File $Id: index.xml.php,v 1.2 2001/08/24 19:29:36 alex Exp $
+** -License LGPL (http://www.gnu.org/copyleft/lesser.html)
+** -Copyright 2001, The Turing Studio, Inc.
+** -Author alex black, en...@tu...
+******************************************************************************
+}}} -->
+<page>
+ <init>
+ <ini>TRUE</ini>
+ <sess>TRUE</sess>
+ <lang>TRUE</lang>
+ <auth>FALSE</auth>
+ <perm>FALSE</perm>
+ <output>FALSE</output>
+ <debug>FALSE</debug>
+ <cache>TRUE</cache>
+ <database>TRUE</database>
+ </init>
+ <database>
+ <source>mysql_base</source>
+ </database>
+ <cache>
+ <expires>20</expires>
+ </cache>
+ <templates>
+ <default>
+ <name>example</name>
+ <package>html.masters</package>
+ <type>html</type>
+ </default>
+ <other>
+ <name>other</name>
+ <package>html.masters</package>
+ <type>html</type>
+ </other>
+ </templates>
+ <modules>
+ <content>
+ <layout>
+ <name>example</name>
+ <package>html.layouts</package>
+ </layout>
+ <load>
+ <module>
+ <id>mooboo</id>
+ <name>OtherWorld</name>
+ <package>hello_world</package>
+ <load_order>3</load_order>
+ </module>
+ <module>
+ <id>some_other_unique_name</id>
+ <name>SetLangExample</name>
+ <package>set_lang_example</package>
+ <load_order>6</load_order>
+ </module>
+ <module>
+ <name>HelloWorld</name>
+ <package>hello_world</package>
+ <load_order>1</load_order>
+ <params>
+ <example>something I want this module to know</example>
+ <another>1</another>
+ </params>
+ </module>
+ <module>
+ <name>HelloWorld</name>
+ <package>hello_world</package>
+ <load_order>5</load_order>
+ </module>
+ <module>
+ <name>HelloWorld</name>
+ <package>hello_world</package>
+ <load_order>4</load_order>
+ </module>
+ <module>
+ <name>HelloWorld</name>
+ <package>hello_world</package>
+ <load_order>2</load_order>
+ </module>
+ </load>
+ </content>
+ <left>
+ <load>
+ <module>
+ <name>HelloWorld</name>
+ <package>hello_world</package>
+ <load_order>2</load_order>
+ </module>
+ <module>
+ <name>HelloWorld</name>
+ <package>hello_world</package>
+ <load_order>1</load_order>
+ </module>
+ </load>
+ </left>
+ </modules>
+</page>
|