function __construct($dispatcher, $config = array()) { // Avoid fatal errors due to component downgrade. // TODO: Remove when downgrades get disallowed on installers. if (version_compare($this->_getLogmanVersion(), '1.0.0RC4', '>=')) { $identifiers = array( 'com://admin/logman.plugin.interface', 'com://admin/logman.plugin.injector', 'com://admin/logman.plugin.abstract', 'com://admin/logman.plugin.context', 'com://admin/logman.plugin.content'); // Load LOGman base plugin classes. foreach ($identifiers as $identifier) { if (!$loaded = KLoader::loadIdentifier($identifier)) { break; } } // Load LOGman plugin group. if ($loaded) { JPluginHelper::importPlugin('logman'); } } parent::__construct($dispatcher, $config); }
/** * Load the file for a class * * @param string $class The class that will be loaded * @return boolean True on success */ public static function loadClass($class) { // pre-empt further searching for the named class or interface. // do not use autoload, because this method is registered with // spl_autoload already. if (class_exists($class, false) || interface_exists($class, false)) { return; } // if class start with a 'Nooku' it is a Nooku class. // create the path and register it with the loader. switch (substr($class, 0, 6)) { case 'Picman': $word = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', substr_replace($class, '', 0, 6))); $parts = explode('_', $word); if (count($parts) > 1) { $path = KInflector::pluralize(array_shift($parts)) . DS . implode(DS, $parts); } else { $path = $word; } if (is_file(dirname(__FILE__) . DS . $path . '.php')) { KLoader::register($class, dirname(__FILE__) . DS . $path . '.php'); } break; } $classes = KLoader::register(); if (array_key_exists(strtolower($class), $classes)) { include $classes[strtolower($class)]; return true; } return false; }
public function __construct($subject, $config = array()) { // Turn off E_STRICT errors for now error_reporting(error_reporting() & ~E_STRICT); // Check if database type is MySQLi if (JFactory::getApplication()->getCfg('dbtype') != 'mysqli') { if (JFactory::getApplication()->getName() === 'administrator') { $string = version_compare(JVERSION, '1.6', '<') ? 'mysqli' : 'MySQLi'; $link = JRoute::_('index.php?option=com_config'); $error = 'In order to use Joomlatools framework, your database type in Global Configuration should be set to <strong>%1$s</strong>. Please go to <a href="%2$s">Global Configuration</a> and in the \'Server\' tab change your Database Type to <strong>%1$s</strong>.'; JError::raiseWarning(0, sprintf(JText::_($error), $string, $link)); } return; } // Set pcre.backtrack_limit to a larger value // See: https://bugs.php.net/bug.php?id=40846 if (version_compare(PHP_VERSION, '5.3.6', '<=') && @ini_get('pcre.backtrack_limit') < 1000000) { @ini_set('pcre.backtrack_limit', 1000000); } //Set constants define('KDEBUG', JDEBUG); //Set path definitions define('JPATH_FILES', JPATH_ROOT); define('JPATH_IMAGES', JPATH_ROOT . DIRECTORY_SEPARATOR . 'images'); //Set exception handler set_exception_handler(array($this, 'exceptionHandler')); // Koowa : setup require_once JPATH_LIBRARIES . '/koowa/koowa.php'; Koowa::getInstance(array('cache_prefix' => md5(JFactory::getApplication()->getCfg('secret')) . '-cache-koowa', 'cache_enabled' => false)); KLoader::addAdapter(new KLoaderAdapterModule(array('basepath' => JPATH_BASE))); KLoader::addAdapter(new KLoaderAdapterPlugin(array('basepath' => JPATH_ROOT))); KLoader::addAdapter(new KLoaderAdapterComponent(array('basepath' => JPATH_BASE))); KServiceIdentifier::addLocator(KService::get('koowa:service.locator.module')); KServiceIdentifier::addLocator(KService::get('koowa:service.locator.plugin')); KServiceIdentifier::addLocator(KService::get('koowa:service.locator.component')); KServiceIdentifier::setApplication('site', JPATH_SITE); KServiceIdentifier::setApplication('admin', JPATH_ADMINISTRATOR); KService::setAlias('koowa:database.adapter.mysqli', 'com://admin/default.database.adapter.mysqli'); KService::setAlias('translator', 'com:default.translator'); //Setup the request if (JFactory::getApplication()->getName() !== 'site') { KRequest::root(str_replace('/' . JFactory::getApplication()->getName(), '', KRequest::base())); } //Load the koowa plugins JPluginHelper::importPlugin('koowa', null, true); //Bugfix : Set offset accoording to user's timezone if (!JFactory::getUser()->guest) { if ($offset = JFactory::getUser()->getParam('timezone')) { if (version_compare(JVERSION, '3.0', '>=')) { JFactory::getConfig()->set('offset', $offset); } else { JFactory::getConfig()->setValue('config.offset', $offset); } } } // Load language files for the framework KService::get('com:default.translator')->loadLanguageFiles(); parent::__construct($subject, $config); }
/** * Constructor * * @param array An optional associative array of configuration settings. */ public function __construct(KConfig $config) { parent::__construct($config); $this->_state->insert('position', 'cmd')->insert('module', 'cmd')->insert('limit', 'int', 0); KLoader::load('lib.joomla.application.module.helper'); $this->_list =& JModuleHelper::_load(); $this->_total = count($this->_list); }
public function __construct(KConfig $options) { parent::__construct($options); $identifier = $options->identifier; $type = $identifier->type; $package = $identifier->package; $admin = JPATH_ADMINISTRATOR . '/components/' . $type . '_' . $package; $site = JPATH_ROOT . '/components/' . $type . '_' . $package; $media = JPATH_ROOT . '/media/' . $type . '_' . $package; $xmls = JFolder::files(JPATH_ADMINISTRATOR . '/components/' . $type . '_' . $package, '.xml$', 0, true); foreach ($xmls as $manifest) { $xml = simplexml_load_file($manifest); if (isset($xml['type'])) { break; } } if (empty($xml)) { return; } if (!$xml->deleted) { return; } KLoader::load('lib.joomla.filesystem.folder'); KLoader::load('lib.joomla.filesystem.file'); if ($xml->deleted->admin) { foreach ($xml->deleted->admin->children() as $name => $item) { if ($name == 'folder' && JFolder::exists($admin . '/' . $item)) { JFolder::delete($admin . '/' . $item); } if ($name == 'file' && JFile::exists($admin . '/' . $item)) { JFile::delete($admin . '/' . $item); } } } if ($xml->deleted->site) { if ($xml->deleted->site['removed'] && JFolder::exists($site)) { JFolder::delete($site); } foreach ($xml->deleted->site->children() as $name => $item) { if ($name == 'folder' && JFolder::exists($site . '/' . $item)) { JFolder::delete($site . '/' . $item); } if ($name == 'file' && JFile::exists($site . '/' . $item)) { JFile::delete($site . '/' . $item); } } } if ($xml->deleted->media) { foreach ($xml->deleted->media->children() as $name => $item) { if ($name == 'folder' && JFolder::exists($media . '/' . $item)) { JFolder::delete($media . '/' . $item); } if ($name == 'file' && JFile::exists($media . '/' . $item)) { JFile::delete($media . '/' . $item); } } } }
/** * Constructor * * @param array An optional associative array of configuration settings. */ public function __construct(KConfig $options) { parent::__construct($options); KLoader::load('lib.joomla.filesystem.file'); //$attr = array_diff_key($node->attributes(), array_fill_keys(array('name', 'type', 'default', 'get', 'label', 'description'), null) ); $this->_state->insert('client', 'boolean', 0)->insert('optgroup', 'string', true)->insert('incpath', 'boolean', 0)->insert('limit', 'int', 0); // $this->_list = array(); // $this->_total = count($this->_list); }
protected function _initialize(KConfig $config) { KLoader::load('com://admin/learn.library.markdown'); $config->append(array( 'priority' => KCommand::PRIORITY_HIGHEST, )); parent::_initialize($config); }
/** * Create an instance of a class based on a class identifier * * This factory will try to create an generic or default object based on the identifier information * if the actual object cannot be found using a predefined fallback sequence. * * Fallback sequence : -> Named Component Specific * -> Named Component Default * -> Default Component Specific * -> Default Component Default * -> Framework Specific * -> Framework Default * * @param mixed Identifier or Identifier object - com:[//application/]component.view.[.path].name * @param object An optional KConfig object with configuration options * @return object|false Return object on success, returns FALSE on failure */ public function instantiate($identifier, KConfig $config) { $path = KInflector::camelize(implode('_', $identifier->path)); $classname = 'Com'.ucfirst($identifier->package).$path.ucfirst($identifier->name); //Don't allow the auto-loader to load component classes if they don't exists yet if (!class_exists( $classname, false )) { //Find the file if($path = KLoader::load($identifier)) { //Don't allow the auto-loader to load component classes if they don't exists yet if (!class_exists( $classname, false )) { throw new KFactoryAdapterException("Class [$classname] not found in file [".$path."]" ); } } else { $classpath = $identifier->path; $classtype = !empty($classpath) ? array_shift($classpath) : ''; //Create the fallback path and make an exception for views $path = ($classtype != 'view') ? KInflector::camelize(implode('_', $classpath)) : ''; /* * Find the classname to fallback too and auto-load the class * * Fallback sequence : -> Named Component Specific * -> Named Component Default * -> Default Component Specific * -> Default Component Defaukt * -> Framework Specific * -> Framework Default */ if(class_exists('Com'.ucfirst($identifier->package).ucfirst($classtype).$path.ucfirst($identifier->name))) { $classname = 'Com'.ucfirst($identifier->package).ucfirst($classtype).$path.ucfirst($identifier->name); } elseif(class_exists('Com'.ucfirst($identifier->package).ucfirst($classtype).$path.'Default')) { $classname = 'Com'.ucfirst($identifier->package).ucfirst($classtype).$path.'Default'; } elseif(class_exists('ComDefault'.ucfirst($classtype).$path.ucfirst($identifier->name))) { $classname = 'ComDefault'.ucfirst($classtype).$path.ucfirst($identifier->name); } elseif(class_exists('ComDefault'.ucfirst($classtype).$path.'Default')) { $classname = 'ComDefault'.ucfirst($classtype).$path.'Default'; } elseif(class_exists( 'K'.ucfirst($classtype).$path.ucfirst($identifier->name))) { $classname = 'K'.ucfirst($classtype).$path.ucfirst($identifier->name); } elseif(class_exists('K'.ucfirst($classtype).$path.'Default')) { $classname = 'K'.ucfirst($classtype).$path.'Default'; } else { $classname = false; } } } return $classname; }
/** * Constructor * * Prevent creating instances of this class by making the contructor private */ private final function __construct() { //Created the adapter registry self::$_adapters = array(); self::$_registry = new ArrayObject(); // Register the autoloader in a way to play well with as many configurations as possible. spl_autoload_register(array(__CLASS__, 'load')); if (function_exists('__autoload')) { spl_autoload_register('__autoload'); } }
public function __construct($subject, $config = array()) { // Check if Koowa is active if (JFactory::getApplication()->getCfg('dbtype') != 'mysqli') { JError::raiseWarning(0, JText::_("Koowa plugin requires MySQLi Database Driver. Please change your database configuration settings to 'mysqli'")); return; } // Check for suhosin if (in_array('suhosin', get_loaded_extensions())) { //Attempt setting the whitelist value @ini_set('suhosin.executor.include.whitelist', 'tmpl://, file://'); //Checking if the whitelist is ok if (!@ini_get('suhosin.executor.include.whitelist') || strpos(@ini_get('suhosin.executor.include.whitelist'), 'tmpl://') === false) { JError::raiseWarning(0, sprintf(JText::_('Your server has Suhosin loaded. Please follow <a href="%s" target="_blank">this</a> tutorial.'), 'https://nooku.assembla.com/wiki/show/nooku-framework/Known_Issues')); return; } } //Set constants define('KDEBUG', JDEBUG); define('JPATH_IMAGES', JPATH_ROOT . '/images'); //Set exception handler set_exception_handler(array($this, 'exceptionHandler')); // Require the library loader JLoader::import('libraries.koowa.koowa', JPATH_ROOT); JLoader::import('libraries.koowa.loader.loader', JPATH_ROOT); //Setup the loader KLoader::addAdapter(new KLoaderAdapterKoowa(Koowa::getPath())); KLoader::addAdapter(new KLoaderAdapterJoomla(JPATH_LIBRARIES)); KLoader::addAdapter(new KLoaderAdapterModule(JPATH_BASE)); KLoader::addAdapter(new KLoaderAdapterPlugin(JPATH_ROOT)); KLoader::addAdapter(new KLoaderAdapterComponent(JPATH_BASE)); //Setup the factory KFactory::addAdapter(new KFactoryAdapterKoowa()); KFactory::addAdapter(new KFactoryAdapterJoomla()); KFactory::addAdapter(new KFactoryAdapterModule()); KFactory::addAdapter(new KFactoryAdapterPlugin()); KFactory::addAdapter(new KFactoryAdapterComponent()); //Setup the identifier application paths KIdentifier::registerApplication('site', JPATH_SITE); KIdentifier::registerApplication('admin', JPATH_ADMINISTRATOR); //Setup the request KRequest::root(str_replace('/' . JFactory::getApplication()->getName(), '', KRequest::base())); //Set factory identifier aliasses KFactory::map('lib.koowa.database.adapter.mysqli', 'admin::com.default.database.adapter.mysqli'); //Load the koowa plugins JPluginHelper::importPlugin('koowa', null, true, KFactory::get('lib.koowa.event.dispatcher')); //Bugfix : Set offset accoording to user's timezone if (!KFactory::get('lib.joomla.user')->guest) { if ($offset = KFactory::get('lib.joomla.user')->getParam('timezone')) { KFactory::get('lib.joomla.config')->setValue('config.offset', $offset); } } parent::__construct($subject, $config); }
/** * Constructor * * Prevent creating instances of this class by making the contructor private * * @param array An optional array with configuration options. */ private final function __construct($config = array()) { //Initialize the path $this->_path = dirname(__FILE__); //Load the legacy functions require_once $this->_path . '/legacy.php'; //Setup the loader require_once $this->_path . '/loader/loader.php'; $loader = KLoader::getInstance($config); //Setup the factory $service = KService::getInstance($config); $service->set('koowa:loader', $loader); }
/** * Create an instance of a class based on a class identifier * * @param mixed Identifier or Identifier object - lib.koowa.[.path].name * @param object An optional KConfig object with configuration options * @return object|false Return object on success, returns FALSE on failure */ public function instantiate($identifier, KConfig $config) { $classname = false; if ($identifier->type == 'lib' && $identifier->package == 'koowa') { $classname = 'K' . KInflector::implode($identifier->path) . ucfirst($identifier->name); $filepath = KLoader::path($identifier); if (!class_exists($classname)) { // use default class instead $classname = 'K' . KInflector::implode($identifier->path) . 'Default'; if (!class_exists($classname)) { throw new KFactoryAdapterException("Class [{$classname}] not found in file [" . basename($filepath) . "]"); } } } return $classname; }
public function getStorage() { if(empty($this->_storage)) { try { KLoader::load('com://admin/learn.library.spyc.spyc'); $this->_storage = Spyc::YAMLLoadString(parent::getStorage()); } catch(KException $e) { throw new ComLearnDatabaseTableException($e->getMessage()); } } return $this->_storage; }
public function loadIdentifier($template, $data = array(), $process = true) { //Identify the template $identifier = KFactory::identify($template); // Find the template $file = KLoader::path($identifier); if ($file === false) { throw new KTemplateException('Template "'.$identifier->name.'" not found'); } // Load the file $this->loadFile($file, $data, $process); return $this; }
/** * Create an instance of a class based on a class identifier * * @param mixed Identifier or Identifier object - plg.type.plugin.[.path].name * @param object An optional KConfig object with configuration options * @return object|false Return object on success, returns FALSE on failure */ public function instantiate($identifier, KConfig $config) { $classname = false; if ($identifier->type == 'plg') { $classpath = KInflector::camelize(implode('_', $identifier->path)); $classname = 'Plg' . ucfirst($identifier->package) . $classpath . ucfirst($identifier->name); //Don't allow the auto-loader to load plugin classes if they don't exists yet if (!class_exists($classname, false)) { //Find the file if ($path = KLoader::load($identifier)) { //Don't allow the auto-loader to load plugin classes if they don't exists yet if (!class_exists($classname, false)) { throw new KFactoryAdapterException("Class [{$classname}] not found in file [" . $path . "]"); } } } } return $classname; }
/** * Renders a form using an xml path * * @param array $config * @return void */ public function getParameters($config = array()) { $config = new KConfig($config); $config->append(array('data' => array(), 'element_paths' => array(dirname(__FILE__) . '/forms'))); $content = file_exists($config->path) ? file_get_contents($config->path) : ''; $paths = array(); //replace all the addpath="{KServiceIdentifier}" with real path if (preg_match_all('/addpath="([^"]+)"/', $content, $paths)) { $replaces = array(); foreach ($paths[1] as $path) { if (strpos($path, '.')) { $replaces[] = str_replace(JPATH_ROOT . '/', '', dirname(KLoader::path($path . '.dummy'))); } else { $replaces[] = $path; } } $content = str_replace($paths[1], $replaces, $content); } $xml =& JFactory::getXMLParser('Simple'); $parameter = new JParameter(''); $data = KConfig::unbox($config->data); if ($data instanceof JParameter) { $data = $data->toArray(); } if (is_array($data)) { $parameter->loadArray($data); } else { $parameter->loadINI($data); } $parameter->template_data = $config->template_data; foreach ($config->element_paths as $path) { $parameter->addElementPath($path); } if ($xml->loadString($content)) { if ($params =& $xml->document->params) { foreach ($params as $param) { $parameter->setXML($param); } } } return $parameter; }
public function setStorage($path) { if (!is_file($path)) { if (strpos($path, DS) === false ) { $identifier = $this->_identifier->name.'://'.$this->_identifier->application.'/'.$this->_identifier->package.'.'.$path.'.'.$this->_storage_name; $path = KLoader::path($identifier); } else $path = $path.DS.$this->_storage_name.'.'.$this->_identifier->name; } if (is_file($path)) { $this->_storage_path = $path; return $this->_storage_path; } else throw new ComLearnDatabaseTableException('Path: '.$path.' is not a valid storage path'); }
/** * Create an instance of a class based on a class identifier * * This factory will try to create an generic or default object based on the identifier information * if the actual object cannot be found using a predefined fallback sequence. * * Fallback sequence : -> Named Module * -> Default Module * -> Framework Specific * -> Framework Default * * @param mixed Identifier or Identifier object - application::mod.module.[.path].name * @param object An optional KConfig object with configuration options * @return object|false Return object on success, returns FALSE on failure */ public function instantiate($identifier, KConfig $config) { $classname = false; if ($identifier->type == 'mod') { $path = KInflector::camelize(implode('_', $identifier->path)); $classname = 'Mod' . ucfirst($identifier->package) . $path . ucfirst($identifier->name); //Don't allow the auto-loader to load module classes if they don't exists yet if (!class_exists($classname, false)) { //Find the file if ($path = KLoader::load($identifier)) { //Don't allow the auto-loader to load module classes if they don't exists yet if (!class_exists($classname, false)) { throw new KFactoryAdapterException("Class [{$classname}] not found in file [" . $path . "]"); } } else { $classpath = $identifier->path; $classtype = !empty($classpath) ? array_shift($classpath) : $identifier->name; /* * Find the classname to fallback too and auto-load the class * * Fallback sequence : -> Named Module * -> Default Module * -> Framework Specific * -> Framework Default */ if (class_exists('Mod' . ucfirst($identifier->package) . ucfirst($identifier->name))) { $classname = 'Mod' . ucfirst($identifier->package) . ucfirst($identifier->name); } elseif (class_exists('ModDefault' . ucfirst($identifier->name))) { $classname = 'ModDefault' . ucfirst($identifier->name); } elseif (class_exists('K' . ucfirst($classtype) . $path . ucfirst($identifier->name))) { $classname = 'K' . ucfirst($classtype) . ucfirst($identifier->name); } elseif (class_exists('K' . ucfirst($classtype) . 'Default')) { $classname = 'K' . ucfirst($classtype) . 'Default'; } else { $classname = false; } } } } return $classname; }
/** * Constructor * * Prevent creating instances of this class by making the contructor private * * @param array An optional array with configuration options. */ private final function __construct($config = array()) { //store the path $this->_path = dirname(__FILE__); //instantiate koowa Koowa::getInstance(array('cache_prefix' => $config['cache_prefix'], 'cache_enabled' => $config['cache_enabled'])); //if caching is not enabled then reset the apc cache to //to prevent corrupt identifier if (!$config['cache_enabled']) { clean_apc_with_prefix($config['cache_prefix']); } require_once dirname(__FILE__) . '/loader/adapter/anahita.php'; KLoader::addAdapter(new AnLoaderAdapterAnahita(array('basepath' => dirname(__FILE__)))); KLoader::addAdapter(new AnLoaderAdapterDefault(array('basepath' => JPATH_LIBRARIES . '/default'))); AnServiceClass::getInstance(); KServiceIdentifier::addLocator(new AnServiceLocatorAnahita()); KServiceIdentifier::addLocator(new AnServiceLocatorRepository()); //register an empty path for the application //a workaround to remove the applicaiton path from an identifier KServiceIdentifier::setApplication('', ''); //create a central event dispatcher KService::set('anahita:event.dispatcher', KService::get('koowa:event.dispatcher')); }
/** * Get an instance of a class based on a class identifier * * @param string The identifier string * @param array An optional associative array of configuration settings. * @throws KFactoryException * @return object Return object on success, throws exception on failure */ protected static function _instantiate($identifier, array $config = array()) { $context = self::$_chain->getContext(); $config = new KConfig($config); $context->config = $config; $result = self::$_chain->run($identifier, $context); //If we get a string returned we assume it's a classname if (is_string($result)) { //Set the classname $identifier->classname = $result; //Set the filepath $identifier->filepath = KLoader::path($identifier); //If the object is indentifiable push the identifier in through the constructor if (array_key_exists('KObjectIdentifiable', class_implements($identifier->classname))) { $config->identifier = $identifier; } // If the class has an instantiate method call it if (is_callable(array($identifier->classname, 'instantiate'), false)) { $result = call_user_func(array($identifier->classname, 'instantiate'), $config); } else { $result = new $identifier->classname($config); } } if (!is_object($result)) { throw new KFactoryException('Cannot create object from identifier : ' . $identifier); } return $result; }
<?php /** * @version $Id$ * @category Nooku * @package Nooku_Server * @subpackage Banners * @copyright Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net). * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://www.nooku.org */ /** * Component Loader * * @author Cristiano Cucco <http://nooku.assembla.com/profile/cristiano.cucco> * @category Nooku * @package Nooku_Server * @subpackage Banners */ KLoader::loadIdentifier('com://site/banners.aliases'); echo KService::get('com://site/banners.dispatcher')->dispatch();
<?php defined('KOOWA') or die('Restricted access'); /** * @category Ninjaboard * @copyright Copyright (C) 2007 - 2011 NinjaForge. All rights reserved. * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://ninjaforge.com */ KLoader::load('admin::com.ninja.view.json'); class ComNinjaboardViewMessagesJson extends ComNinjaViewJson { /** * Return the views output * * @return string The output of the view */ public function display() { $model = $this->getModel(); $template = KFactory::get('site::com.ninjaboard.view.message.html')->getTemplate(); $params = KFactory::get('admin::com.ninjaboard.model.settings')->getParams(); $me = KFactory::get('admin::com.ninjaboard.model.people')->getMe(); $data = array(); foreach ($model->getList() as $message) { $result = $message->getData(); $result['html'] = $template->loadIdentifier('site::com.ninjaboard.view.message.list', array('message' => $message, 'params' => $params, 'me' => $me))->render(true); $data[] = $result; } return json_encode($data); }
<?php /* @version 1.0.0 * @package mod_ninjaboard_menu * @author Stephanie Scmidt * @author mail admin@dwtutorials.com * @link http://www.dwtutorials.com * @copyright Copyright (C) 2009 Stephanie Scmidt - All rights reserved. */ KLoader::load('admin::com.ninja.view.module'); class ModNbmenuHtml extends ComNinjaViewModuleHtml { /** * Model identifier, points to the component model * * @var string */ protected $_model = 'admin::com.ninjaboard.model.forums'; public function __construct(array $options = array()) { parent::__construct($options); KFactory::get($this->getModel())->recurse(1); } public function display() { $model = KFactory::get($this->getModel()); $this->forums = $model->getList(); $this->total = $model->getTotal(); $this->state = $model->getState(); $this->forum = $model->getItem(); $this->i = 0;
<?php /** * @version $Id: users.php 2639 2011-09-01 03:06:25Z johanjanssens $ * @category Nooku * @package Nooku_Server * @subpackage Users * @copyright Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net). * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://www.nooku.org */ /** * Component Loader * * @author Gergo Erdosi <http://nooku.assembla.com/profile/gergoerdosi> * @category Nooku * @package Nooku_Server * @subpackage Users */ KLoader::load('com://site/users.mappings'); echo KFactory::get('com://site/users.dispatcher')->dispatch();
<?php /** * @version $Id: weblinks.php 3024 2011-10-09 01:44:30Z johanjanssens $ * @category Nooku * @package Nooku_Server * @subpackage Weblinks * @copyright Copyright (C) 2011 - 2012 Timble CVBA and Contributors. (http://www.timble.net) * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://www.nooku.org */ /** * Component Loader * * @author Jeremy Wilken <http://nooku.assembla.com/profile/gnomeontherun> * @category Nooku * @package Nooku_Server * @subpackage Weblinks */ KLoader::loadIdentifier('com://site/weblinks.aliases'); echo KService::get('com://site/weblinks.dispatcher')->dispatch();
public function render($content = ' ', $title = false, array $module = array(), $attribs = array()) { /* KLoader::load('lib.joomla.application.module.helper'); $load =& JModuleHelper::_load(); $load[] = (object) array( 'id' => 50, 'title' => $title, 'module' => 'mod_custom', 'position' => 'above', 'content' => $content, 'showtitle' => 1, 'control' => '', 'params' => ' moduleclass_sfx=-slide red cache=0 ', 'user' => 0, 'name' => 'custom', //'style' => isset($module['style']) ? $module['style'] : 'rounded', 'style' => 'xhtml' ); return null; die('<pre>'.print_r($load, true).'</pre>'); //*/ /* 0 => stdClass::__set_state(array( 'id' => '50', 'title' => 'Breadcrumb', 'module' => 'mod_breadcrumbs', 'position' => 'breadcrumb', 'content' => '', 'showtitle' => '0', 'control' => '', 'params' => 'showHome=1 homeText=Home showLast=1 separator= moduleclass_sfx= cache=0 ', 'user' => 0, 'name' => 'breadcrumbs', 'style' => NULL, )), */ $tmp = $module; $module = new KObject(); $module->params = 'moduleclass_sfx=' . @$tmp['moduleclass_sfx']; $module->module = 'mod_' . $this->_identifier->package . '_' . $this->_identifier->name; $module->id = KFactory::tmp('lib.koowa.filter.int')->sanitize(uniqid()); $module->title = (string) $title; $module->style = isset($tmp['style']) ? $tmp['style'] : 'rounded'; $module->position = $this->_identifier->package . '-' . $this->_identifier->name; $module->showtitle = (bool) $title; $module->name = $this->_identifier->package . '_' . $this->_identifier->name; $module->user = 0; $module->content = $content; $module->set($tmp); if (!isset($attribs['name'])) { $attribs['name'] = $module->position; } if (!isset($attribs['style'])) { $attribs['style'] = $module->style; } if (!isset($attribs['first'])) { $attribs['first'] = null; } if (!isset($attribs['last'])) { $attribs['last'] = null; } if (($yoofix = JPATH_THEMES . DS . KFactory::get('lib.joomla.application')->getTemplate() . DS . 'lib' . DS . 'php' . DS . 'template.php') && ($isYoo = file_exists($yoofix))) { require_once $yoofix; } if ($isYoo) { $attribs['style'] = 'yoo'; } static $chrome; $mainframe = JFactory::getApplication(); $scope = $mainframe->scope; //record the scope $mainframe->scope = $module->module; //set scope to Component name // Get module parameters $params = new JParameter($module->params); // Get module path $module->module = preg_replace('/[^A-Z0-9_\\.-]/i', '', $module->module); $path = JPATH_BASE . DS . 'modules' . DS . $module->module . DS . $module->module . '.php'; // Load the module if (!$module->user && file_exists($path) && empty($module->content)) { $lang =& JFactory::getLanguage(); $lang->load($module->module); $content = ''; ob_start(); require $path; $module->content = ob_get_contents() . $content; ob_end_clean(); } // Load the module chrome functions if (!$chrome) { $chrome = array(); } KLoader::load('lib.joomla.application.module.helper'); $load =& JModuleHelper::_load(); if (!$this->_modules) { $this->_modules_backup = $this->_modules = $load; } $this->_modules[] = $module; $load = $this->_modules; require_once JPATH_BASE . DS . 'templates' . DS . 'system' . DS . 'html' . DS . 'modules.php'; $chromePath = JPATH_BASE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'modules.php'; if (!isset($chrome[$chromePath])) { if (file_exists($chromePath)) { require_once $chromePath; } $chrome[$chromePath] = true; } //make sure a style is set if (!isset($attribs['style'])) { $attribs['style'] = 'rounded'; } //dynamically add outline style if (JRequest::getBool('tp')) { $attribs['style'] .= ' outline'; } $tpl = KFactory::get('lib.joomla.application')->getTemplate(); $yoofix = false; $warpfive = 'templates/' . $tpl . '/layouts/module.php'; if (JFile::exists(JPATH_ROOT . '/' . $warpfive)) { $tpl_dir = JPATH_ROOT . "/templates/{$tpl}"; //include warp require_once $tpl_dir . '/warp/warp.php'; $warp = Warp::getInstance(); $warp->getHelper('path')->register($tpl_dir . '/warp/systems/joomla.1.5/helpers', 'helpers'); $warp->getHelper('path')->register($tpl_dir . '/warp/systems/joomla.1.5/layouts', 'layouts'); $warp->getHelper('path')->register($tpl_dir . '/layouts', 'layouts'); $template = KFactory::tmp($this->getTemplate())->addFilters(array('alias')); $template->getFilter('alias')->append(array('$this' => '$warp_helper_template')); $data = array('warp_helper_template' => $warp->getHelper("template"), '$warp' => $warp); $module->menu = false; $yoofix = true; } foreach (explode(' ', $attribs['style']) as $style) { $chromeMethod = 'modChrome_' . $style; //Warp 5.5 fix if ($yoofix) { $module->parameter = new JParameter($module->params); $data['module'] = $module; $data['params'] = array(); //@TODO count this $count = 1; $index = 0; $data['params']['count'] = $count; $data['params']['order'] = $index + 1; $data['params']['first'] = $data['params']['order'] == 1; $data['params']['last'] = $data['params']['order'] == $count; $data['params']['suffix'] = $module->parameter->get('moduleclass_sfx', ''); $data['params']['menu'] = false; // get class suffix params $parts = preg_split('/[\\s]+/', $data['params']['suffix']); foreach ($parts as $part) { if (strpos($part, '-') !== false) { $yoostyles = explode('-', $part, 2); $data['params'][$yoostyles[0]] = $yoostyles[1]; } } $module->content = $template->loadPath($warpfive, $data)->render(true); } elseif (function_exists($chromeMethod)) { $module->style = $attribs['style']; ob_start(); $chromeMethod($module, $params, $attribs); $module->content = ob_get_contents(); ob_end_clean(); } } $mainframe->scope = $scope; //revert the scope return $module->content; }
* @category Ninjaboard * @copyright Copyright (C) 2007 - 2011 NinjaForge. All rights reserved. * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://ninjaforge.com */ /** * If koowa is unavailable * Abort the dispatcher */ if (!defined('KOOWA')) { return; } /** * If Ninjaboard is unavailable * Abort the dispatcher */ if (!KLoader::path('site::com.ninjaboard.dispatcher')) { return; } //Initialize the dispatcher just so models are mapped, and everything else Ninjaboard needs to run KLoader::load('site::com.ninjaboard.dispatcher'); ComNinjaboardDispatcher::register(); /** * Renders latest posts with the same look and feel like the regular component list * * @category Ninjaboard * @copyright Copyright (C) 2007 - 2011 NinjaForge. All rights reserved. * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://ninjaforge.com */ echo KFactory::tmp('site::mod.ninjaboard_posts.html', array('params' => $params, 'module' => $module, 'attribs' => $attribs))->display();
<?php /** * @version $Id: blog.php 4 2010-07-11 09:59:36Z copesc $ * @package blog * @copyright Copyright (C) 2009 Nooku. All rights reserved. * @license GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html> * @link http://www.nooku.org */ // Check if Koowa is active if (!defined('KOOWA')) { JError::raiseWarning(0, JText::_("Koowa wasn't found. Please install the Koowa plugin and enable it.")); return; } try { // Require the defines KLoader::load('site::com.blog.defines'); // Create the controller dispatcher KFactory::get('site::com.blog.dispatcher')->dispatch(KRequest::get('get.view', 'cmd', 'posts')); } catch (Exception $e) { //KFactory::get('site::com.error.controller.error')->manage($e); JError::raiseWarning(0, $e->getMessage() . "<br/><br/>" . nl2br($e->getTraceAsString())); }
<?php defined('KOOWA') or die('Restricted access'); /** * @package Ninja * @copyright Copyright (C) 2011 NinjaForge. All rights reserved. * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://ninjaforge.com */ KLoader::load('admin::com.ninja.helper.paginator'); class ComNinjaboardTemplateHelperPaginator extends ComNinjaHelperPaginator { /** * Template item override * * @var boolean */ protected $_item_override = false; /** * Template list override * * @var boolean */ protected $_list_override = false; /** * Render item pagination * * @param int Total number of items * @param int Offset for the current page * @param int Limit of items per page * @param int Number of links to show before and after the current page link
jimport('joomla.environment.uri'); jimport('joomla.html.html'); jimport('joomla.html.parameter'); jimport('joomla.utilities.utility'); jimport('joomla.event.event'); jimport('joomla.event.dispatcher'); jimport('joomla.language.language'); jimport('joomla.utilities.string'); jimport('joomla.plugin.helper'); require_once JPATH_CONFIGURATION . '/configuration.php'; require_once JPATH_LIBRARIES . '/anahita/anahita.php'; $config = new JConfig(); //instantiate anahita and nooku Anahita::getInstance(array('cache_prefix' => md5($config->secret) . '-cache-koowa', 'cache_enabled' => $config->caching)); KServiceIdentifier::setApplication('site', JPATH_SITE); KServiceIdentifier::setApplication('admin', JPATH_ADMINISTRATOR); KLoader::addAdapter(new AnLoaderAdapterComponent(array('basepath' => JPATH_BASE))); KServiceIdentifier::addLocator(KService::get('anahita:service.locator.component')); KLoader::addAdapter(new KLoaderAdapterPlugin(array('basepath' => JPATH_ROOT))); KServiceIdentifier::addLocator(KService::get('koowa:service.locator.plugin')); KLoader::addAdapter(new AnLoaderAdapterTemplate(array('basepath' => JPATH_BASE))); KServiceIdentifier::addLocator(KService::get('anahita:service.locator.template')); KService::setAlias('koowa:database.adapter.mysqli', 'com://admin/default.database.adapter.mysqli'); KService::setAlias('anahita:domain.store.database', 'com:base.domain.store.database'); KService::setAlias('anahita:domain.space', 'com:base.domain.space'); //make sure for the autoloader to be reigstered after nooku $autoloader = (require_once JPATH_VENDOR . '/autoload.php'); $autoloader->unregister(); $autoloader->register(); KLoader::getInstance()->loadIdentifier('com://site/application.aliases');