Esempio n. 1
0
 /**
  * Renders the comment form 
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function html(EasyBlogPost &$blog)
 {
     if (!$this->exists()) {
         return;
     }
     $output = Komento::commentify('com_easyblog', $blog, array('trigger' => 'onDisplayComments'));
     return $output;
 }
Esempio n. 2
0
 public static function getCommentHTML($blog, $comments = array(), $pagination = '')
 {
     $config = EasyBlogHelper::getConfig();
     $path = EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'comments';
     $registration = $config->get('comment_registeroncomment');
     $commentSystems = array();
     // Double check this with Joomla's registration component
     if ($registration) {
         $params = JComponentHelper::getParams('com_users');
         $registration = $params->get('allowUserRegistration') == '0' ? false : $registration;
     }
     if ($config->get('comment_facebook')) {
         require_once $path . DIRECTORY_SEPARATOR . 'facebook.php';
         $commentSystems['FACEBOOK'] = EasyBlogCommentFacebook::getHTML($blog);
         if (!$config->get('main_comment_multiple')) {
             return $commentSystems['FACEBOOK'];
         }
     }
     $easysocial = EasyBlogHelper::getHelper('EasySocial');
     if ($config->get('comment_easysocial') && $easysocial->exists()) {
         $easysocial->init();
         $commentSystems['EASYSOCIAL'] = $easysocial->getCommentHTML($blog);
         if (!$config->get('main_comment_multiple')) {
             return $commentSystems['EASYSOCIAL'];
         }
     }
     if ($config->get('comment_compojoom')) {
         $file = JPATH_ROOT . '/administrator/components/com_comment/plugin/com_easyblog/josc_com_easyblog.php';
         if (JFile::exists($file)) {
             require_once $file;
             $commentSystems['COMPOJOOM'] = CommentEasyBlog::output($blog, array());
         }
         $file = JPATH_ROOT . '/components/com_comment/helpers/utils.php';
         if (JFile::exists($file)) {
             JLoader::discover('ccommentHelper', JPATH_ROOT . '/components/com_comment/helpers');
             $commentSystems['COMPOJOOM'] = ccommentHelperUtils::commentInit('com_easyblog', $blog);
         }
         if (!$config->get('main_comment_multiple')) {
             return $commentSystems['COMPOJOOM'];
         }
     }
     if ($config->get('comment_intensedebate')) {
         require_once $path . DIRECTORY_SEPARATOR . 'intensedebate.php';
         $commentSystems['INTENSEDEBATE'] = EasyBlogCommentIntenseDebate::getHTML($blog);
         if (!$config->get('main_comment_multiple')) {
             return $commentSystems['INTENSEDEBATE'];
         }
     }
     if ($config->get('comment_disqus')) {
         require_once $path . DIRECTORY_SEPARATOR . 'disqus.php';
         $commentSystems['DISQUS'] = EasyBlogCommentDisqus::getHTML($blog);
         if (!$config->get('main_comment_multiple')) {
             return $commentSystems['DISQUS'];
         }
     }
     if ($config->get('comment_jomcomment')) {
         $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_jomcomment' . DIRECTORY_SEPARATOR . 'jomcomment.php';
         // Test if jomcomment exists.
         if (JFile::exists($file)) {
             require_once $path . DIRECTORY_SEPARATOR . 'jomcomment.php';
             $commentSystems['JOMCOMMENT'] = EasyBlogCommentJomComment::getHTML($blog);
             if (!$config->get('main_comment_multiple')) {
                 return $commentSystems['JOMCOMMENT'];
             }
         }
     }
     if ($config->get('comment_livefyre')) {
         require_once $path . DIRECTORY_SEPARATOR . 'livefyre.php';
         $commentSystems['LIVEFYRE'] = EasyBlogCommentLiveFyre::getHTML($blog);
         if (!$config->get('main_comment_multiple')) {
             return $commentSystems['LIVEFYRE'];
         }
     }
     if ($config->get('comment_jcomments')) {
         $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_jcomments' . DIRECTORY_SEPARATOR . 'jcomments.php';
         if (JFile::exists($file)) {
             require_once $path . DIRECTORY_SEPARATOR . 'jcomments.php';
             $commentSystems['JCOMMENTS'] = EasyBlogCommentJComments::getHTML($blog);
             if (!$config->get('main_comment_multiple')) {
                 return $commentSystems['JCOMMENTS'];
             }
         }
     }
     if ($config->get('comment_rscomments')) {
         $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_rscomments' . DIRECTORY_SEPARATOR . 'rscomments.php';
         if (JFile::exists($file)) {
             include_once $path . DIRECTORY_SEPARATOR . 'rscomments.php';
             $commentSystems['RSCOMMENTS'] = EasyBlogCommentRSComments::getHTML($blog);
             if (!$config->get('main_comment_multiple')) {
                 return $commentSystems['RSCOMMENTS'];
             }
         }
     }
     if ($config->get('comment_easydiscuss')) {
         $enabled = JPluginHelper::isEnabled('content', 'easydiscuss');
         if ($enabled) {
             JPluginHelper::importPlugin('content', 'easydiscuss');
             $articleParams = new stdClass();
             $result = JFactory::getApplication()->triggerEvent('onDisplayComments', array(&$blog, &$articleParams));
             if (isset($result[0]) || isset($result[1])) {
                 // There could be komento running on the site
                 if (isset($result[1]) && $result[1]) {
                     $commentSystems['EASYDISCUSS'] = $result[1];
                 } else {
                     $commentSystems['EASYDISCUSS'] = $result[0];
                 }
                 if (!$config->get('main_comment_multiple')) {
                     return $commentSystems['EASYDISCUSS'];
                 }
             }
         }
     }
     if ($config->get('comment_komento')) {
         $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_komento' . DIRECTORY_SEPARATOR . 'bootstrap.php';
         if (JFile::exists($file)) {
             include_once $file;
             $commentSystems['KOMENTO'] = Komento::commentify('com_easyblog', $blog, array('trigger' => 'onDisplayComments'));
             if (!$config->get('main_comment_multiple')) {
                 return $commentSystems['KOMENTO'];
             }
         }
     }
     if (!$config->get('main_comment_multiple') || $config->get('comment_easyblog')) {
         //check if bbcode enabled or not.
         if ($config->get('comment_bbcode')) {
             EasyBlogCommentHelper::loadBBCode();
         }
         // If all else fail, try to use the default comment system
         $theme = new CodeThemes();
         // setup my own info to show in comment form area
         $my = JFactory::getUser();
         $profile = EasyBlogHelper::getTable('Profile', 'Table');
         $profile->load($my->id);
         $my->avatar = $profile->getAvatar();
         $my->displayName = $profile->getName();
         $my->url = $profile->url;
         $blogURL = base64_encode(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blog->id, false));
         $loginURL = EasyBlogHelper::getLoginLink($blogURL);
         $enableRecaptcha = $config->get('comment_recaptcha');
         $publicKey = $config->get('comment_recaptcha_public');
         // check if the user has subcribed to this thread
         $subscriptionId = false;
         if ($my->id > 0) {
             $blogModel = EasyblogHelper::getModel('Blog');
             $subscriptionId = $blogModel->isBlogSubscribedUser($blog->id, $my->id, $my->email);
             $subscriptionId = is_null($subscriptionId) ? false : $subscriptionId;
         }
         $theme->set('loginURL', $loginURL);
         $theme->set('blog', $blog);
         $theme->set('my', $my);
         $theme->set('config', $config);
         $theme->set('blogComments', $comments);
         $theme->set('pagination', $pagination);
         $theme->set('allowComment', true);
         $theme->set('canRegister', $registration);
         $theme->set('acl', EasyBlogACLHelper::getRuleSet());
         $theme->set('subscriptionId', $subscriptionId);
         $commentSystems['EASYBLOGCOMMENTS'] = $theme->fetch('blog.comment.box.php');
     }
     if (!$config->get('main_comment_multiple')) {
         return $commentSystems['EASYBLOGCOMMENTS'];
     }
     // If there's 1 system only, there's no point loading the tabs.
     if (count($commentSystems) == 1) {
         return $commentSystems[key($commentSystems)];
     }
     unset($theme);
     // Reverse the comment systems array so that easyblog comments are always the first item.
     $commentSystems = array_reverse($commentSystems);
     $theme = new CodeThemes();
     $theme->set('commentSystems', $commentSystems);
     return $theme->fetch('blog.comment.multiple.php');
 }
Esempio n. 3
0
                require_once $jcomments;
                echo JComments::show($this->item->id, 'com_djcatalog2', $this->item->name);
            }
            ?>
	<?php 
        } else {
            if ($this->params->get('comments', 0) == '4') {
                ?>
   	<?php 
                $komento = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_komento' . DIRECTORY_SEPARATOR . 'bootstrap.php';
                if (file_exists($komento)) {
                    require_once $komento;
                    $options = array();
                    $options['trigger'] = 'onDJCatalog2Item';
                    $options['context'] = 'com_djcatalog2.item';
                    $options['params'] = $this->params;
                    $comments = Komento::commentify('com_djcatalog2', $this->item, $options);
                    if ($comments) {
                        echo $comments;
                    }
                }
                ?>
	<?php 
            }
        }
    }
}
?>
					
</div>
Esempio n. 4
0
        echo $this->mail->mailid;
        ?>
";
				var disqus_shortname = "<?php 
        echo $disqus_shortname;
        ?>
";
				var disqus_config = function () {
					this.language = "<?php 
        echo $lang_shortcode[0];
        ?>
";
				};
				(function() {
					var dsq = document.createElement("script"); dsq.type = "text/javascript"; dsq.async = true;
					dsq.src = "http://" + disqus_shortname + ".disqus.com/embed.js";
					(document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq);
				})();
			</script>
			<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<?php 
    }
} elseif ($this->config->get('comments_feature') == 'rscomments') {
    echo '{rscomments option="com_acymailing" id="' . $this->mail->mailid . '"}';
} elseif ($this->config->get('comments_feature') == 'komento') {
    require_once JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_komento' . DIRECTORY_SEPARATOR . 'bootstrap.php';
    echo Komento::commentify('com_acymailing', $this->mail, array());
}
?>
</div>
Esempio n. 5
0
        if ($params->get('show_hits')) {
            ?>
					<dd>
						<div class="item_hits">
							<?php 
            echo JText::sprintf('COM_CONTENT_ARTICLE_HITS', $item->hits);
            ?>
						</div>
					</dd>
					<?php 
        }
        if (Komento::loadApplication('com_content')) {
            ?>
					<dd class="komento">
						<?php 
            echo Komento::commentify('com_content', $item);
            ?>
					</dd>
					<?php 
        }
        ?>
				</dl>
			</footer>
			<?php 
    }
    ?>
		</article>
	</div>
	<?php 
}
?>
Esempio n. 6
0
    /**
     * Loads the comments from the installed/selected comment system. The comment system <code>type</code> should tell which comment system need to be used to load the comments from. The possible values are:<br><br>
     * jcomment - JComments (id and title are required) <br>
     * fbcomment - Facebook comment system (url is required)<br>
     * disqus - Disqus comment system (id, title, identifier and url are required)<br>
     * intensedebate - Intense Debate comment system (id, title, identifier and url are required)<br>
     * jacomment - JAComment system (id and title are required)<br>
     * jomcomment - JomComment (id is required)<br><br>
     * Passing any other value will silently skips the code. In all the above cases, <code>type</code> and <code>app_name</code> are required parameters. 
     * While <code>type</code> specifies the comment system to be used, <code>app_name</code> is the Joomla extension name (ex: com_appname) which is loading the comments for its content.
     *  
     * @param string $type comment system type
     * @param string $app_name extension name
     * @param int $id id of the content for which the comments are being loaded
     * @param string $title title of the content
     * @param string $url page url in case of facebook/disqus/intensedebate comment system.
     * @param string $identifier disqus username in case of disqus/intensedebate comment system.
     * @param object $item the item object for kommento
     * 
     * @return string the code to render the comments.
     */
    public static function load_comments($type, $app_name, $id = 0, $title = '', $url = '', $identifier = '', $item = null)
    {
        switch ($type) {
            case 'jcomment':
                $app = JFactory::getApplication();
                $path = JPATH_ROOT . DS . 'components' . DS . 'com_jcomments' . DS . 'jcomments.php';
                if (file_exists($path)) {
                    require_once $path;
                    return JComments::showComments($id, $app_name, $title);
                }
                break;
            case 'fbcomment':
                return '
					<div id="fb-root"></div>
					<script type="text/javascript">
						(function(d, s, id) {
							var js, fjs = d.getElementsByTagName(s)[0]; 
							if (d.getElementById(id)) return; 
							js = d.createElement(s); 
							js.id = id;
							js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3";
							fjs.parentNode.insertBefore(js, fjs); 
						}(document, "script", "facebook-jssdk"));
					</script>
					<div class="fb-comments" data-href="' . $url . '" data-num-posts="5" data-width="640"></div>';
            case 'disqus':
                return '
					<div id="disqus_thread"></div>
					<script type="text/javascript">
						var disqus_shortname = "' . $identifier . '";
// 						var disqus_developer = 1;
						var disqus_identifier = "' . $id . '";
						var disqus_url = "' . $url . '";
						var disqus_title = "' . $title . '";
						(function() {
							var dsq = document.createElement("script"); 
							dsq.type = "text/javascript"; 
							dsq.async = true;
							dsq.src = "http://" + disqus_shortname + ".disqus.com/embed.js";
							(document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq);
						})();
					</script>
					<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>';
            case 'intensedebate':
                return '
					<script>
						var idcomments_acct = "' . $identifier . '";
						var idcomments_post_id = "' . $id . '";
						var idcomments_post_url = "' . $url . '";
					</script>
					<span id="IDCommentsPostTitle" style="display:none"></span>
					<script type="text/javascript" src="http://www.intensedebate.com/js/genericCommentWrapperV2.js"></script>';
                break;
            case 'jacomment':
                if (!JRequest::getInt('print') && file_exists(JPATH_SITE . DS . 'components' . DS . 'com_jacomment' . DS . 'jacomment.php') && file_exists(JPATH_SITE . DS . 'plugins' . DS . 'system' . DS . 'jacomment.php')) {
                    $_jacCode = "#{jacomment(.*?) contentid=(.*?) option=(.*?) contenttitle=(.*?)}#i";
                    $_jacCodeDisableid = "#{jacomment(\\s)off.*}#i";
                    $_jacCodeDisable = "#{jacomment(\\s)off}#i";
                    if (!preg_match($_jacCode, $title) && !preg_match($_jacCodeDisable, $title) && !preg_match($_jacCodeDisableid, $title)) {
                        return '{jacomment contentid=' . $id . ' option=' . $app_name . ' contenttitle=' . $title . '}';
                    }
                }
                break;
            case 'jomcomment':
                $path = JPATH_PLUGINS . DS . 'content' . DS . 'jom_comment_bot.php';
                if (file_exists($path)) {
                    include_once $path;
                    return jomcomment($id, $app_name);
                }
                break;
            case 'kommento':
                $api = JPATH_ROOT . DS . 'components' . DS . 'com_komento' . DS . 'bootstrap.php';
                if (file_exists($api)) {
                    require_once $api;
                    $item->text = $item->introtext = !empty($item->description) ? $item->description : '';
                    return Komento::commentify($app_name, $item);
                }
                break;
            case 'ccomment':
                $utils = JPATH_ROOT . '/components/com_comment/helpers/utils.php';
                if (file_exists($utils)) {
                    JLoader::discover('ccommentHelper', JPATH_ROOT . '/components/com_comment/helpers');
                    return ccommentHelperUtils::commentInit($app_name, $item);
                }
                break;
        }
    }
