/** * * @param string $namespace * @param string $path * @return boolean|string */ protected function _getPath($namespace, $path) { // Find in session $namespaces = ZtFramework::getSession('extensions', array()); if (isset($namespaces[$namespace])) { $paths = $namespaces[$namespace]->paths; } else { if (isset($this->_namespaces[$namespace])) { $paths = $this->_namespaces[$namespace]; } else { $paths = array(); } } /* Find first exists filePath */ foreach ($paths as $_path) { $physicalPath = $_path . DIRECTORY_SEPARATOR . $path; if (JFile::exists($physicalPath)) { return rtrim(str_replace('/', DIRECTORY_SEPARATOR, $physicalPath), DIRECTORY_SEPARATOR); } elseif (JFolder::exists($physicalPath)) { return rtrim(str_replace('/', DIRECTORY_SEPARATOR, $physicalPath), DIRECTORY_SEPARATOR); } } }
<?php /** * {$id} */ defined('_JEXEC') or die('Restricted access'); require_once __DIR__ . '/includes/defines.php'; require_once __DIR__ . '/includes/path.php'; require_once __DIR__ . '/includes/extensions.php'; require_once __DIR__ . '/includes/loader.php'; require_once __DIR__ . '/includes/framework.php'; if (JFactory::getApplication()->input->get('zt_debug') == 1) { ZtFramework::restart(); } /* Register Zt autoloading by Psr2 */ ZtFramework::registerExtension(__DIR__ . '/../extension.json'); spl_autoload_register(array('ZtLoader', 'autoloadZtPsr2')); /* Include JS Framework core */ JHtml::_('bootstrap.framework'); /* Extension init */ $extension = ZtFramework::getExtension('Zt'); $extension->init();
public function flush() { ZtFramework::setSession('extensions', $this->_extensions); }