function __construct($owner) { // Основные поля $this->_owner = $owner; $this->_ready = true; // Инициализируем идентификационные поля класса if ($CD = xbNode::classification(get_class($this))) { $this->_module = $CD['module']; $this->_nodeType = $CD['type']; $this->_nodeName = $CD['name']; } if (empty($this->_module)) { $this->_module = 'system'; } // Подключаем зависимости if (is_array($this->_uses) && !empty($this->_uses)) { if (is_object($this->_owner) && method_exists($this->_owner, 'loadAPI')) { foreach ($this->_uses as $key) { $d = explode('.', $key); $module = $d[0]; $name = isset($d[1]) ? $d[1] : ''; $ret = $this->_owner->loadAPI($module, $name); if (!$ret) { $this->_ready = false; break; } } } } }
function __construct($owner, $v = '') { $this->_owner = $owner; $this->_name = 'main'; if ($CD = xbNode::classification(get_class($this))) { if (!empty($CD['module'])) { $this->_module = $CD['module']; } if (!empty($CD['name'])) { $this->_name = $CD['name']; } } if (!empty($v)) { $F = explode('/', $v); $L = count($F) - 1; $this->_name = $F[$L]; unset($F[$L]); $this->_path = $F; } $this->_ready = $this->owner->ready; }
function xbNodeAutoload($classname) { if ($CD = xbNode::classification($classname)) { if ($F = xbNode::fileName($CD['module'], $CD['type'], $CD['name'])) { require $F; if (!class_exists($classname)) { throw new Exception('No class in file for "' . $classname . '"'); } return true; } else { throw new Exception('No class file for "' . $classname . '"'); } } else { return true; } }