本文整理汇总了PHP中JLoader::discover方法的典型用法代码示例。如果您正苦于以下问题:PHP JLoader::discover方法的具体用法?PHP JLoader::discover怎么用?PHP JLoader::discover使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JLoader
的用法示例。
在下文中一共展示了JLoader::discover方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param Registry $params
*/
private function __construct(Registry $params)
{
JLoader::discover('WoWAdapter', __DIR__ . '/adapters/');
JLoader::register('WoWModuleAbstract', __DIR__ . '/module/abstract.php');
JFactory::getLanguage()->load('lib_wow');
$this->params = $params;
}
示例2: exists
/**
* Determines if compojoom comments is installed
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function exists()
{
$file = JPATH_ROOT . '/components/com_comment/helpers/utils.php';
if (!JFile::exists($file)) {
return false;
}
// Discover their library
JLoader::discover('ccommentHelper', JPATH_ROOT . '/components/com_comment/helpers');
return true;
}
示例3: getRules
/**
* Get the component rules
*
* @return array
*/
public function getRules()
{
$rules = array();
$files = JFolder::files(JPATH_COMPONENT_ADMINISTRATOR . '/libraries/rules', '.php$', false, false);
JLoader::discover('jedcheckerRules', JPATH_COMPONENT_ADMINISTRATOR . '/libraries/rules/');
foreach ($files as $file) {
$rules[] = substr($file, 0, -4);
}
return $rules;
}
示例4: render
/**
* Returns the translated label for a value
*
* @param object $field - the field config object
* @param string $value - string
* @param string $component - if we want to load overriden customfields provide the component where we should check
*
* @return mixed
*/
public static function render($field, $value, $component = null)
{
$class = 'CompojoomFormCustomfields' . ucfirst($field->type);
if ($component) {
JLoader::discover('CompojoomFormCustomfields', JPATH_ADMINISTRATOR . '/components/' . $component . '/models/fields/customfields');
JLoader::discover('CompojoomFormCustomfields', JPATH_SITE . '/templates/' . CompojoomTemplateHelper::getFrontendTemplate() . '/html/' . $component . '/fields/customfields');
}
if (!isset(self::$customFields[$class])) {
self::$customFields[$class] = new $class();
}
return self::$customFields[$class]->render($field, $value);
}
示例5: upgrade
function upgrade()
{
ob_start();
if (function_exists('error_reporting')) {
//Store the current error reporting level
$oldLevel = error_reporting();
error_reporting(E_ERROR | E_WARNING | E_PARSE);
if (JDEBUG) {
error_reporting(E_ALL);
}
}
$extension = JRequest::getVar('ext', 'virtuemart');
$current_step = JRequest::getVar('step', 'start');
$steps = JRequest::getVar('steps_' . $extension, array(), 'post', 'ARRAY');
if (!count($steps)) {
$step = array();
$step['next'] = '';
$step['log'] = 'You need to select at least one action';
$step['log_type'] = 'error';
echo json_encode($step);
jexit();
}
jimport('joomla.application.component.model');
JLoader::import('base', JPATH_ADMINISTRATOR . '/components/com_vmmigrate/models');
JLoader::discover('VMMigrateModel', JPATH_COMPONENT_ADMINISTRATOR . '/migrators');
//JLoader::discover('VMMigrateModel', JPATH_COMPONENT_ADMINISTRATOR . '/migratorsdemo');
//JLoader::import( $extension, JPATH_ADMINISTRATOR.'/components/com_vmmigrate/migrators' );
$model = JModelLegacy::getInstance($extension, 'VMMigrateModel');
$first_step = $steps[0];
$count_steps = count($steps);
$last_step = $steps[$count_steps - 1];
$model->setExtension($extension);
if ($current_step == 'start') {
$result = $model->execute_step($first_step, $steps);
} else {
$result = $model->execute_step($current_step, $steps);
}
if ($current_step == $last_step && $result['percentage'] == 100) {
$result['allcompleted'] = true;
}
//Let's trap the errors that may have been sent to the buffer
$buf = ob_get_clean();
if ($buf) {
$result['systemerror'] = $buf;
}
echo json_encode($result);
if (function_exists('error_reporting')) {
error_reporting($oldLevel);
}
jexit();
}
示例6: check
public function check()
{
$rule = JRequest::getString('rule');
JLoader::discover('jedcheckerRules', JPATH_COMPONENT_ADMINISTRATOR . '/libraries/rules/');
$path = JFactory::getConfig()->get('tmp_path') . '/jed_checker/unzipped';
$class = 'jedcheckerRules' . ucfirst($rule);
// Stop if the class does not exist
if (!class_exists($class)) {
return false;
}
// Loop through each folder and police it
$folders = $this->getFolders();
foreach ($folders as $folder) {
$this->police($class, $folder);
}
return true;
}
示例7: discover
/**
* Discovers the table classes in all Projectfork related components.
* Stores an instance in $table_cache.
*
* @return void
*/
public static function discover()
{
static $loaded = false;
if ($loaded) {
return;
}
$coms = PFApplicationHelper::getComponents();
foreach ($coms as $com) {
$path = JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $com->element . '/tables');
$prefixes = array('PFtable', 'JTable', ucfirst(substr($com->element, 3)) . 'Table');
if (!is_dir($path)) {
continue;
}
$files = JFolder::files($path, '.php$');
if (!count($files)) {
continue;
}
// Discover the table class names with some guessing about the prefix
foreach ($prefixes as $prefix) {
JLoader::discover($prefix, $path, false);
foreach ($files as $file) {
$name = JFile::stripExt($file);
$class = $prefix . $name;
$context = strtolower($com->element . '.' . $name);
if (class_exists($class)) {
// Class found, try to get an instance
$instance = JTable::getInstance($name, $prefix);
if (!$instance) {
continue;
}
self::$context_cache[] = $context;
self::$table_cache[$context] = $instance;
self::$methods_cache[$context] = array();
$methods = get_class_methods($instance);
foreach ($methods as $method) {
self::$methods_cache[$context][] = strtolower($method);
}
}
}
}
}
$loaded = true;
}
示例8: onContentPrepare
public function onContentPrepare($context, &$row, &$params, $page = 0)
{
if (JString::strpos($row->text, '{membermap}') === false) {
return true;
}
$this->loadLanguage();
JLoader::discover('MemberMapAdapter', __DIR__ . '/adapters/');
$class = 'MemberMapAdapter' . $this->params->get('source');
if (class_exists($class)) {
$this->adapter = new $class($this->params);
} else {
JFactory::getApplication()->enqueueMessage(JText::sprintf('PLG_SYSTEM_MEMBERMAP_SOURCE_NOT_AVAILABLE', $this->params->get('source')), 'error');
return true;
}
if ($this->loaded == true) {
JFactory::getApplication()->enqueueMessage(JText::_('PLG_SYSTEM_MEMBERMAP_ONLY_ONE_INSTANCE'), 'error');
return true;
} else {
$this->initMap();
$this->loaded = true;
}
$row->text = JString::str_ireplace('{membermap}', '<div id="membermap"></div>', $row->text);
}
示例9: defined
* @package Joomla.Site
* @subpackage com_visforms
* @link http://www.vi-solutions.de
* @license GNU General Public License version 2 or later; see license.txt
* @copyright 2012 vi-solutions
* @since Joomla 1.6
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
//load control html classes
JLoader::discover('VisformsHtml', dirname(__FILE__) . '/html/control/', $force = true, $recurse = false);
JLoader::discover('VisformsHtmlControl', dirname(__FILE__) . '/html/control/decorator/', $force = true, $recurse = false);
JLoader::discover('VisformsHtmlControlDecorator', dirname(__FILE__) . '/html/control/decorator/decorators/', $force = true, $recurse = false);
JLoader::discover('VisformsHtmlControlVisforms', dirname(__FILE__) . '/html/control/default/', $force = true, $recurse = false);
JLoader::discover('VisformsHtmlControlBtdefault', dirname(__FILE__) . '/html/control/btdefault/', $force = true, $recurse = false);
JLoader::discover('VisformsHtmlControlBthorizontal', dirname(__FILE__) . '/html/control/bthorizontal/', $force = true, $recurse = false);
/**
* Create HTML of a form field according to it's type
*
* @package Joomla.Site
* @subpackage com_visforms
* @since 1.6
*/
abstract class VisformsHtml
{
/**
* The field type.
*
* @var string
* @since 11.1
*/
示例10: GetMigratorsPro
public static function GetMigratorsPro($extensions = array())
{
if (!count($extensions)) {
$extensions = VMMigrateHelperVMMigrate::GetMigrators();
}
JLoader::discover('VMMigrateModel', JPATH_COMPONENT_ADMINISTRATOR . '/migrators');
//Load the migrator steps
foreach ($extensions as $extension) {
$model = JModelLegacy::getInstance($extension, 'VMMigrateModel');
$proversions[$extension] = $model->isPro;
}
return $proversions;
}
示例11: defined
<?php
/**
* @package Sichtweiten
* @subpackage Component.Site
* @author Thomas Hunziker <bakual@bakual.ch>
* @copyright 2015 - Thomas Hunziker
* @license http://www.gnu.org/licenses/gpl.html
**/
defined('_JEXEC') or die;
// Register Helperclasses for autoloading
JLoader::discover('SichtweitenHelper', JPATH_COMPONENT . '/helpers');
// Load languages and merge with fallbacks
$jlang = JFactory::getLanguage();
$jlang->load('com_sichtweiten', JPATH_COMPONENT, 'en-GB', true);
$jlang->load('com_sichtweiten', JPATH_COMPONENT, null, true);
$controller = JControllerLegacy::getInstance('Sichtweiten');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
示例12: defined
<?php
/**
* @package Cmc
* @author DanielDimitrov <daniel@compojoom.com>
* @date 28.08.13
*
* @copyright Copyright (C) 2008 - 2013 compojoom.com . All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('_JEXEC') or die('Restricted access');
defined('_JEXEC') or die('Restricted access');
jimport('joomla.application.component.controller');
JLoader::discover('CmcSyncer', JPATH_COMPONENT_ADMINISTRATOR . '/libraries/syncer');
/**
* Class CmcControllerSync
*
* @since 1.2
*/
class CmcControllerSync extends CmcController
{
/**
* Initialize the sync process
*
* @return void
*/
public function start()
{
// Check for a valid token. If invalid, send a 403 with the error message.
JSession::checkToken('request') or $this->sendResponse(new Exception(JText::_('JINVALID_TOKEN'), 403));
// Put in a buffer to silence noise.
示例13: testLoad
/**
* Tests the JLoader::load method.
*
* @return void
*
* @since 11.3
* @covers JLoader::load
*/
public function testLoad()
{
JLoader::discover('Shuttle', __DIR__ . '/stubs/discover2', true);
JLoader::load('ShuttleChallenger');
$this->assertThat(JLoader::load('ShuttleChallenger'), $this->isTrue(), 'Tests that the class file was loaded.');
$this->assertThat(defined('CHALLENGER_LOADED'), $this->isTrue(), 'Tests that the class file was loaded.');
$this->assertThat(JLoader::load('Mir'), $this->isFalse(), 'Tests that an unknown class is ignored.');
$this->assertThat(JLoader::load('JLoaderTest'), $this->isTrue(), 'Tests that a loaded class returns true.');
}
示例14: defined
<?php
/**
* @package Cmc
* @author DanielDimitrov <daniel@compojoom.com>
* @date 06.09.13
*
* @copyright Copyright (C) 2008 - 2013 compojoom.com . All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('_JEXEC') or die('Restricted access');
JLoader::discover('cmcHelper', JPATH_COMPONENT_ADMINISTRATOR . '/helpers/');
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/tables');
jimport('joomla.application.component.controllerlegacy');
$controller = JControllerLegacy::getInstance('Cmc');
$controller->execute(JFactory::getApplication()->input->getCmd('task', ''));
$controller->redirect();
示例15: load_comments
//.........这里部分代码省略.........
* Passing any other value will silently skips the code. In all the above cases, <code>type</code> and <code>app_name</code> are required parameters.
* While <code>type</code> specifies the comment system to be used, <code>app_name</code> is the Joomla extension name (ex: com_appname) which is loading the comments for its content.
*
* @param string $type comment system type
* @param string $app_name extension name
* @param int $id id of the content for which the comments are being loaded
* @param string $title title of the content
* @param string $url page url in case of facebook/disqus/intensedebate comment system.
* @param string $identifier disqus username in case of disqus/intensedebate comment system.
* @param object $item the item object for kommento
*
* @return string the code to render the comments.
*/
public static function load_comments($type, $app_name, $id = 0, $title = '', $url = '', $identifier = '', $item = null)
{
switch ($type) {
case 'jcomment':
$app = JFactory::getApplication();
$path = JPATH_ROOT . DS . 'components' . DS . 'com_jcomments' . DS . 'jcomments.php';
if (file_exists($path)) {
require_once $path;
return JComments::showComments($id, $app_name, $title);
}
break;
case 'fbcomment':
return '
<div id="fb-root"></div>
<script type="text/javascript">
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s);
js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3";
fjs.parentNode.insertBefore(js, fjs);
}(document, "script", "facebook-jssdk"));
</script>
<div class="fb-comments" data-href="' . $url . '" data-num-posts="5" data-width="640"></div>';
case 'disqus':
return '
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = "' . $identifier . '";
// var disqus_developer = 1;
var disqus_identifier = "' . $id . '";
var disqus_url = "' . $url . '";
var disqus_title = "' . $title . '";
(function() {
var dsq = document.createElement("script");
dsq.type = "text/javascript";
dsq.async = true;
dsq.src = "http://" + disqus_shortname + ".disqus.com/embed.js";
(document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>';
case 'intensedebate':
return '
<script>
var idcomments_acct = "' . $identifier . '";
var idcomments_post_id = "' . $id . '";
var idcomments_post_url = "' . $url . '";
</script>
<span id="IDCommentsPostTitle" style="display:none"></span>
<script type="text/javascript" src="http://www.intensedebate.com/js/genericCommentWrapperV2.js"></script>';
break;
case 'jacomment':
if (!JRequest::getInt('print') && file_exists(JPATH_SITE . DS . 'components' . DS . 'com_jacomment' . DS . 'jacomment.php') && file_exists(JPATH_SITE . DS . 'plugins' . DS . 'system' . DS . 'jacomment.php')) {
$_jacCode = "#{jacomment(.*?) contentid=(.*?) option=(.*?) contenttitle=(.*?)}#i";
$_jacCodeDisableid = "#{jacomment(\\s)off.*}#i";
$_jacCodeDisable = "#{jacomment(\\s)off}#i";
if (!preg_match($_jacCode, $title) && !preg_match($_jacCodeDisable, $title) && !preg_match($_jacCodeDisableid, $title)) {
return '{jacomment contentid=' . $id . ' option=' . $app_name . ' contenttitle=' . $title . '}';
}
}
break;
case 'jomcomment':
$path = JPATH_PLUGINS . DS . 'content' . DS . 'jom_comment_bot.php';
if (file_exists($path)) {
include_once $path;
return jomcomment($id, $app_name);
}
break;
case 'kommento':
$api = JPATH_ROOT . DS . 'components' . DS . 'com_komento' . DS . 'bootstrap.php';
if (file_exists($api)) {
require_once $api;
$item->text = $item->introtext = !empty($item->description) ? $item->description : '';
return Komento::commentify($app_name, $item);
}
break;
case 'ccomment':
$utils = JPATH_ROOT . '/components/com_comment/helpers/utils.php';
if (file_exists($utils)) {
JLoader::discover('ccommentHelper', JPATH_ROOT . '/components/com_comment/helpers');
return ccommentHelperUtils::commentInit($app_name, $item);
}
break;
}
}