Esempio n. 7
0
	private function execute( $eventTrigger, $context = '', &$article, &$params, $page = 0 )
	{
		static $bootstrap;

		// @task: load bootstrap
		if( !$bootstrap )
		{
			$file	= JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_komento' . DIRECTORY_SEPARATOR . 'bootstrap.php';

			jimport('joomla.filesystem.file');

			if( !JFile::exists( $file ) )
			{
				// missing bootstrap
				return false;
			}

			require_once( $file );
			$bootstrap = true;
		}

		if( !$this->extension )
		{
			$this->extension = JRequest::getCmd( 'option' );
		}

		// @task: trigger onAfterEventTriggered
		if( !$result = Komento::onAfterEventTriggered( __CLASS__, $eventTrigger, $this->extension, $context, $article, $params ) )
		{
			return false;
		}

		// @task: trigger onBeforeCommentify
		// if( !$result = Komento::loadApplication( $this->extension )->onBeforeCommentify( $eventTrigger, $context, $article, $params, $page ) )
		// {
		// 	return false;
		// }

		// Passing in the data
		$options			= array();
		$options['trigger']	= $eventTrigger;
		$options['context']	= $context;
		$options['params']	= $params;
		$options['page']	= $page;

		// Ready to Commentify!
		return Komento::commentify( $this->extension, $article, $options );
	}
