本文整理汇总了PHP中JLoader::getClassList方法的典型用法代码示例。如果您正苦于以下问题:PHP JLoader::getClassList方法的具体用法?PHP JLoader::getClassList怎么用?PHP JLoader::getClassList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JLoader
的用法示例。
在下文中一共展示了JLoader::getClassList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAfterRender
function onAfterRender()
{
$app = JFactory::getApplication();
if ($app->isSite()) {
$loaded = JLoader::getClassList();
if (isset($loaded['baformshelper'])) {
$html = JResponse::getBody();
$html_split = explode('<body', $html, 2);
$pre = $html_split['0'];
$body = '<body' . $html_split['1'];
$body_split = explode('</body>', $body);
$post = array_pop($body_split);
$body = implode('</body>', $body_split) . '</body>';
$body = $this->getContent($body);
$html = $pre . $body . $post;
JResponse::setBody($html);
}
}
}
示例2: onAfterRender
function onAfterRender()
{
$app = JFactory::getApplication();
if ($app->isSite()) {
$loaded = JLoader::getClassList();
if (in_array(JPATH_ROOT . '/administrator/components/com_baforms/helpers/baforms.php', $loaded)) {
$html = JResponse::getBody();
$html_split = explode('<body', $html, 2);
$pre = $html_split['0'];
$body = '<body' . $html_split['1'];
$body_split = explode('</body>', $body);
$post = array_pop($body_split);
$body = implode('</body>', $body_split) . '</body>';
$body = $this->getContent($body);
$html = $pre . $body . $post;
JResponse::setBody($html);
}
}
}
示例3: _pathFromClassname
/**
* Get the path based on a class name
*
* @param string The class name
* @return string|false Returns the path on success FALSE on failure
*/
protected function _pathFromClassname($classname)
{
$path = false;
$word = preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $classname);
$parts = explode('_', $word);
// If class start with a 'J' it is a Joomla framework class and we handle it
if(array_shift($parts) == $this->_prefix)
{
$class = strtolower($classname); //force to lower case
if (class_exists($class)) {
return;
}
$classes = method_exists('JLoader','getClassList') ? JLoader::getClassList() : JLoader::register();
if(array_key_exists( $class, $classes)) {
$path = $classes[$class];
}
}
return $path;
}
示例4: testRegister
/**
* Tests the JLoader::register method.
*
* @return void
*
* @since 11.1
*/
public function testRegister()
{
JLoader::register('BogusLoad', $this->bogusFullPath);
$this->assertThat(in_array($this->bogusFullPath, JLoader::getClassList()), $this->isTrue(), 'Tests that the BogusLoad class has been registered.');
JLoader::register('fred', 'fred.php');
$this->assertThat(in_array('fred.php', JLoader::getClassList()), $this->isFalse(), 'Tests that a file that does not exist does not get registered.');
}
示例5: load
/**
* Method to intelligently load class files in the framework
*
* @param string $classname The class name
* @param string $filepath The filepath ( dot notation )
* @param array $options
* @return boolean
*/
public static function load($classname, $filepath = 'library', $options = array('site' => 'site', 'type' => 'libraries', 'ext' => 'dioscouri'))
{
$classname = strtolower($classname);
if (version_compare(JVERSION, '1.6.0', 'ge')) {
// Joomla! 1.6+ code here
$classes = JLoader::getClassList();
} else {
// Joomla! 1.5 code here
$classes = JLoader::register();
}
if (class_exists($classname) || array_key_exists($classname, $classes)) {
// echo "$classname exists<br/>";
return true;
}
static $paths;
if (empty($paths)) {
$paths = array();
}
if (empty($paths[$classname]) || !is_file($paths[$classname])) {
// find the file and set the path
if (!empty($options['base'])) {
$base = $options['base'];
} else {
// recreate base from $options array
switch ($options['site']) {
case "site":
$base = JPATH_SITE . '/';
break;
default:
$base = JPATH_ADMINISTRATOR . '/';
break;
}
$base .= !empty($options['type']) ? $options['type'] . '/' : '';
$base .= !empty($options['ext']) ? $options['ext'] . '/' : '';
}
$paths[$classname] = $base . str_replace('.', '/', $filepath) . '.php';
}
// if invalid path, return false
if (!is_file($paths[$classname])) {
// echo "file does not exist<br/>";
return false;
}
// if not registered, register it
if (!array_key_exists($classname, $classes)) {
// echo "$classname not registered, so registering it<br/>";
JLoader::register($classname, $paths[$classname]);
return true;
}
return false;
}
示例6: testFailsToRegisterABadClass
/**
* This test should try and fail to register a non-existent class
*
* @group JLoader
* @covers JLoader::register
* @return void
*/
public function testFailsToRegisterABadClass()
{
JLoader::register("fred", "fred.php");
$this->assertFalse(in_array('fred.php', JLoader::getClassList()));
}