예제 #1
0
 public function render()
 {
     $model = $this->getModel();
     $module = $model->getRow();
     if ($this->getLayout() == 'modal') {
         $this->menus = $this->getObject('com:pages.model.menus')->sort('title')->getRowset();
         $this->pages = $this->getObject('com:pages.model.pages')->application('site')->getRowset();
         $this->modules = $this->getObject('com:pages.model.modules')->application('site')->getRowset();
     }
     if ($this->getModel()->getState()->isUnique()) {
         if ($module->isNew()) {
             $module->application = $model->application;
             $module->name = $model->name;
         }
         $path = Library\ClassLoader::getInstance()->getApplication($module->application);
         JFactory::getLanguage()->load(substr($module->extension_name, 4), $module->name, $path);
     }
     // Build path to module config file
     $path = Library\ClassLoader::getInstance()->getApplication('site');
     $path .= '/component/' . substr($module->extension_name, 4) . '/module/' . substr($module->name, 4) . '/config.xml';
     $params = new \JParameter(null, $path);
     $params->loadArray($module->params->toArray());
     $this->params = $params;
     return parent::render();
 }
예제 #2
0
 public function __get($name)
 {
     if ($name == 'params' && !$this->_data['params'] instanceof JParameter) {
         $path = Library\ClassLoader::getInstance()->getApplication('admin');
         $file = $path . '/component/' . $this->option . '/resources/config/settings.xml';
         $this->_data['params'] = new JParameter($this->_data['params'], $file, 'component');
     }
     return parent::__get($name);
 }
예제 #3
0
 public function render()
 {
     //Load language files for each module
     if ($this->getLayout() == 'list') {
         foreach ($this->getModel()->getRowset() as $module) {
             $path = Library\ClassLoader::getInstance()->getApplication($module->application);
             JFactory::getLanguage()->load($module->getIdentifier()->package, $module->name, $path);
         }
     }
     return parent::render();
 }
예제 #4
0
 public function applications($config = array())
 {
     $config = new Library\ObjectConfig($config);
     $config->append(array('name' => 'application', 'deselect' => true, 'prompt' => '- Select -'));
     $options = array();
     if ($config->deselect) {
         $options[] = $this->option(array('text' => \JText::_($config->prompt)));
     }
     foreach (Library\ClassLoader::getInstance()->getApplications() as $application => $path) {
         $options[] = $this->option(array('text' => $application, 'value' => $application));
     }
     $config->options = $options;
     return $this->optionlist($config);
 }
예제 #5
0
 public function getRowset()
 {
     if (!isset($this->_rowset)) {
         $table = $this->getObject('com:extensions.database.table.extensions');
         $query = $this->getObject('lib:database.query.select')->order('name');
         $extensions = $table->select($query);
         // Iterate through the extensions.
         foreach ($extensions as $extension) {
             $path = Library\ClassLoader::getInstance()->getApplication($this->getState()->application);
             $path .= '/component/' . substr($extension->name, 4) . '/view';
             if (!is_dir($path)) {
                 continue;
             }
             // Iterator through the views.
             $views = array();
             foreach (new \DirectoryIterator($path) as $view) {
                 $xml_path = $path . '/' . $view . '/metadata.xml';
                 if (!$view->isDir() || substr($view, 0, 1) == '.' || !file_exists($xml_path)) {
                     continue;
                 }
                 $xml_view = simplexml_load_file($xml_path);
                 if (strtolower($xml_view->view->attributes()->hidden) !== 'true') {
                     // Iterate through the layouts.
                     $layouts = array();
                     if (is_dir($path . '/' . $view . '/templates')) {
                         foreach (new \DirectoryIterator($path . '/' . $view . '/templates') as $layout) {
                             if (!$layout->isFile() || substr($layout, 0, 1) == '.' || $layout->getExtension() != 'xml') {
                                 continue;
                             }
                             $xml_layout = simplexml_load_file($path . '/' . $view . '/templates/' . $layout);
                             if (!$xml_layout->layout) {
                                 continue;
                             }
                             if (strtolower($xml_layout->layout->attributes()->hidden) !== 'true') {
                                 $layouts[$layout->getBasename('.xml')] = (object) array('name' => $layout->getBasename('.xml'), 'title' => trim($xml_layout->layout->attributes()->title), 'description' => trim($xml_layout->layout->message));
                             }
                         }
                     }
                     $views[$view->getFilename()] = (object) array('name' => $view->getFilename(), 'title' => trim($xml_view->view->attributes()->title), 'layouts' => $layouts);
                 }
             }
             $extension->views = $views;
         }
         $this->_rowset = $extensions;
     }
     return $this->_rowset;
 }
