当前位置: 首页>>代码示例>>PHP>>正文


PHP CTemplate::getTemplateEnvironment方法代码示例

本文整理汇总了PHP中CTemplate::getTemplateEnvironment方法的典型用法代码示例。如果您正苦于以下问题:PHP CTemplate::getTemplateEnvironment方法的具体用法?PHP CTemplate::getTemplateEnvironment怎么用?PHP CTemplate::getTemplateEnvironment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CTemplate的用法示例。


在下文中一共展示了CTemplate::getTemplateEnvironment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * Execute a request
  */
 public function execute($task = '')
 {
     global $mainframe;
     $document =& JFactory::getDocument();
     $my =& JFactory::getUser();
     $pathway =& $mainframe->getPathway();
     $menus =& JSite::getMenu();
     $menuitem =& $menus->getActive();
     $userId = JRequest::getInt('userid', '', 'GET');
     $tmpl = JRequest::getVar('tmpl', '', 'REQUEST');
     $format = JRequest::getVar('format', '', 'REQUEST');
     $nohtml = JRequest::getVar('no_html', '', 'REQUEST');
     if ($tmpl != 'component' && $format != 'feed' && $format != 'ical' && $nohtml != 1 && $format != 'raw') {
         // This is to fix MSIE that has incorrect user agent because jquery doesn't detect correctly.
         $ieFix = "<!--[if IE 6]><script type=\"text/javascript\">var jomsIE6 = true;</script><![endif]-->";
         $document->addCustomTag($ieFix);
     }
     // Add custom css for the specific view if needed.
     $config = CFactory::getConfig();
     $viewName = JString::strtolower(JRequest::getVar('view', '', 'REQUEST'));
     jimport('joomla.filesystem.file');
     if ($config->get('enablecustomviewcss')) {
         CTemplate::addStylesheet($viewName);
     }
     $env = CTemplate::getTemplateEnvironment();
     $html = '<div id="community-wrap" class="on-' . $env->joomlaTemplate . ' ' . $document->direction . '">';
     // Build the component menu module
     ob_start();
     CTemplate::renderModules('js_top');
     $moduleHTML = ob_get_contents();
     ob_end_clean();
     $html .= $moduleHTML;
     // Build the content HTML
     CFactory::load('helpers', 'azrul');
     $inbox =& $this->getModel('inbox');
     $unread = $inbox->countUnRead(array('user_id' => $my->id));
     $param = array('inbox' => $unread);
     if (!empty($task) && method_exists($this, $task)) {
         ob_start();
         if (method_exists($this, '_viewEnabled') && !$this->_viewEnabled()) {
             echo property_exists($this, '_disabledMessage') ? $this->_disabledMessage : JText::_('Function is disabled');
         } else {
             $this->{$task}();
         }
         $output = ob_get_contents();
         ob_end_clean();
     } else {
         ob_start();
         $this->display();
         $output = ob_get_contents();
         ob_end_clean();
     }
     // Build toolbar HTML
     ob_start();
     $view =& $this->getView(JRequest::getCmd('view', 'frontpage'));
     $view->showToolbar($param);
     // Header title will use view->title. If not specified, we will
     // use current page title
     $headerTitle = !empty($view->title) ? $view->title : $document->getTitle();
     $view->showHeader($headerTitle, $this->_icon);
     $header = ob_get_contents();
     ob_end_clean();
     $html .= $header;
     // @rule: Super admin should always be allowed regardless of their block status
     // block member to access profile owner details
     CFactory::load('helpers', 'owner');
     CFactory::load('libraries', 'block');
     $getBlockStatus = new blockUser();
     $blocked = $getBlockStatus->isUserBlocked($userId, $viewName);
     if ($blocked) {
         if (COwnerHelper::isCommunityAdmin()) {
             $mainframe =& JFactory::getApplication();
             $mainframe->enqueueMessage(JText::_('CC YOU ARE BLOCKED BY USER', 'error'));
         } else {
             $tmpl = new CTemplate();
             $output .= $tmpl->fetch('block.denied');
         }
     }
     // Build the component bottom module
     ob_start();
     CTemplate::renderModules('js_bottom');
     $moduleHTML = ob_get_contents();
     ob_end_clean();
     $html .= $output . $moduleHTML . '</div>';
     CFactory::load('helpers', 'string');
     $html = CStringHelper::replaceThumbnails($html);
     $html = JString::str_ireplace(array('{error}', '{warning}', '{info}'), '', $html);
     // Trigger onModuleDisplay()
     CFactory::load('libraries', 'apps');
     $appsLib = CAppPlugins::getInstance();
     $appsLib->loadApplications();
     $moduleHTML = $appsLib->triggerEvent('onModuleRender');
     $mods = array();
     foreach ($moduleHTML as $modules) {
         foreach ($modules as $position => $content) {
             if (empty($mods[$position])) {
                 $mods[$position] = '';
//.........这里部分代码省略.........
开发者ID:bizanto,项目名称:Hooked,代码行数:101,代码来源:controller.php

示例2: execute

 /**
  * Execute a request
  */
 public function execute($task)
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $document = JFactory::getDocument();
     $my = CFactory::getUser();
     $pathway = $mainframe->getPathway();
     $menus = $mainframe->getMenu();
     $menuitem = $menus->getActive();
     $userId = $jinput->get->get('userid', '', 'INT');
     $tmpl = $jinput->request->get('tmpl', '', 'STRING');
     $format = $jinput->request->get('format', '', 'STRING');
     $nohtml = $jinput->request->get('no_html', '', 'STRING');
     if ($tmpl != 'component' && $format != 'feed' && $format != 'ical' && $nohtml != 1 && $format != 'raw') {
         // This is to fix MSIE that has incorrect user agent because jquery doesn't detect correctly.
         $ieFix = "<!--[if IE 6]><script type=\"text/javascript\">var jomsIE6 = true;</script><![endif]-->";
         $document->addCustomTag($ieFix);
     }
     // Add custom css for the specific view if needed.
     $config = CFactory::getConfig();
     $viewName = JString::strtolower($jinput->request->get('view', '', 'STRING'));
     jimport('joomla.filesystem.file');
     if ($config->get('enablecustomviewcss')) {
         CTemplate::addStylesheet($viewName);
     }
     $template = JFactory::getApplication()->getTemplate();
     // echo var_dump(CTemplate::addStylesheet('beez2'));
     if ($template == 'beez_20' && JVERSION > 2 && JVERSION < 3) {
         CTemplate::addStylesheet('beez2');
     }
     $env = CTemplate::getTemplateEnvironment();
     $svgFile = CFactory::getPath('template://assets/icon/joms-icon.svg');
     // non ajax-prefixed tasks that should avoid svg
     $excludeSvgList = array('changeAvatar', 'multiUpload', 'uploadvideo');
     // exclude svg file from ajax response
     if ($svgFile && substr($task, 0, 4) != 'ajax' && !in_array($task, $excludeSvgList)) {
         include_once $svgFile;
     }
     $html = '<div id="community-wrap" class="jomsocial-wrapper on-' . $env->joomlaTemplate . ' ' . $document->direction . ' c' . ucfirst($viewName) . '">';
     $html .= '<div class="jomsocial">';
     // Build the component menu module
     ob_start();
     $tmpl = new CTemplate();
     $tmpl->renderModules('js_top');
     $moduleHTML = ob_get_contents();
     ob_end_clean();
     $html .= $moduleHTML;
     // Build the content HTML
     //CFactory::load( 'helpers' , 'azrul' );
     if (!empty($task) && method_exists($this, $task)) {
         ob_start();
         if (method_exists($this, '_viewEnabled') && !$this->_viewEnabled()) {
             echo property_exists($this, '_disabledMessage') ? $this->_disabledMessage : JText::_('COM_COMMUNITY_CONTROLLER_FUNCTION_DISABLED_WARNING');
         } else {
             $this->{$task}();
         }
         $output = ob_get_contents();
         ob_end_clean();
     } else {
         ob_start();
         $this->display();
         $output = ob_get_contents();
         ob_end_clean();
     }
     // Build toolbar HTML
     ob_start();
     $view = $this->getView(JString::strtolower($jinput->get('view', 'frontpage', 'STRING')));
     // Do not rely on the toolbar to include necessary css or javascripts.
     $view->attachHeaders();
     // Display the site's toolbar.
     $view->showToolbar();
     // Header title will use view->title. If not specified, we will
     // use current page title
     $headerTitle = !empty($view->title) ? $view->title : $document->getTitle();
     $view->showHeader($headerTitle, $this->_icon);
     $header = ob_get_contents();
     ob_end_clean();
     $html .= $header;
     // @rule: Super admin should always be allowed regardless of their block status
     // block member to access profile owner details
     //CFactory::load( 'helpers' , 'owner' );
     //CFactory::load( 'libraries' , 'block' );
     $getBlockStatus = new blockUser();
     $blocked = $getBlockStatus->isUserBlocked($userId, $viewName);
     if ($blocked) {
         if (COwnerHelper::isCommunityAdmin()) {
             $mainframe = JFactory::getApplication();
             $mainframe->enqueueMessage(JText::_('COM_COMMUNITY_YOU_ARE_BLOCKED_BY_USER', 'error'));
         } else {
             $tmpl = new CTemplate();
             $view->showToolbar();
             echo $tmpl->fetch('block.denied');
             return;
             $block = true;
         }
     }
     // Build the component bottom module
//.........这里部分代码省略.........
开发者ID:Jougito,项目名称:DynWeb,代码行数:101,代码来源:controller.php


注:本文中的CTemplate::getTemplateEnvironment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。