本文整理汇总了PHP中JModuleHelper::_load方法的典型用法代码示例。如果您正苦于以下问题:PHP JModuleHelper::_load方法的具体用法?PHP JModuleHelper::_load怎么用?PHP JModuleHelper::_load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JModuleHelper
的用法示例。
在下文中一共展示了JModuleHelper::_load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: count
/**
* Get module by id
*
* @param integer $id The id of the module
* @return object The Module object
* @author Sakis Terz
* @since 1.6.0
*/
public static function &getModule($id)
{
$result = null;
$modules =& JModuleHelper::_load();
$total = count($modules);
for ($i = 0; $i < $total; $i++) {
// Match the id of the module
if ($modules[$i]->id == (int) $id) {
// Found it
$result =& $modules[$i];
break;
// Found it
}
}
// If we didn't find it, and the name is mod_something, create a dummy object
if (is_null($result)) {
$result = parent::getModule('mod_cf_filtering');
if (is_null($result)) {
$result = new stdClass();
$result->id = 0;
$result->title = '';
$result->module = 'mod_cf_filtering';
$result->position = '';
$result->content = '';
$result->showtitle = 0;
$result->control = '';
$result->params = '';
$result->user = 0;
}
}
return $result;
}
示例2: load
public static function load()
{
if (MagebridgeModelConfig::load('preload_all_modules') == 0 && JRequest::getInt('Itemid') != 0) {
static $modules = null;
if (is_array($modules) == false) {
$modules = JModuleHelper::_load();
foreach ($modules as $index => $module) {
if (strstr($module->module, 'mod_magebridge') == false) {
unset($modules[$index]);
}
}
}
return $modules;
}
$application = JFactory::getApplication();
$db = JFactory::getDBO();
$where = array();
$where[] = 'm.published = 1';
$where[] = 'm.module LIKE "mod_magebridge%"';
$where[] = 'm.client_id = ' . (int) $application->getClientId();
$query = 'SELECT m.*' . ' FROM #__modules AS m' . ' LEFT JOIN #__modules_menu AS mm ON mm.moduleid = m.id' . ' WHERE ' . implode(' AND ', $where) . ' ORDER BY m.position, m.ordering';
$db->setQuery($query);
$modules = $db->loadObjectList();
return $modules;
}
示例3: getModules
/**
* Get modules by position
*
* @param string $position The position of the module
*
* @return array An array of module objects
*
* @since 11.1
*/
public static function getModules($position)
{
// [!] HUBzero compatibility
if (class_exists('\\Module')) {
return \Module::byPosition($position);
}
$position = strtolower($position);
$result = array();
$modules =& JModuleHelper::_load();
$total = count($modules);
for ($i = 0; $i < $total; $i++) {
if ($modules[$i]->position == $position) {
$result[] =& $modules[$i];
}
}
if (count($result) == 0) {
if (JRequest::getBool('tp') && JComponentHelper::getParams('com_templates')->get('template_positions_display')) {
$result[0] = JModuleHelper::getModule('mod_' . $position);
$result[0]->title = $position;
$result[0]->content = $position;
$result[0]->position = $position;
}
}
return $result;
}
示例4: strtolower
/**
* Get modules by position
*
* @param string $position The position of the module
*
* @return array An array of module objects
*
* @since 11.1
*/
public static function &getModules($position)
{
$app = JFactory::getApplication();
$position = strtolower($position);
$result = array();
if (!empty($position) && MageBridgeTemplateHelper::allowPosition($position) == false) {
return $result;
}
$modules = JModuleHelper::_load();
$total = count($modules);
for ($i = 0; $i < $total; $i++) {
if ($modules[$i]->position == $position) {
$result[] =& $modules[$i];
}
}
if (count($result) == 0) {
if (JRequest::getBool('tp') && JComponentHelper::getParams('com_templates')->get('template_positions_display')) {
$result[0] = JModuleHelper::getModule('mod_' . $position);
$result[0]->title = $position;
$result[0]->content = $position;
$result[0]->position = $position;
}
}
return $result;
}
示例5: __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);
}
示例6: strtolower
/**
* Get modules by position
*
* @access public
* @param string $position The position of the module
* @return array An array of module objects
*/
function &getModules($position)
{
$position = strtolower($position);
$result = array();
$modules =& JModuleHelper::_load();
$total = count($modules);
for ($i = 0; $i < $total; $i++) {
if ($modules[$i]->position == $position) {
$result[] =& $modules[$i];
}
}
return $result;
}
示例7: strtolower
/**
* Get modules by position
*
* @access public
* @param string $position The position of the module
* @return array An array of module objects
*/
function &getModules($position)
{
$position = strtolower($position);
$result = array();
$modules =& JModuleHelper::_load();
$total = count($modules);
for ($i = 0; $i < $total; $i++) {
if ($modules[$i]->position == $position) {
$result[] =& $modules[$i];
}
}
if (count($result) == 0) {
if (JRequest::getBool('tp')) {
$result[0] = JModuleHelper::getModule('mod_' . $position);
$result[0]->title = $position;
$result[0]->content = $position;
$result[0]->position = $position;
}
}
return $result;
}
示例8: strtolower
/**
* Get modules by position
*
* @param string $position The position of the module
*
* @return array An array of module objects
*/
public static function &getModules($position)
{
$app =& JFactory::getApplication();
$position = strtolower($position);
$result = array();
$modules =& JModuleHelper::_load();
$total = count($modules);
for ($i = 0; $i < $total; $i++) {
if ($modules[$i]->position == $position) {
$result[] =& $modules[$i];
}
}
if (count($result) == 0) {
if ($app->getCfg('debug_modules') && JRequest::getBool('tp')) {
$result[0] = JModuleHelper::getModule('mod_' . $position);
$result[0]->title = $position;
$result[0]->content = $position;
$result[0]->position = $position;
}
}
return $result;
}
示例9: displayCart
/**
* Displays the cart, expects to be called via ajax
*
* @return unknown_type
*/
function displayCart()
{
JLoader::import('com_tienda.library.json', JPATH_ADMINISTRATOR . '/components');
jimport('joomla.application.module.helper');
$modules = JModuleHelper::_load();
if (empty($modules)) {
echo json_encode(array('msg' => ''));
return;
}
foreach ($modules as $module) {
if ($module->module == 'mod_tienda_cart') {
$mainframe = JFactory::getApplication();
$mainframe->setUserState('mod_usercart.isAjax', '1');
echo json_encode(array('msg' => JModuleHelper::renderModule($module)));
return;
}
}
echo json_encode(array('msg' => ''));
return;
}
示例10: render
public function render($content = ' ', $title = false, array $module = array(), $attribs = array())
{
/*
KLoader::load('lib.joomla.application.module.helper');
$load =& JModuleHelper::_load();
$load[] = (object) array(
'id' => 50,
'title' => $title,
'module' => 'mod_custom',
'position' => 'above',
'content' => $content,
'showtitle' => 1,
'control' => '',
'params' => '
moduleclass_sfx=-slide red
cache=0
',
'user' => 0,
'name' => 'custom',
//'style' => isset($module['style']) ? $module['style'] : 'rounded',
'style' => 'xhtml'
);
return null;
die('<pre>'.print_r($load, true).'</pre>');
//*/
/*
0 =>
stdClass::__set_state(array(
'id' => '50',
'title' => 'Breadcrumb',
'module' => 'mod_breadcrumbs',
'position' => 'breadcrumb',
'content' => '',
'showtitle' => '0',
'control' => '',
'params' => 'showHome=1
homeText=Home
showLast=1
separator=
moduleclass_sfx=
cache=0
',
'user' => 0,
'name' => 'breadcrumbs',
'style' => NULL,
)),
*/
$tmp = $module;
$module = new KObject();
$module->params = 'moduleclass_sfx=' . @$tmp['moduleclass_sfx'];
$module->module = 'mod_' . $this->_identifier->package . '_' . $this->_identifier->name;
$module->id = KFactory::tmp('lib.koowa.filter.int')->sanitize(uniqid());
$module->title = (string) $title;
$module->style = isset($tmp['style']) ? $tmp['style'] : 'rounded';
$module->position = $this->_identifier->package . '-' . $this->_identifier->name;
$module->showtitle = (bool) $title;
$module->name = $this->_identifier->package . '_' . $this->_identifier->name;
$module->user = 0;
$module->content = $content;
$module->set($tmp);
if (!isset($attribs['name'])) {
$attribs['name'] = $module->position;
}
if (!isset($attribs['style'])) {
$attribs['style'] = $module->style;
}
if (!isset($attribs['first'])) {
$attribs['first'] = null;
}
if (!isset($attribs['last'])) {
$attribs['last'] = null;
}
if (($yoofix = JPATH_THEMES . DS . KFactory::get('lib.joomla.application')->getTemplate() . DS . 'lib' . DS . 'php' . DS . 'template.php') && ($isYoo = file_exists($yoofix))) {
require_once $yoofix;
}
if ($isYoo) {
$attribs['style'] = 'yoo';
}
static $chrome;
$mainframe = JFactory::getApplication();
$scope = $mainframe->scope;
//record the scope
$mainframe->scope = $module->module;
//set scope to Component name
// Get module parameters
$params = new JParameter($module->params);
// Get module path
$module->module = preg_replace('/[^A-Z0-9_\\.-]/i', '', $module->module);
$path = JPATH_BASE . DS . 'modules' . DS . $module->module . DS . $module->module . '.php';
// Load the module
if (!$module->user && file_exists($path) && empty($module->content)) {
$lang =& JFactory::getLanguage();
$lang->load($module->module);
$content = '';
ob_start();
require $path;
$module->content = ob_get_contents() . $content;
ob_end_clean();
//.........这里部分代码省略.........
示例11: removeMenu
function removeMenu($menutype = 'mainmenu')
{
$tt =& JModuleHelper::_load();
foreach ($tt as $k => $mod) {
if (!is_object($mod)) {
continue;
}
if (preg_match("/menutype={$menutype}/i", $mod->params)) {
$tt[$k]->position = 'none';
}
}
}
示例12: getModule
function getModule($id = 0, $name = '')
{
$modules =& JModuleHelper::_load();
$total = count($modules);
for ($i = 0; $i < $total; $i++) {
// Match the name of the module
if ($modules[$i]->id == $id || $modules[$i]->name == $name) {
return $modules[$i];
}
}
return null;
}
示例13:
/**
* Implements myLoad to overwrite load()
*
* @return array
*/
public static function &myLoad( ) {
return JModuleHelper::_load();
}
示例14: preloadModules
/**
* Preload modules
*
* @todo: This is currently not working
* @access private
* @param null
* @return null
*/
private function preloadModules()
{
//MageBridgeModelDebug::getInstance()->notice( 'System Plugin: Preloading modules' );
// Check the configuration variables
$module_chrome = $this->loadConfig('module_chrome');
$module_show_title = $this->loadConfig('module_show_title');
if (empty($module_chrome) && empty($module_show_title)) {
return;
}
// Import the module-helper
jimport('joomla.application.module.helper');
$modules =& JModuleHelper::_load();
// Load settings
foreach ($modules as $index => $module) {
if (preg_match('/^mod_magebridge_/', $module->module)) {
$mod =& JModuleHelper::getModule($module->name, $module->title);
if (!empty($module_chrome)) {
$mod->style = $module_chrome;
}
if (!empty($module_show_title)) {
$mod->show_title = (int) $module_show_title;
}
}
}
}
示例15:
/**
* Return modules, optionally filtered by position
*
* @param string|null $position Module position
* @return array
*/
public static function &getModules($position)
{
if ($position) {
$modules =& JModuleHelper::getModules($position);
} else {
$modules =& JModuleHelper::_load();
}
return $modules;
}