Esempio n. 8
0
                    ?>
					<div class="djcf_comments jcomments_comments_box">
						<h2><?php 
                    echo JText::_('COM_DJCLASSIFIEDS_COMMENTS');
                    ?>
</h2>
						<?php 
                    echo JComments::show($this->item->id, 'com_djclassifieds', $this->item->name);
                    ?>
					</div>
					<?php 
                }
            } else {
                if ($par->get('comments', '0') == 4) {
                    $komento = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_komento' . DIRECTORY_SEPARATOR . 'bootstrap.php';
                    if (file_exists($komento)) {
                        require_once $komento;
                        $options = array();
                        $options['trigger'] = 'onDJClassifiedsItem';
                        $options['context'] = 'com_djclassifieds.item';
                        $options['params'] = $par;
                        $comments = Komento::commentify('com_djclassifieds', $this->item, $options);
                        if ($comments) {
                            echo $comments;
                        }
                    }
                }
            }
        }
    }
}
Esempio n. 9
0
    if ($params->get('show_hits')) {
        ?>
		<dd>
			<div class="item_hits">
				<?php 
        echo JText::sprintf('COM_CONTENT_ARTICLE_HITS', $this->item->hits);
        ?>
			</div>
		</dd>
		<?php 
    }
    if (Komento::loadApplication('com_content')) {
        ?>
		<dd class="komento">
			<?php 
        echo Komento::commentify('com_content', $this->item);
        ?>
		</dd>
	<?php 
    }
    ?>
	</dl>
