本文整理汇总了PHP中KLoader::load方法的典型用法代码示例。如果您正苦于以下问题:PHP KLoader::load方法的具体用法?PHP KLoader::load怎么用?PHP KLoader::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KLoader
的用法示例。
在下文中一共展示了KLoader::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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);
}
示例2: __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);
}
}
}
}
示例3: __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);
}
示例4: _initialize
protected function _initialize(KConfig $config)
{
KLoader::load('com://admin/learn.library.markdown');
$config->append(array(
'priority' => KCommand::PRIORITY_HIGHEST,
));
parent::_initialize($config);
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例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 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;
}
示例9: array
* @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();
示例10: __construct
<?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;
示例11:
<?php
/**
* @version $Id: banners.php 2644 2011-09-01 03:07:20Z johanjanssens $
* @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::load('com://site/banners.mappings');
echo KFactory::get('com://site/banners.dispatcher')->dispatch();
示例12: defined
<?php
defined('KOOWA') or die('Restricted access');
/**
* Manipulate images using standard methods such as resize, crop, rotate, etc.
* This class must be re-initialized for every image you wish to manipulate.
*
* $Id: image.php 1098 2011-07-07 16:57:05Z stian $
*
* @package self
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @license http://kohanaphp.com/license.html
*/
//@TODO this because Koowa changes camelCase classnames to plural, but not identifiers
KLoader::load('admin::com.ninja.helper.image.driver');
/**
* Improved image helper class, derived from Kohanas
*
* @author Stian Didriksen <stian@ninjaforge.com>
*/
class ComNinjaHelperImage extends KTemplateHelperAbstract
{
// Master Dimension
const NONE = 1;
const AUTO = 2;
const HEIGHT = 3;
const WIDTH = 4;
// Flip Directions
const HORIZONTAL = 5;
const VERTICAL = 6;
示例13: defined
<?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);
}
示例14: save
public function save()
{
KLoader::load('joomla.user.helper');
// Load the old row if editing an existing user.
if(!$this->_new)
{
$old_row = KFactory::get('com://admin/users.database.table.users')
->select($this->id, KDatabase::FETCH_ROW);
}
$user = KFactory::get('joomla:user');
// Validate received data.
if(($this->_new || isset($this->_modified['name'])) && trim($this->name) == '')
{
$this->setStatus(KDatabase::STATUS_FAILED);
$this->setStatusMessage(JText::_('Please enter a name!'));
return false;
}
if(($this->_new || isset($this->_modified['username'])) && trim($this->username) == '')
{
$this->setStatus(KDatabase::STATUS_FAILED);
$this->setStatusMessage(JText::_('Please enter a username!'));
return false;
}
if(($this->_new || isset($this->_modified['username'])) && preg_match('#[<>"\'%;()&]#i', $this->username) || strlen(utf8_decode($this->username)) < 2)
{
$this->setStatus(KDatabase::STATUS_FAILED);
$this->setStatusMessage(JText::_('Please enter a valid username. No spaces, at least 2 characters '.
'and must contain <strong>only</strong> letters and numbers.'));
return false;
}
if(isset($this->_modified['username']))
{
$query = KFactory::get('koowa:database.query')
->where('username', '=', $this->username)
->where('id', '<>', (int) $this->id);
$total = KFactory::get('com://admin/users.database.table.users')
->count($query);
if($total)
{
$this->setStatus(KDatabase::STATUS_FAILED);
$this->setStatusMessage(JText::_('This username is already in use.'));
return false;
}
}
if(($this->_new || isset($this->_modified['email'])) && (trim($this->email) == '') || !(KFactory::get('koowa:filter.email')->validate($this->email)))
{
$this->setStatus(KDatabase::STATUS_FAILED);
$this->setStatusMessage(JText::_('Please enter a valid e-mail address.'));
return false;
}
if(isset($this->_modified['email']))
{
$query = KFactory::get('koowa:database.query')
->where('email', '=', $this->email)
->where('id', '<>', (int) $this->id);
$total = KFactory::get('com://admin/users.database.table.users')
->count($query);
if($total)
{
$this->setStatus(KDatabase::STATUS_FAILED);
$this->setStatusMessage(JText::_('This e-mail address is already registered.'));
return false;
}
}
/*
* If username field is an email it has to be the same with email field.
* This removes the possibilitiy that a user can get locked out of her account
* if someone else uses that username as the email field.
*/
if (KFactory::get('koowa:filter.email')->validate($this->username) === true
&& $this->username !== $this->email) {
$this->setStatus(KDatabase::STATUS_FAILED);
$this->setStatusMessage(JText::_('Your e-mail and username should match if you want to use an e-mail address as your username.'));
return false;
}
// Don't allow users to block themselves.
if(isset($this->_modified['enabled']) && !$this->_new && $user->id == $this->id && !$this->enabled)
{
$this->setStatus(KDatabase::STATUS_FAILED);
//.........这里部分代码省略.........
示例15: defined
<?php
defined('KOOWA') or die('Restricted access');
/*
* @version 1.0.2
* @package mod_ninjaboard_latest_posts
* @author NinjaForge
* @author email support@ninjaforge.com
* @link http://ninjaforge.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright Copyright (C) 2010 NinjaForge - All rights reserved.
*/
KLoader::load('admin::com.ninja.view.module.html');
KLoader::load('site::com.ninjaboard.view.posts');
//class helper
class ModNinjaboard_latest_postsHtml extends ComNinjaViewModuleHtml
{
public function display()
{
$this->assign('params', KFactory::get('site::mod.ninjaboard_latest_posts.settings')->getParams());
$this->direction = @$params->get('order_by');
$this->limit = @$params->get('num_posts');
if (@$params->get('which_posts') == 1) {
$this->sort = 'first_post.created_time';
} elseif (@$params->get('which_posts') == 2) {
$this->sort = 'last_post.created_time';
} else {
$this->sort = 'created_time';
}
$model = KFactory::get($this->getModel())->limit($this->limit)->sort($this->sort())->direction($this->direction());
$this->topics = $model->getList();