예제 #6
0
 public function positions($config = array())
 {
     $config = new Library\ObjectConfig($config);
     $config->append(array('name' => 'position'));
     $options = array();
     $path = Library\ClassLoader::getInstance()->getApplication('site');
     $path = $path . '/public/theme/' . $this->getObject('application')->getCfg('theme') . '/config.xml';
     if (file_exists($path)) {
         $xml = simplexml_load_file($path);
         if (isset($xml->positions)) {
             foreach ($xml->positions->children() as $position) {
                 $options[] = $this->option(array('text' => (string) $position, 'value' => (string) $position));
             }
         }
     }
     $config->options = $options;
     return $this->optionlist($config);
 }
예제 #7
0
 public function getRowset()
 {
     if (!isset($this->_rowset)) {
         $rowset = $this->getObject('com:extensions.database.rowset.settings');
         //Insert the system configuration settings
         $rowset->insert($this->getObject('com:extensions.database.row.setting_system'));
         //Insert the component configuration settings
         $extensions = $this->getObject('com:extensions.model.extensions')->enabled(1)->getRowset();
         foreach ($extensions as $extension) {
             $path = Library\ClassLoader::getInstance()->getApplication('admin');
             $path .= '/component/' . substr($extension->name, 4) . '/resources/config/settings.xml';
             if (file_exists($path)) {
                 $config = array('name' => strtolower(substr($extension->name, 4)), 'path' => file_exists($path) ? $path : '', 'id' => $extension->id, 'data' => $extension->params->toArray());
                 $row = $this->getObject('com:extensions.database.row.setting_extension', $config);
                 $rowset->insert($row);
             }
         }
         $this->_rowset = $rowset;
     }
     return $this->_rowset;
 }
예제 #8
0
 public function render()
 {
     $database = $this->getObject('com:debug.event.subscriber.database');
     $profiler = $this->getObject('com:debug.event.profiler');
     $language = \JFactory::getLanguage();
     //Remove the template includes
     $includes = get_included_files();
     foreach ($includes as $key => $value) {
         //Find the real file path
         if ($alias = Library\ClassLoader::getInstance()->getAlias($value)) {
             $includes[$key] = $alias;
         }
     }
     $this->memory = $profiler->getMemory();
     $this->events = (array) $profiler->getEvents();
     $this->queries = (array) $database->getQueries();
     $this->languages = (array) $language->getPaths();
     $this->includes = (array) $includes;
     $this->strings = (array) $language->getOrphans();
     return parent::render();
 }
