ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
observer.php
Go to the documentation of this file.
1<?php
22{
29 var $_id = 0;
30
41
50 function Log_observer($priority = PEAR_LOG_INFO)
51 {
52 $this->_id = md5(microtime());
53 $this->_priority = $priority;
54 }
55
70 function &factory($type, $priority = PEAR_LOG_INFO, $conf = array())
71 {
72 $type = strtolower($type);
73 $class = 'Log_observer_' . $type;
74
75 /*
76 * If the desired class already exists (because the caller has supplied
77 * it from some custom location), simply instantiate and return a new
78 * instance.
79 */
80 if (class_exists($class)) {
81 $object = new $class($priority, $conf);
82 return $object;
83 }
84
85 /* Support both the new-style and old-style file naming conventions. */
86 $newstyle = true;
87 $classfile = dirname(__FILE__) . '/observer_' . $type . '.php';
88
89 if (!file_exists($classfile)) {
90 $classfile = 'Log/' . $type . '.php';
91 $newstyle = false;
92 }
93
94 /*
95 * Attempt to include our version of the named class, but don't treat
96 * a failure as fatal. The caller may have already included their own
97 * version of the named class.
98 */
99 @include_once $classfile;
100
101 /* If the class exists, return a new instance of it. */
102 if (class_exists($class)) {
103 /* Support both new-style and old-style construction. */
104 if ($newstyle) {
105 $object = new $class($priority, $conf);
106 } else {
107 $object = new $class($priority);
108 }
109 return $object;
110 }
111
112 $null = null;
113 return $null;
114 }
115
125 function notify($event)
126 {
127 print_r($event);
128 }
129}
const PEAR_LOG_INFO
Definition: Log.php:16
Log_observer($priority=PEAR_LOG_INFO)
Creates a new basic Log_observer instance.
Definition: observer.php:50
& factory($type, $priority=PEAR_LOG_INFO, $conf=array())
Attempts to return a new concrete Log_observer instance of the requested type.
Definition: observer.php:70
notify($event)
This is a stub method to make sure that Log_Observer classes do something when they are notified of a...
Definition: observer.php:125