本文整理汇总了PHP中JModuleHelper::chrome方法的典型用法代码示例。如果您正苦于以下问题:PHP JModuleHelper::chrome方法的具体用法?PHP JModuleHelper::chrome怎么用?PHP JModuleHelper::chrome使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JModuleHelper
的用法示例。
在下文中一共展示了JModuleHelper::chrome方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderModule
/**
* Render the module.
*
* @param object $module A module object.
* @param array $attribs An array of attributes for the module (probably from the XML).
*
* @return string The HTML content of the module output.
*
* @since 11.1
*/
public static function renderModule($module, $attribs = array())
{
if (constant('JDEBUG')) {
JProfiler::getInstance('Application')->mark('beforeRenderModule ' . $module->module . ' (' . $module->title . ')');
}
$app = JFactory::getApplication();
// Record the scope.
$scope = $app->scope;
// Set scope to component name
$app->scope = $module->module;
// Get module parameters
$params = new JRegistry();
$params->loadString($module->params);
// Get module path
$module->module = preg_replace('/[^A-Z0-9_\\.-]/i', '', $module->module);
$path = JPATH_BASE . '/modules/' . $module->module . '/' . $module->module . '.php';
// Load the module
// $module->user is a check for 1.0 custom modules and is deprecated refactoring
if (empty($module->user)) {
$lang = JFactory::getLanguage();
// 1.5 or Core then 1.6 3PD
$lang->load($module->module, JPATH_BASE, null, false, false) || $lang->load($module->module, dirname($path), null, false, false) || $lang->load($module->module, JPATH_BASE, $lang->getDefault(), false, false) || $lang->load($module->module, dirname($path), $lang->getDefault(), false, false);
$paths = array(JPATH_BASE . '/modules');
$paths = array_merge(self::addIncludePath(), $paths);
if ($filePath = JPath::find($paths, $module->module . '/' . $module->module . '.php')) {
$content = '';
ob_start();
include $filePath;
$module->content = ob_get_contents() . $content;
ob_end_clean();
}
}
// Load the module chrome functions
if (!self::$chrome) {
self::$chrome = array();
}
include_once JPATH_THEMES . '/system/html/modules.php';
$chromePath = JPATH_THEMES . '/' . $app->getTemplate() . '/html/modules.php';
if (!isset(self::$chrome[$chromePath])) {
if (file_exists($chromePath)) {
include_once $chromePath;
}
self::$chrome[$chromePath] = true;
}
// Make sure a style is set
if (!isset($attribs['style'])) {
$attribs['style'] = 'none';
}
// Dynamically add outline style
if ($app->input->getBool('tp', '') && JComponentHelper::getParams('com_templates')->get('template_positions_display')) {
$attribs['style'] .= ' outline';
}
foreach (explode(' ', $attribs['style']) as $style) {
$chromeMethod = 'modChrome_' . $style;
// Apply chrome and render module
if (function_exists($chromeMethod)) {
$module->style = $attribs['style'];
ob_start();
$chromeMethod($module, $params, $attribs);
$module->content = ob_get_contents();
ob_end_clean();
}
}
// Revert the scope
$app->scope = $scope;
if (constant('JDEBUG')) {
JProfiler::getInstance('Application')->mark('afterRenderModule ' . $module->module . ' (' . $module->title . ')');
}
return $module->content;
}