private function renderComponent(Component $viewComp) { if (isset($_GET["ajax"])) { return StringUtil::getJson("body", $viewComp->renderBodyChildren()); } $view = $viewComp->render(); if (isset($_GET["file"])) { $view .= $this->jsRewriteParent(); } return $view; }
/** * Render the component. * * @param string $option The component option. * @param array $params The component parameters * * @return object * * @since 11.1 */ public static function renderComponent($option, $params = array()) { if (!self::isLegacy()) { return \Component::render($option, $params); } // Initialise variables. $app = JFactory::getApplication(); // Load template language files. $template = $app->getTemplate(true)->template; $lang = JFactory::getLanguage(); $lang->load('tpl_' . $template, JPATH_BASE, null, false, true) || $lang->load('tpl_' . $template, JPATH_THEMES . "/{$template}", null, false, true); if (empty($option)) { // Throw 404 if no component JError::raiseError(404, JText::_('JLIB_APPLICATION_ERROR_COMPONENT_NOT_FOUND')); return; } // Record the scope $scope = $app->scope; // Set scope to component name $app->scope = $option; // Build the component path. $option = preg_replace('/[^A-Z0-9_\\.-]/i', '', $option); $file = substr($option, 4); // Define component path. define('JPATH_COMPONENT', JPATH_BASE . '/components/' . $option); define('JPATH_COMPONENT_SITE', JPATH_SITE . '/components/' . $option); define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR . '/components/' . $option); // Get component path if ($app->isAdmin() && file_exists(JPATH_COMPONENT . '/admin.' . $file . '.php')) { JLog::add('Files in the format admin.COMPONENTNAME.php are considered deprecated and will not be loaded in Joomla 3.0.', JLog::WARNING, 'deprecated'); $path = JPATH_COMPONENT . '/admin.' . $file . '.php'; } else { $path = JPATH_COMPONENT . '/' . $file . '.php'; } // [!] HUBZERO - Set path and constants for combined components $client = $app->isAdmin() ? 'admin' : 'site'; // Get component path if (is_dir(JPATH_SITE . '/components/' . $option . '/' . $client)) { define('JPATH_COMPONENT', JPATH_SITE . '/components/' . $option . '/' . $client); define('JPATH_COMPONENT_SITE', JPATH_SITE . '/components/' . $option . '/site'); define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_SITE . '/components/' . $option . '/admin'); } else { define('JPATH_COMPONENT', JPATH_BASE . '/components/' . $option); define('JPATH_COMPONENT_SITE', JPATH_SITE . '/components/' . $option); define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR . '/components/' . $option); } $path = JPATH_COMPONENT . '/' . $file . '.php'; // [!] HUBZERO - END Set path and constants for combined components // If component is disabled throw error if (!self::isEnabled($option) || !file_exists($path)) { JError::raiseError(404, JText::_('JLIB_APPLICATION_ERROR_COMPONENT_NOT_FOUND')); } $task = JRequest::getString('task'); // Load common and local language files. $lang->load($option, JPATH_BASE, null, false, true) || $lang->load($option, JPATH_COMPONENT, null, false, true); // Handle template preview outlining. $contents = null; // Execute the component. $contents = self::executeComponent($path); // Revert the scope $app->scope = $scope; return $contents; }
/** * Force an update on a specified component * * @param Component $c * * @return void */ public function renderNow(Component $c) { ob_start(); $c->render(); $this->response->setUpdate($c->getDivId(), ob_get_clean()); }
protected function renderChild(Component $child) { $child->render(); }