%PDF- %PDF-
Direktori : /home1/lightco1/public_html/lightingrepublic.com.au/libraries/koowa/loader/adapter/ |
Current File : //home1/lightco1/public_html/lightingrepublic.com.au/libraries/koowa/loader/adapter/module.php |
<?php /** * @version $Id$ * @package Koowa_Loader * @subpackage Adapter * @copyright Copyright (C) 2007 - 2012 Johan Janssens. All rights reserved. * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> */ /** * Loader Adapter for a plugin * * @author Johan Janssens <johan@nooku.org> * @package Koowa_Loader * @subpackage Adapter * @uses KInflector */ class KLoaderAdapterModule extends KLoaderAdapterAbstract { /** * The adapter type * * @var string */ protected $_type = 'mod'; /** * The class prefix * * @var string */ protected $_prefix = 'Mod'; /** * Get the path based on a class name * * @param string The class name * @return string|false Returns the path on success FALSE on failure */ public function findPath($classname, $basepath = null) { $path = false; $word = strtolower(preg_replace('/(?<=\\w)([A-Z])/', ' \\1', $classname)); $parts = explode(' ', $word); if (array_shift($parts) == 'mod') { //Switch the basepath if(!empty($basepath)) { $this->_basepath = $basepath; } $module = 'mod_'.strtolower(array_shift($parts)); $file = array_pop($parts); if(count($parts)) { if($parts[0] != 'view') { foreach($parts as $key => $value) { $parts[$key] = KInflector::pluralize($value); } } else $parts[0] = KInflector::pluralize($parts[0]); $path = implode('/', $parts); $path = $path.'/'.$file; } else $path = $file; $path = $this->_basepath.'/modules/'.$module.'/'.$path.'.php'; } return $path; } }