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


PHP JCommentsFactory::getDocument方法代码示例

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


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

示例1: plgSystemJComments

function plgSystemJComments()
{
    global $mosConfig_absolute_path, $mainframe;
    include_once $mosConfig_absolute_path . '/components/com_jcomments/jcomments.legacy.php';
    if (!defined('JCOMMENTS_JVERSION')) {
        return;
    }
    include_once JCOMMENTS_BASE . '/jcomments.class.php';
    include_once JCOMMENTS_BASE . '/jcomments.config.php';
    include_once JCOMMENTS_HELPERS . '/system.php';
    $document = JCommentsFactory::getDocument();
    if (!defined('JCOMMENTS_CSS')) {
        $document->addStyleSheet(JCommentsSystemPluginHelper::getCSS());
        define('JCOMMENTS_CSS', 1);
    }
    if (!$mainframe->isAdmin()) {
        if (!defined('JCOMMENTS_JS')) {
            $document->addScript(JCommentsSystemPluginHelper::getCoreJS());
            define('JCOMMENTS_JS', 1);
        }
        if (!defined('JOOMLATUNE_AJAX_JS')) {
            $document->addScript(JCommentsSystemPluginHelper::getAjaxJS());
            define('JOOMLATUNE_AJAX_JS', 1);
        }
    }
}
开发者ID:sergy444,项目名称:joomla,代码行数:26,代码来源:jcomments.j10.php

示例2: show

 public static function show($object_id, $object_group = 'com_content', $object_title = '')
 {
     // only one copy of JComments per page is allowed
     if (defined('JCOMMENTS_SHOW')) {
         return '';
     }
     $app = JCommentsFactory::getApplication('site');
     $object_group = JCommentsSecurity::clearObjectGroup($object_group);
     if ($object_group == '' || !isset($object_id) || $object_id == '') {
         return '';
     }
     $object_id = (int) $object_id;
     $object_title = trim($object_title);
     $acl = JCommentsFactory::getACL();
     $config = JCommentsFactory::getConfig();
     $document = JCommentsFactory::getDocument();
     $tmpl = JCommentsFactory::getTemplate($object_id, $object_group);
     $tmpl->load('tpl_index');
     if (!defined('JCOMMENTS_CSS')) {
         include_once JCOMMENTS_HELPERS . DS . 'system.php';
         if ($app->isAdmin()) {
             $tmpl->addVar('tpl_index', 'comments-css', 1);
         } else {
             $document->addStyleSheet(JCommentsSystemPluginHelper::getCSS());
             if (JCOMMENTS_JVERSION != '1.0') {
                 $language = JFactory::getLanguage();
                 if ($language->isRTL()) {
                     $rtlCSS = JCommentsSystemPluginHelper::getCSS(true);
                     if ($rtlCSS != '') {
                         $document->addStyleSheet($rtlCSS);
                     }
                 }
             }
         }
     }
     if (!defined('JCOMMENTS_JS')) {
         include_once JCOMMENTS_HELPERS . DS . 'system.php';
         $document->addScript(JCommentsSystemPluginHelper::getCoreJS());
         define('JCOMMENTS_JS', 1);
         if (!defined('JOOMLATUNE_AJAX_JS')) {
             $document->addScript(JCommentsSystemPluginHelper::getAjaxJS());
             define('JOOMLATUNE_AJAX_JS', 1);
         }
     }
     $commentsCount = JComments::getCommentsCount($object_id, $object_group);
     $commentsPerObject = $config->getInt('max_comments_per_object');
     $showForm = $config->getInt('form_show') == 1 || $config->getInt('form_show') == 2 && $commentsCount == 0;
     if ($commentsPerObject != 0 && $commentsCount >= $commentsPerObject) {
         $config->set('comments_locked', 1);
     }
     if ($config->getInt('comments_locked', 0) == 1) {
         $config->set('enable_rss', 0);
         $tmpl->addVar('tpl_index', 'comments-form-locked', 1);
         $acl->setCommentsLocked(true);
     }
     $tmpl->addVar('tpl_index', 'comments-form-captcha', $acl->check('enable_captcha'));
     $tmpl->addVar('tpl_index', 'comments-form-link', $showForm ? 0 : 1);
     if ($config->getInt('enable_rss') == 1) {
         if ($document->getType() == 'html') {
             $link = JCommentsFactory::getLink('rss', $object_id, $object_group);
             $title = JCOMMENTS_JVERSION == '1.0' ? htmlspecialchars($object_title) : htmlspecialchars($object_title, ENT_COMPAT, 'UTF-8');
             $attribs = array('type' => 'application/rss+xml', 'title' => $title);
             $document->addHeadLink($link, 'alternate', 'rel', $attribs);
         }
     }
     $cacheEnabled = intval($app->getCfg('caching')) == 1;
     if ($cacheEnabled == 0) {
         $jrecache = $app->getCfg('absolute_path') . DS . 'components' . DS . 'com_jrecache' . DS . 'jrecache.config.php';
         if (is_file($jrecache)) {
             $cfg = new _JRECache_Config();
             $cacheEnabled = $cacheEnabled && $cfg->enable_cache;
         }
     }
     $load_cached_comments = intval($config->getInt('load_cached_comments', 0) && $commentsCount > 0);
     if ($cacheEnabled) {
         $tmpl->addVar('tpl_index', 'comments-anticache', 1);
     }
     if (!$cacheEnabled || $load_cached_comments === 1) {
         if ($config->get('template_view') == 'tree') {
             $tmpl->addVar('tpl_index', 'comments-list', $commentsCount > 0 ? JComments::getCommentsTree($object_id, $object_group) : '');
         } else {
             $tmpl->addVar('tpl_index', 'comments-list', $commentsCount > 0 ? JComments::getCommentsList($object_id, $object_group) : '');
         }
     }
     $needScrollToComment = ($cacheEnabled || $config->getInt('comments_per_page') > 0) && $commentsCount > 0;
     $tmpl->addVar('tpl_index', 'comments-gotocomment', (int) $needScrollToComment);
     $tmpl->addVar('tpl_index', 'comments-form', JComments::getCommentsForm($object_id, $object_group, $showForm));
     $tmpl->addVar('tpl_index', 'comments-form-position', $config->getInt('form_position'));
     $result = $tmpl->renderTemplate('tpl_index');
     $tmpl->freeAllTemplates();
     define('JCOMMENTS_SHOW', 1);
     return $result;
 }
开发者ID:sergy444,项目名称:joomla,代码行数:93,代码来源:jcomments.php


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