</footer>
<?php 
}
if ($params->get('show_readmore') && $this->item->readmore) {
    if ($params->get('access-view')) {
        $link = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid));
    } else {
        $menu = JFactory::getApplication()->getMenu();
        $active = $menu->getActive();
Esempio n. 10
0
 private function execute($eventTrigger, $context = 'none', &$article, &$params, $page = 0)
 {
     static $bootstrap;
     // @task: load bootstrap
     if (!$bootstrap) {
         $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_komento' . DIRECTORY_SEPARATOR . 'bootstrap.php';
         jimport('joomla.filesystem.file');
         if (!JFile::exists($file)) {
             // missing bootstrap
             return false;
         }
         require_once $file;
         $bootstrap = true;
     }
     if (!$this->extension) {
         $this->extension = JRequest::getCmd('option');
     }
     // Fix flexicontent's mess as they are trying to reset the option=com_flexicontent to com_content.
     if (JRequest::getVar('isflexicontent')) {
         $this->extension = 'com_flexicontent';
     }
     // @task: trigger onAfterEventTriggered
     if (!($result = Komento::onAfterEventTriggered(__CLASS__, $eventTrigger, $this->extension, $context, $article, $params))) {
         return false;
     }
     // Passing in the data
     $options = array();
     $options['trigger'] = $eventTrigger;
     $options['context'] = $context;
     $options['params'] = $params;
     $options['page'] = $page;
     // Ready to Commentify!
     return Komento::commentify($this->extension, $article, $options);
 }