当前位置: 首页>>代码示例>>PHP>>正文


PHP KLoader类代码示例

本文整理汇总了PHP中KLoader的典型用法代码示例。如果您正苦于以下问题:PHP KLoader类的具体用法?PHP KLoader怎么用?PHP KLoader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了KLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

    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);
    }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:27,代码来源:logman.php

示例2: loadClass

 /**
  * 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;
 }
开发者ID:janssit,项目名称:www.gincoprojects.be,代码行数:37,代码来源:loader.php

示例3: __construct

 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);
 }
开发者ID:Roma48,项目名称:mayak,代码行数:59,代码来源:koowa.php

示例4: __construct

 /**
  * 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);
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:13,代码来源:modules.php

示例5: __construct

 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);
             }
         }
     }
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:58,代码来源:installer.php

示例6: __construct

 /**
  * 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);
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:14,代码来源:module_chrome.php

示例7: _initialize

    protected function _initialize(KConfig $config)
    {
        KLoader::load('com://admin/learn.library.markdown');

        $config->append(array(
            'priority' => KCommand::PRIORITY_HIGHEST,
        ));
        
        parent::_initialize($config);
    }
开发者ID:raeldc,项目名称:com_learn,代码行数:10,代码来源:markdown.php

示例8: instantiate

	/**
	 * 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;
	}
开发者ID:raeldc,项目名称:com_learn,代码行数:71,代码来源:component.php

示例9: __construct

 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);
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:54,代码来源:koowa.php

示例10: __construct

 /**
  * 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);
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:20,代码来源:koowa.php

示例11: instantiate

 /**
  * 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;
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:23,代码来源:koowa.php

示例12: getStorage

	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;
	}
开发者ID:raeldc,项目名称:com_learn,代码行数:17,代码来源:yaml.php

示例13: loadIdentifier

	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;
	}
开发者ID:raeldc,项目名称:com_learn,代码行数:17,代码来源:markdown.php

示例14: instantiate

 /**
  * 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;
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:26,代码来源:plugin.php

示例15: getParameters

 /**
  * 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;
 }
开发者ID:walteraries,项目名称:anahita,代码行数:48,代码来源:form.php


注:本文中的KLoader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。