예제 #9
0
 /**
  * Get a list of items
  *
  * If the installed state is TRUE this function will return a list of the installed modules.
  *
  * @return Library\DatabaseRowsetInterface
  */
 public function getRowset()
 {
     if (!isset($this->_rowset)) {
         $state = $this->getState();
         if ($state->installed) {
             $table = $this->getObject('com:extensions.database.table.extensions');
             $query = $this->getObject('lib:database.query.select')->order('name');
             $extension = $table->select($query);
             // Iterate through the extension
             $modules = array();
             foreach ($extension as $extension) {
                 $path = Library\ClassLoader::getInstance()->getApplication('site');
                 $path .= '/component/' . substr($extension->name, 4) . '/modules';
                 if (!is_dir($path)) {
                     continue;
                 }
                 foreach (new \DirectoryIterator($path) as $folder) {
                     if ($folder->isDir()) {
                         if (file_exists($folder->getRealPath() . '/' . $folder->getFilename() . '.xml')) {
                             $modules[] = array('id' => $folder->getFilename(), 'name' => 'mod_' . $folder->getFilename(), 'application' => 'site', 'extensions_extension_id' => $extension->id, 'title' => null);
                         }
                     }
                 }
             }
             //Set the total
             $this->_total = count($modules);
             //Apply limit and offset
             if ($this->getState()->limit) {
                 $modules = array_slice($modules, $state->offset, $state->limit ? $state->limit : $this->_total);
             }
             //Apply direction
             if (strtolower($state->direction) == 'desc') {
                 $modules = array_reverse($modules);
             }
             $this->_rowset = $this->getTable()->getRowset()->addRow($modules);
         } else {
             $this->_rowset = parent::getRowset();
         }
     }
     return $this->_rowset;
 }
예제 #10
0
 public function __construct(Library\ObjectConfig $config)
 {
     parent::__construct($config);
     //@TODO Remove when PHP 5.5 becomes a requirement.
     Library\ClassLoader::getInstance()->loadFile(JPATH_ROOT . '/application/admin/component/users/legacy/password.php');
 }
예제 #11
0
/**
 * Framework loader
 *
 * @author      Johan Janssens <http://nooku.assembla.com/profile/johanjanssens>
 */
use Nooku\Library;
//Installation check
if (!file_exists(JPATH_ROOT . '/config/config.php') || filesize(JPATH_ROOT . '/config/config.php') < 10) {
    echo 'No configuration file found. Exciting...';
    exit;
}
// Joomla : setup
require_once JPATH_VENDOR . '/joomla/import.php';
jimport('joomla.environment.uri');
jimport('joomla.html.html');
jimport('joomla.html.parameter');
jimport('joomla.utilities.utility');
jimport('joomla.language.language');
// Koowa : setup
require_once JPATH_ROOT . '/config/config.php';
$config = new JConfig();
require_once JPATH_ROOT . '/library/nooku.php';
\Nooku::getInstance(array('cache_prefix' => md5($config->secret) . '-cache-koowa', 'cache_enabled' => $config->caching));
unset($config);
//Setup the component locator
Library\ClassLoader::getInstance()->getLocator('com')->registerNamespaces(array('\\' => JPATH_APPLICATION . '/component', 'Nooku\\Component' => JPATH_ROOT . '/component'));
//Add the different applications
Library\ClassLoader::getInstance()->addApplication('site', JPATH_ROOT . '/application/site');
Library\ClassLoader::getInstance()->addApplication('admin', JPATH_ROOT . '/application/admin');
//Bootstrap the components
Library\ObjectManager::getInstance()->getObject('lib:bootstrapper.application', array('directory' => JPATH_APPLICATION . '/component'))->bootstrap();
예제 #12
0
 public function render()
 {
     $this->applications = array_keys(Library\ClassLoader::getInstance()->getApplications());
     $this->menus = $this->getObject('com:pages.model.menus')->getRowset();
     return parent::render();
 }
예제 #13
0
 protected function _getPageXml()
 {
     $xml = \JFactory::getXMLParser('simple');
     $type = $this->getType();
     $path = Library\ClassLoader::getInstance()->getApplication('site') . '/component/' . substr($type['option'], 4) . '/view/' . $type['view'] . '/templates/' . $type['layout'] . '.xml';
     if (file_exists($path)) {
         $xml->loadFile($path);
     }
     return $xml;
 }
예제 #14
0
 public function render()
 {
     $this->applications = array_keys(Library\ClassLoader::getInstance()->getApplications());
     return parent::render();
 }